Skip to content

Commit 05e64ea

Browse files
committed
home: fix ownership of files copied from skelton directory
Fixes #32808.
1 parent e2b9f27 commit 05e64ea

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/home/homework.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,12 +1059,13 @@ static int home_deactivate(UserRecord *h, bool force) {
10591059
return 0;
10601060
}
10611061

1062-
static int copy_skel(int root_fd, const char *skel) {
1062+
static int copy_skel(UserRecord *h, int root_fd, const char *skel) {
10631063
int r;
10641064

1065+
assert(h);
10651066
assert(root_fd >= 0);
10661067

1067-
r = copy_tree_at(AT_FDCWD, skel, root_fd, ".", UID_INVALID, GID_INVALID, COPY_MERGE|COPY_REPLACE, NULL, NULL);
1068+
r = copy_tree_at(AT_FDCWD, skel, root_fd, ".", h->uid, h->gid, COPY_MERGE|COPY_REPLACE, NULL, NULL);
10681069
if (r == -ENOENT) {
10691070
log_info("Skeleton directory %s missing, ignoring.", skel);
10701071
return 0;
@@ -1092,7 +1093,7 @@ int home_populate(UserRecord *h, int dir_fd) {
10921093
assert(h);
10931094
assert(dir_fd >= 0);
10941095

1095-
r = copy_skel(dir_fd, user_record_skeleton_directory(h));
1096+
r = copy_skel(h, dir_fd, user_record_skeleton_directory(h));
10961097
if (r < 0)
10971098
return r;
10981099

0 commit comments

Comments
 (0)