• Home
  • Raw
  • Download

Lines Matching full:user

28 def get_user_hash(user):  argument
29 """Get the user hash for the given user."""
31 '--user=%s' % user])
34 def user_path(user): argument
35 """Get the user mount point for the given user."""
36 return utils.system_output(['cryptohome-path', 'user', user])
39 def system_path(user): argument
40 """Get the system mount point for the given user."""
41 return utils.system_output(['cryptohome-path', 'system', user])
44 def temporary_mount_path(user): argument
45 """Get the vault mount path used during crypto-migration for the user.
47 @param user: user the temporary mount should be for
49 return TEMP_MOUNT_PATTERN % (get_user_hash(user))
52 def vault_path(user): argument
53 """ Get the vault path for the given user.
55 @param user: The user who's vault path should be returned.
57 return VAULT_PATH_PATTERN % (get_user_hash(user))
60 def ensure_clean_cryptohome_for(user, password=None): argument
61 """Ensure a fresh cryptohome exists for user.
63 @param user: user who needs a shiny new cryptohome.
68 remove_vault(user)
69 mount_vault(user, password, create=True)
255 def remove_vault(user): argument
256 """Remove the given user's vault from the shadow directory."""
257 logging.debug('user is %s', user)
258 user_hash = get_user_hash(user)
259 logging.debug('Removing vault for user %s with hash %s', user, user_hash)
260 cmd = CRYPTOHOME_CMD + ' --action=remove --force --user=%s' % user
264 raise ChromiumOSError('Cryptohome could not remove the user\'s vault.')
275 logging.debug('Removing vault for user with hash %s', item)
279 def mount_vault(user, password, create=False): argument
280 """Mount the given user's vault."""
281 args = [CRYPTOHOME_CMD, '--action=mount', '--user=%s' % user,
287 user_hash = get_user_hash(user)
295 # TODO: Remove this additional call to get_user_hash(user) when
297 user_hash = get_user_hash(user)
304 if not is_permanent_vault_mounted(user=user, allow_fail=True):
309 """Mount the given user's vault."""
317 def test_auth(user, password): argument
318 cmd = [CRYPTOHOME_CMD, '--action=test_auth', '--user=%s' % user,
323 def unmount_vault(user): argument
324 """Unmount the given user's vault.
326 Once unmounting for a specific user is supported, the user parameter will
327 name the target user. See crosbug.com/20778.
331 if is_vault_mounted(user, allow_fail=True):
332 raise ChromiumOSError('Cryptohome did not unmount the user.')
352 def __get_user_mount_info(user, allow_fail=False): argument
353 """Get information about the active mounts for a given user.
355 Returns the active mounts at the user's user and system mount points. If no
356 user is given, the active mount at the shared mount point is returned
358 compatibility; the guest user has a mount at this mount point only).
360 return [__get_mount_info(mount_point=user_path(user),
362 __get_mount_info(mount_point=system_path(user),
365 def is_vault_mounted(user, regexes=None, allow_fail=False): argument
366 """Check whether a vault is mounted for the given user.
368 user: If no user is given, the shared mount point is checked, determining
369 whether a vault is mounted for any user.
371 The mount filesystem for the user's user and system mounts point must
382 user_mount_info = __get_user_mount_info(user=user, allow_fail=allow_fail)
385 # user user/system mount (/home/user/.... /home/root/...)
422 """Check whether a vault backed by tmpfs is mounted for the guest user."""
424 user=GUEST_USER_NAME,
431 def is_permanent_vault_mounted(user, allow_fail=False): argument
432 """Check if user is mounted over ecryptfs or ext4 crypto. """
434 user=user,
443 def get_mounted_vault_path(user, allow_fail=False): argument
444 """Get the path where the decrypted data for the user is located."""
445 return os.path.join(constants.SHADOW_ROOT, get_user_hash(user), 'mount')
489 def create_ecryptfs_homedir(user, password): argument
492 If a home directory for the user exists already, it will be removed.
495 @param user: Username to create the home directory for.
498 unmount_vault(user)
499 remove_vault(user)
503 '--user=%s' % user,
509 if not is_vault_mounted(user, regexes={
516 def do_dircrypto_migration(user, password, timeout=600): argument
517 """Start dircrypto migration for the user.
519 @param user: The user to migrate.
524 unmount_vault(user)
529 '--user=%s' % user,
532 if not __get_mount_info(temporary_mount_path(user), allow_fail=True):
534 args = [CRYPTOHOME_CMD, '--action=migrate_to_dircrypto', '--user=%s' % user]
538 temporary_mount_path(user), allow_fail=True),
625 def mount(self, user, password, create=False, async=True): argument
629 TODO(ellyjones): Migrate mount_vault() to use a multi-user-safe
633 return self.__async_call(self.iface.AsyncMount, user, password,
635 out = self.__call(self.iface.Mount, user, password, create, False, [])
640 def unmount(self, user): argument
644 TODO(ellyjones): Once there's a per-user unmount method, use it. See
650 def is_mounted(self, user): argument
651 """Tests whether a user's cryptohome is mounted."""
652 return (utils.is_mountpoint(user_path(user))
653 and utils.is_mountpoint(system_path(user)))
656 def require_mounted(self, user): argument
657 """Raises a test failure if a user's cryptohome is not mounted."""
658 utils.require_mountpoint(user_path(user))
659 utils.require_mountpoint(system_path(user))
662 def migrate(self, user, oldkey, newkey, async=True): argument
663 """Migrates the specified user's cryptohome from one key to another."""
666 user, oldkey, newkey)['return_status']
667 return self.__call(self.iface.MigrateKey, user, oldkey, newkey)
670 def remove(self, user, async=True): argument
673 user)['return_status']
674 return self.__call(self.iface.Remove, user)
677 def ensure_clean_cryptohome_for(self, user, password=None): argument
678 """Ensure a fresh cryptohome exists for user.
680 @param user: user who needs a shiny new cryptohome.
685 self.remove(user)
686 self.mount(user, password, create=True)