(username, shadow_name)
Sync the password hash for the shadow admin account with the user's.
Sync the password hash for the shadow admin account with the user's.
Sync the password hash for the shadow admin account with the user s .
def SyncShadowHash(username, shadow_name):
  """Sync the password hash for the shadow admin account with the user's."""
  shadow_guid = UserAttribute(shadow_name, 'GeneratedUID')
  user_hash = '/var/db/shadow/hash/%s' % username
  if not os.path.exists(user_hash):
    user_guid = UserAttribute(username, 'GeneratedUID')[0]
    user_hash = '/var/db/shadow/hash/%s' % user_guid
  shadow_hash = '/var/db/shadow/hash/%s' % shadow_guid[0]

  try:
    if (os.path.exists(shadow_hash)
        and os.path.isfile(shadow_hash)
        and filecmp.cmp(user_hash, shadow_hash, shallow=False)):
      # everything is as should be
      pass
    else:
      shutil.copy2(user_hash, shadow_hash)
  except (IOError, OSError), err:
    raise DSException('Error creating the shadow admin hash for '
                      '%s-admin: %s' % (username, err))
def SyncShadowHash ( username , shadow_name ) : shadow_guid = UserAttribute ( shadow_name , 'GeneratedUID' ) user_hash = '/var/db/shadow/hash/%s' % username if not os . path . exists ( user_hash ) : user_guid = UserAttribute ( username , 'GeneratedUID' ) [ 0 ] user_hash = '/var/db/shadow/hash/%s' % user_guid shadow_hash = '/var/db/shadow/hash/%s' % shadow_guid [ 0 ] try : if ( os . path . exists ( shadow_hash ) and os . path . isfile ( shadow_hash ) and filecmp . cmp ( user_hash , shadow_hash , shallow = False ) ) : # everything is as should be pass else : shutil . copy2 ( user_hash , shadow_hash ) except ( IOError , OSError ) , err : raise DSException ( 'Error creating the shadow admin hash for ' '%s-admin: %s' % ( username , err ) )