Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Aug 2024 15:34:42 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 280099] adduser not respecting home directory mode
Message-ID:  <bug-280099-227-XnbpVJ83E8@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-280099-227@https.bugs.freebsd.org/bugzilla/>
References:  <bug-280099-227@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D280099

--- 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 =3D=3D '/')
                dir++;

-       if (mkdirat(rootfd, dir, mode) !=3D 0 && errno !=3D EEXIST) {
-               warn("mkdir(%s)", dir);
-               return;
+       if (mkdirat(rootfd, dir, mode) !=3D 0) {
+               if (errno !=3D 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)

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-280099-227-XnbpVJ83E8>