--- ./src/groupadd.c.org Sat Oct 6 23:48:13 2001 +++ ./src/groupadd.c Sat Oct 6 23:55:55 2001 @@ -78,6 +78,8 @@ static int oflg = 0; /* permit non-unique group ID to be specified with -g */ static int gflg = 0; /* ID value for the new group */ static int fflg = 0; /* if group already exists, do nothing and exit(0) */ +static int rflg = 0; /* for adding system accounts */ +#define MIN_GID 10 #ifdef NDBM extern int gr_dbm_mode; @@ -108,7 +110,7 @@ static void usage(void) { - fprintf(stderr, _("usage: groupadd [-g gid [-o]] group\n")); + fprintf(stderr, _("usage: groupadd [-g gid [-o]] [-r] [-f] group\n")); exit(E_USAGE); } @@ -233,8 +235,13 @@ const struct group *grp; gid_t gid_min, gid_max; - gid_min = getdef_num("GID_MIN", 100); + if (!rflg) { + gid_min = getdef_num("GID_MIN", 500); gid_max = getdef_num("GID_MAX", 60000); + } else { + gid_min = MIN_GID; + gid_max = getdef_num("GID_MIN", 499); + } /* * Start with some GID value if the user didn't provide us with @@ -344,7 +351,7 @@ char *cp; int arg; - while ((arg = getopt(argc, argv, "og:O:f")) != EOF) { + while ((arg = getopt(argc, argv, "og:O:fr")) != EOF) { switch (arg) { case 'g': gflg++; @@ -389,6 +396,12 @@ */ fflg++; break; + case 'r': + /* + * create system group + */ + rflg++; + break; default: usage(); } --- ./src/useradd.c.org Sat Oct 6 23:56:11 2001 +++ ./src/useradd.c Sun Oct 7 00:25:24 2001 @@ -78,10 +78,10 @@ /* * These defaults are used if there is no defaults file. */ -static gid_t def_group = 100; +static gid_t def_group = 1000; static const char *def_gname = "other"; -static const char *def_home = "/home"; -static const char *def_shell = ""; +static const char *def_home = "/home/users"; +static const char *def_shell = "/dev/null"; static const char *def_template = SKEL_DIR; #ifdef SHADOWPWD static long def_inactive = -1; @@ -93,7 +93,7 @@ #define VALID(s) (strcspn (s, ":\n") == strlen (s)) static const char *user_name = ""; -static const char *user_pass = "!"; +static const char *user_pass = "!!"; static uid_t user_id; static gid_t user_gid; static const char *user_comment = ""; @@ -122,6 +122,7 @@ sflg = 0, /* shell program for new account */ cflg = 0, /* comment (GECOS) field for new account */ mflg = 0, /* create user's home directory if it doesn't exist */ + Mflg = 0, /* don't crate user's home directory */ kflg = 0, /* specify a directory to fill new user directory */ fflg = 0, /* days until account with expired password is locked */ eflg = 0, /* days since 1970-01-01 when account is locked */ @@ -179,6 +180,7 @@ * exit status values */ #define E_SUCCESS 0 /* success */ +#define E_LOCKING 1 /* locking error */ #define E_PW_UPDATE 1 /* can't update password file */ #define E_USAGE 2 /* bad command syntax */ #define E_BAD_ARG 3 /* invalid argument to option */ @@ -728,7 +730,7 @@ #ifdef AUTH_METHODS fprintf(stderr, _("[-A program] ")); #endif - fprintf(stderr, _("[-p passwd] name\n")); + fprintf(stderr, _("[-p passwd] [-n] [-r] name\n")); fprintf(stderr, _(" %s\t-D [-g group] [-b base] [-s shell]\n"), Prog); @@ -986,7 +988,7 @@ const struct passwd *pwd; uid_t uid_min, uid_max; - uid_min = getdef_num("UID_MIN", 100); + uid_min = getdef_num("UID_MIN", 500); uid_max = getdef_num("UID_MAX", 60000); /* @@ -1143,9 +1145,9 @@ char *cp; #ifdef SHADOWPWD -#define FLAGS "A:Du:og:G:d:s:c:mk:p:f:e:b:O:M" +#define FLAGS "A:Du:og:G:d:s:c:mk:p:f:e:b:O:Mnr" #else -#define FLAGS "A:Du:og:G:d:s:c:mk:p:b:O:M" +#define FLAGS "A:Du:og:G:d:s:c:mk:p:b:O:Mnr" #endif while ((arg = getopt(argc, argv, FLAGS)) != EOF) { #undef FLAGS @@ -1278,6 +1280,9 @@ case 'o': oflg++; break; + case 'n': + nflg++; + break; case 'O': /* * override login.defs defaults (-O name=value) @@ -1329,7 +1334,9 @@ * Certain options are only valid in combination with others. * Check it here so that they can be specified in any order. */ - if ((oflg && !uflg) || (kflg && !mflg)) + if (kflg && !mflg) + usage(); + if (mflg && Mflg) usage(); /*