The following reply was made to PR bin/150988; it has been noted by GNATS.
From: Dmitry Banshchikov <[email protected]>
To: [email protected], [email protected]
Cc:
Subject: Re: bin/150988: adduser(8) problem of directory mode
Date: Fri, 22 Oct 2010 13:16:57 +0400
Hello,
adduser is shell script, which runs pw utility with gathered arguments.
There is a check for existence of a home directory in pw_user.c, and if
homedir does not exist pw will create it with the permissions of target
user directory (Set by example with -M option to pw). Should pw always
create homedir with permissions 755 to be accessible by all users?
--- pw_user.c 2010-10-22 12:53:19.000000000 +0400
+++ pw_user.c 2010-10-22 12:56:11.000000000 +0400
@@ -186,7 +186,10 @@
if (strchr(cnf->home+1, '/') == NULL) {
strcpy(dbuf, "/usr");
strncat(dbuf, cnf->home, MAXPATHLEN-5);
- if (mkdir(dbuf, cnf->homemode) != -1 || errno
== EEXIST) {
+ /* Home directory should be accessible by all
users,
+ * so by default set permissions to 0755
+ */
+ if (mkdir(dbuf, 0755) != -1 || errno == EEXIST)
{
chown(dbuf, 0, 0);
/*
* Skip first "/" and create symlink:
@@ -202,7 +205,7 @@
while ((p = strchr(++p, '/')) != NULL) {
*p = '\0';
if (stat(dbuf, &st) == -1) {
- if (mkdir(dbuf, cnf->homemode)
== -1)
+ if (mkdir(dbuf, 0755) == -1)
goto direrr;
chown(dbuf, 0, 0);
} else if (!S_ISDIR(st.st_mode))
--
Dmitry Banshchikov
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "[email protected]"