2 ===================================================================
3 RCS file: /cvsroot/shadow/src/useradd.c,v
4 retrieving revision 1.96
5 diff -u -p -r1.96 useradd.c
6 --- src/useradd.c 30 May 2006 18:28:45 -0000 1.96
7 +++ src/useradd.c 10 Jun 2006 22:13:32 -0000
8 @@ -114,7 +114,7 @@ static int do_grp_update = 0; /* group f
12 - bflg = 0, /* new default root of home directory */
13 + bflg = 0, /* new default root of home directory */
14 cflg = 0, /* comment (GECOS) field for new account */
15 dflg = 0, /* home directory for new account */
16 Dflg = 0, /* set/show new user default values */
17 @@ -253,6 +253,12 @@ static void get_defaults (void)
18 const struct group *grp;
21 + * Pull relevant settings from login.defs first.
23 + if (getdef_bool ("USERGROUPS_ENAB"))
27 * Open the defaults file for reading.
30 @@ -628,6 +634,8 @@ static void usage (void)
31 " -K, --key KEY=VALUE overrides /etc/login.defs defaults\n"
32 " -m, --create-home create home directory for the new user\n"
34 + " -n, --user-group create a new group with the same name as the\n"
36 " -o, --non-unique allow create user with duplicate\n"
38 " -p, --password PASSWORD use encrypted password for the new user\n"
39 @@ -1009,6 +1017,7 @@ static void process_flags (int argc, cha
40 {"skel", required_argument, NULL, 'k'},
41 {"key", required_argument, NULL, 'K'},
42 {"create-home", no_argument, NULL, 'm'},
43 + {"user-group", no_argument, NULL, 'n'},
44 {"non-unique", no_argument, NULL, 'o'},
45 {"password", required_argument, NULL, 'p'},
46 {"shell", required_argument, NULL, 's'},
47 @@ -1016,7 +1025,7 @@ static void process_flags (int argc, cha
51 - getopt_long (argc, argv, "b:c:d:De:f:g:G:k:K:mMop:s:u:",
52 + getopt_long (argc, argv, "b:c:d:De:f:g:G:k:K:mMnop:s:u:",
53 long_options, NULL)) != -1) {
56 @@ -1156,6 +1165,9 @@ static void process_flags (int argc, cha
66 @@ -1203,6 +1215,16 @@ static void process_flags (int argc, cha
70 + * Using --gid and --user-group doesn't make sense.
72 + if (nflg == -1 && gflg)
75 + fprintf (stderr, _("%s: options -g and -n conflict\n"), Prog);
80 * Either -D or username is required. Defaults can be set with -D
81 * for the -b, -e, -f, -g, -s options only.
83 @@ -1725,7 +1747,7 @@ int main (int argc, char **argv)
84 * to that group, use useradd -g username username.
89 if (getgrnam (user_name)) {
92 @@ -1759,7 +1781,7 @@ int main (int argc, char **argv)
94 /* do we have to add a group for that user? This is why we need to
95 * open the group files in the open_files() function --gafton */
96 - if (!(nflg || gflg)) {
101 Index: man/useradd.8.xml
102 ===================================================================
103 RCS file: /cvsroot/shadow/man/useradd.8.xml,v
104 retrieving revision 1.34
105 diff -u -p -r1.34 useradd.8.xml
106 --- man/useradd.8.xml 20 May 2006 12:11:38 -0000 1.34
107 +++ man/useradd.8.xml 10 Jun 2006 22:17:13 -0000
112 + <option>-n</option>, <option>--user-group</option>
116 + Create a new group with the same name as the new user.
119 + See the <replaceable>USERGROUPS_ENAB</replaceable> login.defs option for more details.
125 <option>-o</option>, <option>--non-unique</option>