From nobody@FreeBSD.org  Thu Nov  2 07:48:21 2006
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id ED14A16A40F
	for <freebsd-gnats-submit@FreeBSD.org>; Thu,  2 Nov 2006 07:48:20 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 4E8CD43D8D
	for <freebsd-gnats-submit@FreeBSD.org>; Thu,  2 Nov 2006 07:48:14 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id kA27mETV010972
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 2 Nov 2006 07:48:14 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id kA27mEjq010971;
	Thu, 2 Nov 2006 07:48:14 GMT
	(envelope-from nobody)
Message-Id: <200611020748.kA27mEjq010971@www.freebsd.org>
Date: Thu, 2 Nov 2006 07:48:14 GMT
From: "Dr. Markus Waldeck"<waldeck@gmx.de>
To: freebsd-gnats-submit@FreeBSD.org
Subject: adduser does not support the setting of the mode of the home directory
X-Send-Pr-Version: www-3.0

>Number:         105060
>Category:       bin
>Synopsis:       [patch] adduser(8) does not support the setting of the mode of the home directory
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    mtm
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Nov 02 07:50:21 GMT 2006
>Closed-Date:    Thu Mar 06 14:29:38 UTC 2008
>Last-Modified:  Thu Mar 06 14:29:38 UTC 2008
>Originator:     Dr. Markus Waldeck
>Release:        6.1
>Organization:
>Environment:
FreeBSD fb 6.1-RELEASE FreeBSD 6.1-RELEASE #0: Sun May 7 04:32:43 UTC 2006 root@opus.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386
>Description:
There is not possibility to set the mode of the home directory when a new user is created.
>How-To-Repeat:

>Fix:
This patch requires the patch which is included in PR bin/104248!

diff -ru adduser.orig/adduser.8 adduser/adduser.8
--- adduser.orig/adduser.8	Wed Aug 23 07:46:15 2006
+++ adduser/adduser.8	Wed Nov  1 20:13:27 2006
@@ -35,6 +35,7 @@
 .Sh SYNOPSIS
 .Nm
 .Op Fl CDENShq
+.Op Fl A Ar mode
 .Op Fl G Ar groups
 .Op Fl L Ar login_class
 .Op Fl d Ar partition
@@ -157,6 +158,8 @@
 any values saved in this file.
 .Sh OPTIONS
 .Bl -tag -width indent
+.It Fl A Ar mode
+Set file permission for the home directory.
 .It Fl C
 Create new configuration file and exit.
 This option is mutually exclusive with the
diff -ru adduser.orig/adduser.sh adduser/adduser.sh
--- adduser.orig/adduser.sh	Wed Aug 23 07:46:15 2006
+++ adduser/adduser.sh	Wed Nov  1 20:43:35 2006
@@ -76,6 +76,7 @@
 show_usage() {
 	echo "usage: ${THISCMD} [options]"
 	echo "  options may include:"
+	echo "  -A		file permission for home directory"
 	echo "  -C		save to the configuration file only"
 	echo "  -D		do not attempt to create the home directory"
 	echo "  -E		disable this account after creation"
@@ -195,6 +196,7 @@
 	echo "defaultgroups=$ugroups"	>> ${ADDUSERCONF}
 	echo "passwdtype=$passwdtype" 	>> ${ADDUSERCONF}
 	echo "homeprefix=$homeprefix" 	>> ${ADDUSERCONF}
+	echo "homemode=$homemode" 	>> ${ADDUSERCONF}
 	echo "defaultshell=$ushell"	>> ${ADDUSERCONF}
 	echo "udotdir=$udotdir"		>> ${ADDUSERCONF}
 	echo "msgfile=$msgfile"		>> ${ADDUSERCONF}
@@ -246,10 +248,10 @@
 		if [ "$uhome" = "$NOHOME" ]; then
 			_home='-d "$uhome"'
 		else
-			_home='-m -d "$uhome"'
+			_home='-m -d "$uhome" -A $uhomemode'
 		fi
 	elif [ -n "$Dflag" -a -n "$uhome" ]; then
-		_home='-d "$uhome"'
+		_home='-d "$uhome" -A $uhomemmode'
 	fi
 	case $passwdtype in
 	no)
@@ -442,6 +444,28 @@
 	fi
 }
 
+# get_homemode
+#	Reads the account's home directory file permission. Used both with interactive input
+#	and batch input. In batch mode the value in /etc/adduser.conf if present or 0755 
+#       is used.
+#
+get_homemode() {
+	_input=
+	uhomemode="$homemode"
+
+	if [ -z "$fflag" ]; then
+		echo -n "Home directory file permission [${uhomemode}]: "
+		read _input
+	else
+		_input=${uhomemode}
+	fi
+
+	if [ -n "$_input" ]; then
+		uhomemode="$_input"
+		homemode="$uhomemode"
+	fi
+}
+
 # get_uid
 #	Reads a numeric userid in an interactive or batch session. Automatically
 #	allocates one if it is not specified.
@@ -601,6 +625,7 @@
 		get_class
 		get_shell
 		get_homedir
+		get_homemode
 		get_password
 		get_expire_dates
 
@@ -667,6 +692,7 @@
 	get_class
 	get_shell
 	get_homedir
+	get_homemode
 
 	while : ; do
 		echo -n "Use password-based authentication? [$_usepass]: "
@@ -777,6 +803,7 @@
 	printf "%-10s : %s\n" "Class" "$uclass"
 	printf "%-10s : %s %s\n" "Groups" "${ulogingroup:-$username}" "$ugroups"
 	printf "%-10s : %s\n" "Home" "$uhome"
+	printf "%-10s : %s\n" "Home Mode" "$uhomemode"
 	printf "%-10s : %s\n" "Shell" "$ushell"
 	printf "%-10s : %s\n" "Locked" "$_disable"
 	while : ; do
@@ -821,6 +848,7 @@
 ulogingroup=
 uclass=
 uhome=
+uhomemode=0755
 upass=
 ushell=
 udotdir=/usr/share/skel

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->patched 
State-Changed-By: mtm 
State-Changed-When: Sun Jan 27 10:17:29 UTC 2008 
State-Changed-Why:  
Patched in HEAD, will MFC in one week 


Responsible-Changed-From-To: freebsd-bugs->mtm 
Responsible-Changed-By: mtm 
Responsible-Changed-When: Sun Jan 27 10:17:29 UTC 2008 
Responsible-Changed-Why:  
Patched in HEAD, will MFC in one week 

http://www.freebsd.org/cgi/query-pr.cgi?pr=105060 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/105060: commit references a PR
Date: Sun, 27 Jan 2008 10:15:44 +0000 (UTC)

 mtm         2008-01-27 10:15:36 UTC
 
   FreeBSD src repository
 
   Modified files:
     usr.sbin/adduser     adduser.8 adduser.sh 
   Log:
   Add the -M command-line option, which will set home directory permissions.
   Works both in interactive or batch mode. This is a heavily modified version
   of the patch submitted in the PR.
   
   PR: bin/105060
   MFC after: 1 week
   
   Revision  Changes    Path
   1.61      +4 -0      src/usr.sbin/adduser/adduser.8
   1.32      +40 -1     src/usr.sbin/adduser/adduser.sh
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/105060: commit references a PR
Date: Thu,  6 Mar 2008 14:11:09 +0000 (UTC)

 mtm         2008-03-06 14:10:56 UTC
 
   FreeBSD src repository
 
   Modified files:        (Branch: RELENG_7)
     usr.sbin/adduser     adduser.8 adduser.sh 
   Log:
   MFC: rev. 1.32
           Add the -M command-line option, which will set home directory
           permissions. Works both in interactive or batch mode. This is
           a heavily modified version of the patch submitted in the PR.
   
           PR: bin/105060
   
   Revision  Changes    Path
   1.59.2.2  +5 -1      src/usr.sbin/adduser/adduser.8
   1.30.2.2  +40 -1     src/usr.sbin/adduser/adduser.sh
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/105060: commit references a PR
Date: Thu,  6 Mar 2008 14:13:19 +0000 (UTC)

 mtm         2008-03-06 14:13:11 UTC
 
   FreeBSD src repository
 
   Modified files:        (Branch: RELENG_6)
     usr.sbin/adduser     adduser.8 adduser.sh 
   Log:
   MFC: rev. 1.32
           Add the -M command-line option, which will set home directory
           permissions. Works both in interactive or batch mode. This is
           a heavily modified version of the patch submitted in the PR.
   
           PR: bin/105060
   
   Revision  Changes    Path
   1.55.8.3  +5 -1      src/usr.sbin/adduser/adduser.8
   1.26.2.5  +40 -1     src/usr.sbin/adduser/adduser.sh
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: mtm 
State-Changed-When: Thu Mar 6 14:25:08 UTC 2008 
State-Changed-Why:  
Done. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=105060 
>Unformatted:
