bin/116487: teach adduser(8) to respect -G flag in the batch mode

Eygene Ryabinkin rea-fbsd at codelabs.ru
Thu Sep 20 14:10:19 PDT 2007


>Number:         116487
>Category:       bin
>Synopsis:       teach adduser(8) to respect -G flag in the batch mode
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Sep 20 21:10:01 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     Eygene Ryabinkin
>Release:        FreeBSD 7.0-CURRENT i386
>Organization:
Code Labs
>Environment:

System: FreeBSD XXX 7.0-CURRENT FreeBSD 7.0-CURRENT #10: Wed Sep 12 16:16:49 MSD 2007 root at XXX:/usr/src/sys/i386/compile/XXX i386

>Description:

Current adduser(8) does not honor the value of '-G' flag if it is
working in the batch mode.  This is not good, because one can use
batch mode to add a number of users and will want them to be in the
same secondary group(s).

>How-To-Repeat:

Invoke 'adduser -f file-with-account-data -G nogroup' and see that
users are added to the passwd, but not to the 'nogroup' group.

>Fix:

The following patch will cure the situation.  I had also clarified
the '-G' flag syntax in the man page.

A side note: may be it will be better to use comma in the '-G'
option value instead of space -- it is just more convinient to type.
But this can break POLA and I am not making such change now, so
this is just an idea.

--- adduser.patch begins here ---
diff -urN orig/adduser.8 new/adduser.8
--- orig/adduser.8	2007-09-20 22:37:29.000000000 +0400
+++ new/adduser.8	2007-09-20 22:43:27.000000000 +0400
@@ -212,7 +212,7 @@
 .Ar login_group
 the default.
 .It Fl G Ar groups
-Additional groups.
+Space-separated list of additional groups.
 This option allows the user to specify additional groups to add users to.
 The user is a member of these groups in addition to their login group.
 .It Fl h
diff -urN orig/adduser.sh new/adduser.sh
--- orig/adduser.sh	2007-09-20 22:37:29.000000000 +0400
+++ new/adduser.sh	2007-09-20 22:42:57.000000000 +0400
@@ -598,6 +598,7 @@
 			get_gecos
 			get_uid
 			get_logingroup
+			ugroups=`echo "$defaultgroups" | tr ' ' ,`
 			get_class
 			get_shell
 			get_homedir
--- adduser.patch ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list