summaryrefslogtreecommitdiffstats
path: root/src/home/homework.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2021-11-24 18:34:02 +0100
committerLennart Poettering <lennart@poettering.net>2021-11-24 18:41:54 +0100
commita8be09840365e46ea17160aaea1925d34a8432bc (patch)
tree4d887f16d7c9cc84b1df23477b906c7339d519df /src/home/homework.c
parenthomework: don't try to shift uidmap for already activated home areas (diff)
downloadsystemd-a8be09840365e46ea17160aaea1925d34a8432bc.tar.xz
systemd-a8be09840365e46ea17160aaea1925d34a8432bc.zip
homework: also apply uid shifting when changing passwords/resizing/updating home areas
This adds uidmap shifting also when resizing/updating/changing passwords. Prviously I thought we didn't have to, because the user is not going to access the uidmap if we only quickly activate the home area. But this thinking is wrong, because the three operations will result in an update ~/.identity fie to be written, and we should do that with uidmap applied, so that its ownership maps down to nobody below as intended. Fixes: #21441
Diffstat (limited to 'src/home/homework.c')
-rw-r--r--src/home/homework.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/home/homework.c b/src/home/homework.c
index 864171faed..d2a24d3210 100644
--- a/src/home/homework.c
+++ b/src/home/homework.c
@@ -1609,6 +1609,10 @@ static int home_update(UserRecord *h, UserRecord **ret) {
if (r < 0)
return r;
+ r = home_maybe_shift_uid(h, flags, &setup);
+ if (r < 0)
+ return r;
+
r = home_store_header_identity_luks(new_home, &setup, header_home);
if (r < 0)
return r;
@@ -1701,6 +1705,10 @@ static int home_passwd(UserRecord *h, UserRecord **ret_home) {
if (r < 0)
return r;
+ r = home_maybe_shift_uid(h, flags, &setup);
+ if (r < 0)
+ return r;
+
switch (user_record_storage(h)) {
case USER_LUKS: