int home_activate_cifs(
UserRecord *h,
+ HomeSetupFlags flags,
HomeSetup *setup,
PasswordCache *cache,
UserRecord **ret_home) {
if (r < 0)
return r;
- r = home_refresh(h, setup, header_home, cache, NULL, &new_home);
+ r = home_refresh(h, flags, setup, header_home, cache, NULL, &new_home);
if (r < 0)
return r;
int home_setup_cifs(UserRecord *h, HomeSetupFlags flags, HomeSetup *setup);
-int home_activate_cifs(UserRecord *h, HomeSetup *setup, PasswordCache *cache, UserRecord **ret_home);
+int home_activate_cifs(UserRecord *h, HomeSetupFlags flags, HomeSetup *setup, PasswordCache *cache, UserRecord **ret_home);
int home_create_cifs(UserRecord *h, HomeSetup *setup, UserRecord **ret_home);
int home_activate_directory(
UserRecord *h,
+ HomeSetupFlags flags,
HomeSetup *setup,
PasswordCache *cache,
UserRecord **ret_home) {
assert_se(hdo = user_record_home_directory(h));
hd = strdupa_safe(hdo);
- r = home_setup(h, 0, setup, cache, &header_home);
+ r = home_setup(h, flags, setup, cache, &header_home);
if (r < 0)
return r;
- r = home_refresh(h, setup, header_home, cache, NULL, &new_home);
+ r = home_refresh(h, flags, setup, header_home, cache, NULL, &new_home);
if (r < 0)
return r;
if (r < 0)
return r;
- r = home_maybe_shift_uid(h, setup);
+ r = home_maybe_shift_uid(h, flags, setup);
if (r < 0)
return r;
#include "user-record.h"
int home_setup_directory(UserRecord *h, HomeSetup *setup);
-int home_activate_directory(UserRecord *h, HomeSetup *setup, PasswordCache *cache, UserRecord **ret_home);
+int home_activate_directory(UserRecord *h, HomeSetupFlags flags, HomeSetup *setup, PasswordCache *cache, UserRecord **ret_home);
int home_create_directory_or_subvolume(UserRecord *h, HomeSetup *setup, UserRecord **ret_home);
int home_resize_directory(UserRecord *h, HomeSetupFlags flags, HomeSetup *setup, PasswordCache *cache, UserRecord **ret_home);
int home_activate_luks(
UserRecord *h,
+ HomeSetupFlags flags,
HomeSetup *setup,
PasswordCache *cache,
UserRecord **ret_home) {
r = home_refresh(
h,
+ flags,
setup,
luks_home_record,
cache,
int home_setup_luks(UserRecord *h, HomeSetupFlags flags, const char *force_image_path, HomeSetup *setup, PasswordCache *cache, UserRecord **ret_luks_home);
-int home_activate_luks(UserRecord *h, HomeSetup *setup, PasswordCache *cache, UserRecord **ret_home);
+int home_activate_luks(UserRecord *h, HomeSetupFlags flags, HomeSetup *setup, PasswordCache *cache, UserRecord **ret_home);
int home_deactivate_luks(UserRecord *h, HomeSetup *setup);
int home_trim_luks(UserRecord *h, HomeSetup *setup);
int home_maybe_shift_uid(
UserRecord *h,
+ HomeSetupFlags flags,
HomeSetup *setup) {
_cleanup_close_ int mount_fd = -1;
assert(setup);
assert(setup->root_fd >= 0);
+ /* If the home dir is already activated, then the UID shift is already applied. */
+ if (FLAGS_SET(flags, HOME_SETUP_ALREADY_ACTIVATED))
+ return 0;
+
if (fstat(setup->root_fd, &st) < 0)
return log_error_errno(errno, "Failed to stat() home directory: %m");
int home_refresh(
UserRecord *h,
+ HomeSetupFlags flags,
HomeSetup *setup,
UserRecord *header_home,
PasswordCache *cache,
if (r < 0)
return r;
- r = home_maybe_shift_uid(h, setup);
+ r = home_maybe_shift_uid(h, flags, setup);
if (r < 0)
return r;
_cleanup_(home_setup_done) HomeSetup setup = HOME_SETUP_INIT;
_cleanup_(user_record_unrefp) UserRecord *new_home = NULL;
_cleanup_(password_cache_free) PasswordCache cache = {};
+ HomeSetupFlags flags = 0;
int r;
assert(h);
switch (user_record_storage(h)) {
case USER_LUKS:
- r = home_activate_luks(h, &setup, &cache, &new_home);
+ r = home_activate_luks(h, flags, &setup, &cache, &new_home);
if (r < 0)
return r;
case USER_SUBVOLUME:
case USER_DIRECTORY:
case USER_FSCRYPT:
- r = home_activate_directory(h, &setup, &cache, &new_home);
+ r = home_activate_directory(h, flags, &setup, &cache, &new_home);
if (r < 0)
return r;
break;
case USER_CIFS:
- r = home_activate_cifs(h, &setup, &cache, &new_home);
+ r = home_activate_cifs(h, flags, &setup, &cache, &new_home);
if (r < 0)
return r;
int home_setup(UserRecord *h, HomeSetupFlags flags, HomeSetup *setup, PasswordCache *cache, UserRecord **ret_header_home);
-int home_refresh(UserRecord *h, HomeSetup *setup, UserRecord *header_home, PasswordCache *cache, struct statfs *ret_statfs, UserRecord **ret_new_home);
+int home_refresh(UserRecord *h, HomeSetupFlags flags, HomeSetup *setup, UserRecord *header_home, PasswordCache *cache, struct statfs *ret_statfs, UserRecord **ret_new_home);
-int home_maybe_shift_uid(UserRecord *h, HomeSetup *setup);
+int home_maybe_shift_uid(UserRecord *h, HomeSetupFlags flags, HomeSetup *setup);
int home_populate(UserRecord *h, int dir_fd);
int home_load_embedded_identity(UserRecord *h, int root_fd, UserRecord *header_home, UserReconcileMode mode, PasswordCache *cache, UserRecord **ret_embedded_home, UserRecord **ret_new_home);