[Bug 280099] adduser not respecting home directory mode
- In reply to: bugzilla-noreply_a_freebsd.org: "[Bug 280099] adduser not respecting home directory mode"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 26 Aug 2024 15:34:42 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=280099 --- Comment #9 from Kyle Evans <kevans@freebsd.org> --- pw(8) probably should have been doing this all along: diff --git a/usr.sbin/pw/cpdir.c b/usr.sbin/pw/cpdir.c index 504933ab88af..856ab95ee781 100644 --- a/usr.sbin/pw/cpdir.c +++ b/usr.sbin/pw/cpdir.c @@ -49,9 +49,13 @@ copymkdir(int rootfd, char const * dir, int skelfd, mode_t mode, uid_t uid, if (*dir == '/') dir++; - if (mkdirat(rootfd, dir, mode) != 0 && errno != EEXIST) { - warn("mkdir(%s)", dir); - return; + if (mkdirat(rootfd, dir, mode) != 0) { + if (errno != EEXIST) { + warn("mkdir(%s)", dir); + return; + } + + (void)fchmodat(rootfd, dir, mode, AT_SYMLINK_NOFOLLOW); } fchownat(rootfd, dir, uid, gid, AT_SYMLINK_NOFOLLOW); if (flags > 0) -- You are receiving this mail because: You are the assignee for the bug.