Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109923315
D46443.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D46443.diff
View Options
diff --git a/usr.sbin/adduser/adduser.8 b/usr.sbin/adduser/adduser.8
--- a/usr.sbin/adduser/adduser.8
+++ b/usr.sbin/adduser/adduser.8
@@ -27,7 +27,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd April 11, 2024
+.Dd December 1, 2024
.Dt ADDUSER 8
.Os
.Sh NAME
@@ -246,7 +246,9 @@
script.
.It Fl M Ar mode
Create the home directory with permissions set to
-.Ar mode .
+.Ar mode ,
+modified by the current
+.Xr umask 2 .
.It Fl N
Do not read the default configuration file.
.It Fl q
diff --git a/usr.sbin/pw/cpdir.c b/usr.sbin/pw/cpdir.c
--- a/usr.sbin/pw/cpdir.c
+++ b/usr.sbin/pw/cpdir.c
@@ -49,13 +49,28 @@
if (*dir == '/')
dir++;
- if (mkdirat(rootfd, dir, mode) != 0 && errno != EEXIST) {
- warn("mkdir(%s)", dir);
- return;
+ if (mkdirat(rootfd, dir, mode) != 0) {
+ mode_t pumask;
+
+ if (errno != EEXIST) {
+ warn("mkdir(%s)", dir);
+ return;
+ }
+
+ pumask = umask(0);
+ umask(pumask);
+
+ if (fchmodat(rootfd, dir, mode & ~pumask,
+ AT_SYMLINK_NOFOLLOW) == -1)
+ warn("chmod(%s)", dir);
}
- fchownat(rootfd, dir, uid, gid, AT_SYMLINK_NOFOLLOW);
- if (flags > 0)
- chflagsat(rootfd, dir, flags, AT_SYMLINK_NOFOLLOW);
+
+ if (fchownat(rootfd, dir, uid, gid, AT_SYMLINK_NOFOLLOW) == -1)
+ warn("chown(%s)", dir);
+
+ if (flags > 0 && chflagsat(rootfd, dir, flags,
+ AT_SYMLINK_NOFOLLOW) == -1)
+ warn("chflags(%s)", dir);
if (skelfd == -1)
return;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Feb 12, 7:00 AM (4 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16607599
Default Alt Text
D46443.diff (1 KB)
Attached To
Mode
D46443: pw: set the user's home directory mode if it existed
Attached
Detach File
Event Timeline
Log In to Comment