]>
Commit | Line | Data |
---|---|---|
c0b04b0d PG |
1 | --- ./src/groupadd.c.org Sat Oct 6 23:48:13 2001 |
2 | +++ ./src/groupadd.c Sat Oct 6 23:55:55 2001 | |
3 | @@ -78,6 +78,8 @@ | |
c349585e AF |
4 | static int oflg = 0; /* permit non-unique group ID to be specified with -g */ |
5 | static int gflg = 0; /* ID value for the new group */ | |
6 | static int fflg = 0; /* if group already exists, do nothing and exit(0) */ | |
7 | +static int rflg = 0; /* for adding system accounts */ | |
c0b04b0d | 8 | +#define MIN_GID 10 |
c349585e AF |
9 | |
10 | #ifdef NDBM | |
11 | extern int gr_dbm_mode; | |
c0b04b0d | 12 | @@ -108,7 +110,7 @@ |
c349585e AF |
13 | static void |
14 | usage(void) | |
15 | { | |
16 | - fprintf(stderr, _("usage: groupadd [-g gid [-o]] group\n")); | |
17 | + fprintf(stderr, _("usage: groupadd [-g gid [-o]] [-r] [-f] group\n")); | |
18 | exit(E_USAGE); | |
19 | } | |
20 | ||
c0b04b0d | 21 | @@ -233,8 +235,13 @@ |
c349585e AF |
22 | const struct group *grp; |
23 | gid_t gid_min, gid_max; | |
24 | ||
25 | - gid_min = getdef_num("GID_MIN", 100); | |
26 | + if (!rflg) { | |
27 | + gid_min = getdef_num("GID_MIN", 500); | |
28 | gid_max = getdef_num("GID_MAX", 60000); | |
c349585e AF |
29 | + } else { |
30 | + gid_min = MIN_GID; | |
31 | + gid_max = getdef_num("GID_MIN", 499); | |
32 | + } | |
c0b04b0d | 33 | |
c349585e AF |
34 | /* |
35 | * Start with some GID value if the user didn't provide us with | |
c0b04b0d | 36 | @@ -344,7 +351,7 @@ |
c349585e AF |
37 | char *cp; |
38 | int arg; | |
39 | ||
40 | - while ((arg = getopt(argc, argv, "og:O:f")) != EOF) { | |
41 | + while ((arg = getopt(argc, argv, "og:O:fr")) != EOF) { | |
42 | switch (arg) { | |
43 | case 'g': | |
44 | gflg++; | |
c0b04b0d | 45 | @@ -389,6 +396,12 @@ |
c349585e AF |
46 | */ |
47 | fflg++; | |
c0b04b0d PG |
48 | break; |
49 | + case 'r': | |
c349585e | 50 | + /* |
c0b04b0d PG |
51 | + * create system group |
52 | + */ | |
c349585e | 53 | + rflg++; |
c0b04b0d | 54 | + break; |
c349585e AF |
55 | default: |
56 | usage(); | |
c0b04b0d PG |
57 | } |
58 | --- ./src/useradd.c.org Sat Oct 6 23:56:11 2001 | |
59 | +++ ./src/useradd.c Sun Oct 7 00:25:24 2001 | |
60 | @@ -78,10 +78,10 @@ | |
04312041 SZ |
61 | /* |
62 | * These defaults are used if there is no defaults file. | |
c349585e | 63 | */ |
04312041 SZ |
64 | -static gid_t def_group = 100; |
65 | +static gid_t def_group = 1000; | |
c349585e AF |
66 | static const char *def_gname = "other"; |
67 | -static const char *def_home = "/home"; | |
68 | -static const char *def_shell = ""; | |
69 | +static const char *def_home = "/home/users"; | |
70 | +static const char *def_shell = "/dev/null"; | |
71 | static const char *def_template = SKEL_DIR; | |
72 | #ifdef SHADOWPWD | |
73 | static long def_inactive = -1; | |
c0b04b0d | 74 | @@ -93,7 +93,7 @@ |
c349585e AF |
75 | #define VALID(s) (strcspn (s, ":\n") == strlen (s)) |
76 | ||
77 | static const char *user_name = ""; | |
78 | -static const char *user_pass = "!"; | |
79 | +static const char *user_pass = "!!"; | |
80 | static uid_t user_id; | |
81 | static gid_t user_gid; | |
82 | static const char *user_comment = ""; | |
c0b04b0d | 83 | @@ -122,6 +122,7 @@ |
c349585e AF |
84 | sflg = 0, /* shell program for new account */ |
85 | cflg = 0, /* comment (GECOS) field for new account */ | |
86 | mflg = 0, /* create user's home directory if it doesn't exist */ | |
c349585e | 87 | + Mflg = 0, /* don't crate user's home directory */ |
c0b04b0d | 88 | kflg = 0, /* specify a directory to fill new user directory */ |
c349585e AF |
89 | fflg = 0, /* days until account with expired password is locked */ |
90 | eflg = 0, /* days since 1970-01-01 when account is locked */ | |
c0b04b0d | 91 | @@ -179,6 +180,7 @@ |
c349585e AF |
92 | * exit status values |
93 | */ | |
94 | #define E_SUCCESS 0 /* success */ | |
c0b04b0d | 95 | +#define E_LOCKING 1 /* locking error */ |
c349585e AF |
96 | #define E_PW_UPDATE 1 /* can't update password file */ |
97 | #define E_USAGE 2 /* bad command syntax */ | |
98 | #define E_BAD_ARG 3 /* invalid argument to option */ | |
c0b04b0d | 99 | @@ -728,7 +730,7 @@ |
c349585e AF |
100 | #ifdef AUTH_METHODS |
101 | fprintf(stderr, _("[-A program] ")); | |
102 | #endif | |
103 | - fprintf(stderr, _("[-p passwd] name\n")); | |
104 | + fprintf(stderr, _("[-p passwd] [-n] [-r] name\n")); | |
105 | ||
106 | fprintf(stderr, _(" %s\t-D [-g group] [-b base] [-s shell]\n"), | |
107 | Prog); | |
c0b04b0d | 108 | @@ -986,7 +988,7 @@ |
c349585e AF |
109 | const struct passwd *pwd; |
110 | uid_t uid_min, uid_max; | |
c0b04b0d | 111 | |
c349585e | 112 | - uid_min = getdef_num("UID_MIN", 100); |
c349585e AF |
113 | + uid_min = getdef_num("UID_MIN", 500); |
114 | uid_max = getdef_num("UID_MAX", 60000); | |
c0b04b0d | 115 | |
c349585e | 116 | /* |
c0b04b0d | 117 | @@ -1143,9 +1145,9 @@ |
c349585e AF |
118 | char *cp; |
119 | ||
120 | #ifdef SHADOWPWD | |
121 | -#define FLAGS "A:Du:og:G:d:s:c:mk:p:f:e:b:O:M" | |
6f7d3c67 | 122 | +#define FLAGS "A:Du:og:G:d:s:c:mk:p:f:e:b:O:Mnr" |
c349585e AF |
123 | #else |
124 | -#define FLAGS "A:Du:og:G:d:s:c:mk:p:b:O:M" | |
6f7d3c67 | 125 | +#define FLAGS "A:Du:og:G:d:s:c:mk:p:b:O:Mnr" |
c349585e AF |
126 | #endif |
127 | while ((arg = getopt(argc, argv, FLAGS)) != EOF) { | |
128 | #undef FLAGS | |
c0b04b0d | 129 | @@ -1278,6 +1280,9 @@ |
c349585e AF |
130 | case 'o': |
131 | oflg++; | |
132 | break; | |
133 | + case 'n': | |
134 | + nflg++; | |
c349585e AF |
135 | + break; |
136 | case 'O': | |
137 | /* | |
138 | * override login.defs defaults (-O name=value) | |
c0b04b0d | 139 | @@ -1329,7 +1334,9 @@ |
c349585e AF |
140 | * Certain options are only valid in combination with others. |
141 | * Check it here so that they can be specified in any order. | |
142 | */ | |
143 | - if ((oflg && !uflg) || (kflg && !mflg)) | |
144 | + if (kflg && !mflg) | |
145 | + usage(); | |
146 | + if (mflg && Mflg) | |
147 | usage(); | |
c0b04b0d | 148 | |
c349585e | 149 | /* |