3 @@ -114,7 +114,7 @@ static int do_grp_update = 0; /* group f
7 - bflg = 0, /* new default root of home directory */
8 + bflg = 0, /* new default root of home directory */
9 cflg = 0, /* comment (GECOS) field for new account */
10 dflg = 0, /* home directory for new account */
11 Dflg = 0, /* set/show new user default values */
12 @@ -253,6 +253,12 @@ static void get_defaults (void)
13 const struct group *grp;
16 + * Pull relevant settings from login.defs first.
18 + if (getdef_bool ("USERGROUPS_ENAB"))
22 * Open the defaults file for reading.
25 @@ -628,6 +634,8 @@ static void usage (void)
26 " -K, --key KEY=VALUE overrides /etc/login.defs defaults\n"
27 " -m, --create-home create home directory for the new user\n"
29 + " -n, --user-group create a new group with the same name as the\n"
31 " -o, --non-unique allow create user with duplicate\n"
33 " -p, --password PASSWORD use encrypted password for the new user\n"
34 @@ -1009,6 +1017,7 @@ static void process_flags (int argc, cha
35 {"skel", required_argument, NULL, 'k'},
36 {"key", required_argument, NULL, 'K'},
37 {"create-home", no_argument, NULL, 'm'},
38 + {"user-group", no_argument, NULL, 'n'},
39 {"non-unique", no_argument, NULL, 'o'},
40 {"password", required_argument, NULL, 'p'},
41 {"shell", required_argument, NULL, 's'},
42 @@ -1016,7 +1025,7 @@ static void process_flags (int argc, cha
46 - getopt_long (argc, argv, "b:c:d:De:f:g:G:k:K:mMop:s:u:",
47 + getopt_long (argc, argv, "b:c:d:De:f:g:G:k:K:mMnop:s:u:",
48 long_options, NULL)) != -1) {
51 @@ -1156,6 +1165,9 @@ static void process_flags (int argc, cha
61 @@ -1203,6 +1215,16 @@ static void process_flags (int argc, cha
65 + * Using --gid and --user-group doesn't make sense.
67 + if (nflg == -1 && gflg)
70 + fprintf (stderr, _("%s: options -g and -n conflict\n"), Prog);
75 * Either -D or username is required. Defaults can be set with -D
76 * for the -b, -e, -f, -g, -s options only.
78 @@ -1725,7 +1747,7 @@ int main (int argc, char **argv)
79 * to that group, use useradd -g username username.
84 if (getgrnam (user_name)) {
87 @@ -1759,7 +1781,7 @@ int main (int argc, char **argv)
89 /* do we have to add a group for that user? This is why we need to
90 * open the group files in the open_files() function --gafton */
91 - if (!(nflg || gflg)) {