85c26f5
--- shadow-4.0.18.1/man/groupadd.8.redhat	2006-07-30 22:53:48.000000000 +0200
85c26f5
+++ shadow-4.0.18.1/man/groupadd.8	2006-12-06 16:29:01.000000000 +0100
dbff8db
@@ -14,7 +14,7 @@
dbff8db
 groupadd \- create a new group
dbff8db
 .SH "SYNOPSIS"
dbff8db
 .HP 9
dbff8db
-\fBgroupadd\fR [\-g\ \fIGID\fR\ [\-o]] [\-f] [\-K\ \fIKEY\fR=\fIVALUE\fR] \fIgroup\fR
dbff8db
+\fBgroupadd\fR [\-g\ \fIgid\fR\ [\-o]] [\-r] [\-f] [\-K\ \fIKEY\fR=\fIVALUE\fR] \fIgroup\fR
dbff8db
 .SH "DESCRIPTION"
dbff8db
 .PP
dbff8db
 The
dbff8db
@@ -32,10 +32,13 @@
dbff8db
 \fB\-g\fR
dbff8db
 is turned off).
dbff8db
 .TP 3n
dbff8db
+\fB-r\fR
dbff8db
+This flag instructs \fBgroupadd\fR to add a system account.  The first available \fIgid\fR lower than 499 will be automatically selected unless the \fB-g\fR option is also given on the command line. This is an option added by Red Hat.
dbff8db
+.TP 3n
dbff8db
 \fB\-g\fR \fIGID\fR
dbff8db
 The numerical value of the group's ID. This value must be unique, unless the
dbff8db
 \fB\-o\fR
dbff8db
-option is used. The value must be non\-negative. The default is to use the smallest ID value greater than 999 and greater than every other group. Values between 0 and 999 are typically reserved for system accounts.
dbff8db
+option is used. The value must be non\-negative. The default is to use the smallest ID value greater than 500 and greater than every other group. Values between 0 and 499 are typically reserved for system accounts.
dbff8db
 .TP 3n
dbff8db
 \fB\-h\fR, \fB\-\-help\fR
dbff8db
 Display help message and exit.
85c26f5
--- shadow-4.0.18.1/man/useradd.8.redhat	2006-07-30 22:54:26.000000000 +0200
85c26f5
+++ shadow-4.0.18.1/man/useradd.8	2006-12-06 16:29:01.000000000 +0100
dbff8db
@@ -25,7 +25,7 @@
dbff8db
 \fB\-D\fR
dbff8db
 option, the
dbff8db
 \fBuseradd\fR
dbff8db
-command creates a new user account using the values specified on the command line and the default values from the system. Depending on command line options, the useradd command will update system files and may also create the new user's home directory and copy initial files.
dbff8db
+command creates a new user account using the values specified on the command line and the default values from the system. Depending on command line options, the useradd command will update system files and may also create the new user's home directory and copy initial files. The version provided with Red Hat Linux will create a group for each user added to the system by default.
dbff8db
 .SH "OPTIONS"
dbff8db
 .PP
dbff8db
 The options which apply to the
dbff8db
@@ -65,7 +65,7 @@
dbff8db
 The number of days after a password expires until the account is permanently disabled. A value of 0 disables the account as soon as the password has expired, and a value of \-1 disables the feature. The default value is \-1.
dbff8db
 .TP 3n
dbff8db
 \fB\-g\fR, \fB\-\-gid\fR \fIGROUP\fR
dbff8db
-The group name or number of the user's initial login group. The group name must exist. A group number must refer to an already existing group. The default group number is 1 or whatever is specified in
dbff8db
+The group name or number of the user's initial login group. The group name must exist. A group number must refer to an already existing group.
dbff8db
 \fI/etc/default/useradd\fR.
dbff8db
 .TP 3n
dbff8db
 \fB\-G\fR, \fB\-\-groups\fR \fIGROUP1\fR[\fI,GROUP2,...\fR[\fI,GROUPN\fR]]]
dbff8db
@@ -76,6 +76,9 @@
dbff8db
 \fB\-h\fR, \fB\-\-help\fR
dbff8db
 Display help message and exit.
dbff8db
 .TP 3n
dbff8db
+\fB-M\fR
dbff8db
+The user's home directory will not be created, even if the system wide settings from \fI/etc/login.defs\fR is to create home dirs.
dbff8db
+.TP 3n
dbff8db
 \fB\-m\fR, \fB\-\-create\-home\fR
dbff8db
 The user's home directory will be created if it does not exist. The files contained in
dbff8db
 \fISKEL_DIR\fR
dbff8db
@@ -93,6 +96,9 @@
dbff8db
 \fB\-m\fR
dbff8db
 option. The default is to not create the directory and to not copy any files.
dbff8db
 .TP 3n
dbff8db
+\fB-n\fR
dbff8db
+A group having the same name as the user being added to the system will be created by default. This option will turn off this Red Hat Linux specific behavior. When this option is used, users by default will be placed in whatever group is specified in \fI/etc/default/useradd\fR. If no default group is defined, group 1 will be used.
dbff8db
+.TP 3n
dbff8db
 \fB\-K\fR, \fB\-\-key\fR \fIKEY\fR=\fIVALUE\fR
dbff8db
 Overrides /etc/login.defs defaults (UID_MIN, UID_MAX, UMASK, PASS_MAX_DAYS and others).
dbff8db
 
dbff8db
@@ -118,6 +124,9 @@
dbff8db
 The encrypted password, as returned by
dbff8db
 \fBcrypt\fR(3). The default is to disable the account.
dbff8db
 .TP 3n
dbff8db
+\fB-r\fR
dbff8db
+This flag is used to create a system account. That is, a user with a UID lower than the value of UID_MIN defined in \fI/etc/login.defs\fR and whose password does not expire. Note that \fBuseradd\fR will not create a home directory for such an user, regardless of the default setting in \fI/etc/login.defs\fR. You have to specify \fB-m\fR option if you want a home directory for a system account to be created. This is an option added by Red Hat
dbff8db
+.TP 3n
dbff8db
 \fB\-s\fR, \fB\-\-shell\fR \fISHELL\fR
dbff8db
 The name of the user's login shell. The default is to leave this field blank, which causes the system to select the default login shell.
dbff8db
 .TP 3n
dbff8db
@@ -161,6 +170,8 @@
dbff8db
 The system administrator is responsible for placing the default user files in the
dbff8db
 \fI/etc/skel/\fR
dbff8db
 directory.
dbff8db
+.br
dbff8db
+This version of useradd was modified by Red Hat to suit Red Hat user/group conventions.
dbff8db
 .SH "CAVEATS"
dbff8db
 .PP
dbff8db
 You may not add a user to a NIS group. This must be performed on the NIS server.
dbff8db
@@ -181,6 +192,9 @@
dbff8db
 \fI/etc/group\fR
dbff8db
 Group account information.
dbff8db
 .TP 3n
dbff8db
+\fI/etc/gshadow\fR
dbff8db
+Secure group account information.
dbff8db
+.TP 3n
dbff8db
 \fI/etc/default/useradd\fR
dbff8db
 Default values for account creation.
dbff8db
 .TP 3n
85c26f5
--- shadow-4.0.18.1/man/chpasswd.8.redhat	2006-07-30 22:53:40.000000000 +0200
85c26f5
+++ shadow-4.0.18.1/man/chpasswd.8	2006-12-06 16:24:59.000000000 +0100
85c26f5
@@ -24,7 +24,7 @@
85c26f5
 
85c26f5
 \fIuser_name\fR:\fIpassword\fR
85c26f5
 .PP
85c26f5
-By default the supplied password must be in clear\-text. Default encryption algorithm is DES. Also the password age will be updated, if present.
85c26f5
+By default the supplied password must be in clear\-text. Default encryption algorithm is DES, but this setting can be changed in \fI/etc/login.defs\fR. Red Hat uses MD5 to encrypt passwords by default. Also the password age will be updated, if present.
85c26f5
 .PP
85c26f5
 This command is intended to be used in a large system environment where many accounts are created at a single time.
85c26f5
 .SH "OPTIONS"
85c26f5
--- shadow-4.0.18.1/man/newusers.8.redhat	2006-07-30 22:54:08.000000000 +0200
85c26f5
+++ shadow-4.0.18.1/man/newusers.8	2006-12-06 16:24:59.000000000 +0100
85c26f5
@@ -35,6 +35,8 @@
85c26f5
 This field will be checked for existence as a directory and a new directory with the same name will be created if it does not already exist. The ownership of the directory will be set to be that of the user being created or updated.
85c26f5
 .PP
85c26f5
 This command is intended to be used in a large system environment where many accounts are updated at a single time.
85c26f5
+.PP
85c26f5
+Default encryption algorithm is DES, but this setting can be changed in \fI/etc/login.defs\fR. Red Hat uses MD5 to encrypt passwords by default.
85c26f5
 .SH "CAVEATS"
85c26f5
 .PP
85c26f5
 The input file must be protected since it contains unencrypted passwords.
85c26f5
--- shadow-4.0.18.1/src/useradd.c.redhat	2006-07-28 19:42:48.000000000 +0200
85c26f5
+++ shadow-4.0.18.1/src/useradd.c	2006-12-06 16:29:01.000000000 +0100
dbff8db
@@ -81,7 +81,7 @@
dbff8db
 static gid_t def_group = 100;
dbff8db
 static const char *def_gname = "other";
dbff8db
 static const char *def_home = "/home";
dbff8db
-static const char *def_shell = "";
dbff8db
+static const char *def_shell = "/sbin/nologin";
dbff8db
 static const char *def_template = SKEL_DIR;
dbff8db
 static const char *def_create_mail_spool = "no";
dbff8db
 
dbff8db
@@ -93,7 +93,7 @@
dbff8db
 #define	VALID(s)	(strcspn (s, ":\n") == strlen (s))
dbff8db
 
dbff8db
 static const char *user_name = "";
dbff8db
-static const char *user_pass = "!";
dbff8db
+static const char *user_pass = "!!";
dbff8db
 static uid_t user_id;
dbff8db
 static gid_t user_gid;
dbff8db
 static const char *user_comment = "";
dbff8db
@@ -124,8 +124,10 @@
dbff8db
     Gflg = 0,			/* secondary group set for new account */
dbff8db
     kflg = 0,			/* specify a directory to fill new user directory */
dbff8db
     mflg = 0,			/* create user's home directory if it doesn't exist */
dbff8db
-    nflg = 0,			/* create a group having the same name as the user */
dbff8db
+    Mflg = 0,                   /* do NOT create user's home directory no matter what */
dbff8db
+    nflg = 0,                   /* do NOT create a group having the same name as the user */
dbff8db
     oflg = 0,			/* permit non-unique user ID to be specified with -u */
dbff8db
+    rflg = 0,                   /* create a system account */
dbff8db
     sflg = 0,			/* shell program for new account */
dbff8db
     uflg = 0;			/* specify user ID for new account */
dbff8db
 
85c26f5
@@ -633,6 +635,8 @@
dbff8db
 			   "  -K, --key KEY=VALUE		overrides /etc/login.defs defaults\n"
dbff8db
 			   "  -m, --create-home		create home directory for the new user\n"
dbff8db
 			   "				account\n"
dbff8db
+			   "  -M,                       do not create user's home directory(overrides /etc/login.defs)\n"
dbff8db
+			   "  -r,                       create system account\n"
dbff8db
 			   "  -o, --non-unique		allow create user with duplicate\n"
dbff8db
 			   "				(non-unique) UID\n"
dbff8db
 			   "  -p, --password PASSWORD	use encrypted password for the new user\n"
85c26f5
@@ -685,11 +689,20 @@
dbff8db
 	spent->sp_namp = (char *) user_name;
dbff8db
 	spent->sp_pwdp = (char *) user_pass;
dbff8db
 	spent->sp_lstchg = time ((time_t *) 0) / SCALE;
dbff8db
-	spent->sp_min = scale_age (getdef_num ("PASS_MIN_DAYS", -1));
dbff8db
-	spent->sp_max = scale_age (getdef_num ("PASS_MAX_DAYS", -1));
dbff8db
-	spent->sp_warn = scale_age (getdef_num ("PASS_WARN_AGE", -1));
dbff8db
-	spent->sp_inact = scale_age (def_inactive);
dbff8db
-	spent->sp_expire = scale_age (user_expire);
dbff8db
+	if (!rflg) {
dbff8db
+		spent->sp_min = scale_age (getdef_num ("PASS_MIN_DAYS", -1));
dbff8db
+		spent->sp_max = scale_age (getdef_num ("PASS_MAX_DAYS", -1));
dbff8db
+		spent->sp_warn = scale_age (getdef_num ("PASS_WARN_AGE", -1));
dbff8db
+		spent->sp_inact = scale_age (def_inactive);
dbff8db
+		spent->sp_expire = scale_age (user_expire);
dbff8db
+	}
dbff8db
+	else {
dbff8db
+		spent->sp_min = scale_age(-1);
dbff8db
+                spent->sp_max = scale_age(-1);
dbff8db
+                spent->sp_warn = scale_age(-1);
dbff8db
+                spent->sp_inact = scale_age(-1);
dbff8db
+        	spent->sp_expire = scale_age(-1);
dbff8db
+	}
dbff8db
 	spent->sp_flag = -1;
dbff8db
 }
dbff8db
 
85c26f5
@@ -837,8 +850,14 @@
dbff8db
 	const struct passwd *pwd;
dbff8db
 	uid_t uid_min, uid_max;
dbff8db
 
dbff8db
-	uid_min = getdef_unum ("UID_MIN", 1000);
dbff8db
-	uid_max = getdef_unum ("UID_MAX", 60000);
dbff8db
+        if (!rflg) {
dbff8db
+                uid_min = getdef_unum ("UID_MIN", 500);
dbff8db
+                uid_max = getdef_unum ("UID_MAX", 60000);
dbff8db
+        }
dbff8db
+        else {
dbff8db
+                uid_min = 1;
dbff8db
+                uid_max = getdef_unum ("UID_MIN", 500) - 1;
dbff8db
+        }
dbff8db
 
dbff8db
 	/*
dbff8db
 	 * Start with some UID value if the user didn't provide us with
85c26f5
@@ -868,7 +887,7 @@
dbff8db
 #endif
dbff8db
 			exit (E_NAME_IN_USE);
dbff8db
 		}
dbff8db
-		if (uflg && user_id == pwd->pw_uid) {
dbff8db
+		if (!oflg && uflg && user_id == pwd->pw_uid) {
dbff8db
 			fprintf (stderr, _("%s: UID %u is not unique\n"),
dbff8db
 				 Prog, (unsigned int) user_id);
dbff8db
 #ifdef WITH_AUDIT
85c26f5
@@ -923,8 +942,13 @@
dbff8db
 	const struct group *grp;
dbff8db
 	gid_t gid_min, gid_max;
dbff8db
 
dbff8db
-	gid_min = getdef_num ("GID_MIN", 500);
dbff8db
-	gid_max = getdef_num ("GID_MAX", 60000);
dbff8db
+        if (!rflg) {
dbff8db
+                gid_min = getdef_unum ("GID_MIN", 500);
dbff8db
+                gid_max = getdef_unum ("GID_MAX", 60000);
dbff8db
+        } else {
dbff8db
+                gid_min = 1;
dbff8db
+                gid_max = getdef_unum ("GID_MIN", 500) - 1;
dbff8db
+        }
dbff8db
 
dbff8db
 	/*
dbff8db
 	 * Start with some GID value if the user didn't provide us with
85c26f5
@@ -1022,7 +1046,7 @@
dbff8db
 			{NULL, 0, NULL, '\0'}
dbff8db
 		};
dbff8db
 		while ((c =
dbff8db
-			getopt_long (argc, argv, "b:c:d:De:f:g:G:k:K:mMop:s:u:",
dbff8db
+			getopt_long (argc, argv, "b:c:d:De:f:g:G:k:K:mMnrop:s:u:",
dbff8db
 				     long_options, NULL)) != -1) {
dbff8db
 			switch (c) {
dbff8db
 			case 'b':
85c26f5
@@ -1194,6 +1218,15 @@
dbff8db
 				user_id = get_uid (optarg);
dbff8db
 				uflg++;
dbff8db
 				break;
dbff8db
+                        case 'n':
dbff8db
+                                nflg++;
dbff8db
+                                break;
dbff8db
+                        case 'r':
dbff8db
+                                rflg++;
dbff8db
+                                break;
dbff8db
+                        case 'M':
dbff8db
+                                Mflg++;
dbff8db
+                                break;
dbff8db
 			default:
dbff8db
 				usage ();
dbff8db
 			}
85c26f5
@@ -1201,6 +1234,9 @@
dbff8db
 		}
dbff8db
 	}
dbff8db
 
dbff8db
+        if (mflg && Mflg) /* the admin is not decided .. create or not ? */
dbff8db
+               usage();
dbff8db
+
dbff8db
 	/*
dbff8db
 	 * Certain options are only valid in combination with others.
dbff8db
 	 * Check it here so that they can be specified in any order.
85c26f5
@@ -1706,6 +1742,14 @@
dbff8db
 	}
dbff8db
 #endif				/* USE_PAM */
dbff8db
 
dbff8db
+        if (!rflg) /* for system accounts defaults are ignored and we
dbff8db
+                    * do not create a home dir -- gafton */
dbff8db
+        	if (getdef_bool("CREATE_HOME"))
dbff8db
+               		mflg = 1;
dbff8db
+
dbff8db
+        if (Mflg) /* absolutely sure that we do not create home dirs */
dbff8db
+        	mflg = 0;
dbff8db
+
dbff8db
 	/*
dbff8db
 	 * See if we are messing with the defaults file, or creating
dbff8db
 	 * a new user.
85c26f5
@@ -1736,7 +1780,7 @@
dbff8db
 	 * to that group, use useradd -g username username.
dbff8db
 	 * --bero
dbff8db
 	 */
dbff8db
-	if (!gflg) {
dbff8db
+	if ( !(nflg || gflg) ) {
dbff8db
 		if (getgrnam (user_name)) {
dbff8db
 			fprintf (stderr,
dbff8db
 				 _
85c26f5
@@ -1787,25 +1831,18 @@
dbff8db
 				 ("%s: warning: the home directory already exists.\n"
dbff8db
 				  "Not copying any file from skel directory into it.\n"),
dbff8db
 				 Prog);
dbff8db
-
dbff8db
-	} else if (getdef_str ("CREATE_HOME")) {
dbff8db
-		/*
dbff8db
-		 * RedHat added the CREATE_HOME option in login.defs in their
dbff8db
-		 * version of shadow-utils (which makes -m the default, with
dbff8db
-		 * new -M option to turn it off). Unfortunately, this
dbff8db
-		 * changes the way useradd works (it can be run by scripts
dbff8db
-		 * expecting some standard behaviour), compared to other
dbff8db
-		 * Unices and other Linux distributions, and also adds a lot
dbff8db
-		 * of confusion :-(.
dbff8db
-		 * So we now recognize CREATE_HOME and give a warning here
dbff8db
-		 * (better than "configuration error ... notify administrator"
dbff8db
-		 * errors in every program that reads /etc/login.defs). -MM
dbff8db
-		 */
dbff8db
-		fprintf (stderr,
dbff8db
-			 _
dbff8db
-			 ("%s: warning: CREATE_HOME not supported, please use -m instead.\n"),
dbff8db
-			 Prog);
dbff8db
 	}
dbff8db
+        /* Warning removed to protect the innocent. */
dbff8db
+        /*
dbff8db
+         * The whole idea about breaking some stupid scripts by creating a new
dbff8db
+         * variable is crap - I could care less about the scripts. Historically
dbff8db
+         * adduser type programs have always created the home directories and
dbff8db
+         * I don't like the idea of providing a script when we can fix the
dbff8db
+         * binary itself. And if the scripts are using the right options to the
dbff8db
+         * useradd then they will not break. If not, they depend on unspecified
dbff8db
+         * behavior and they will break, but they were broken anyway to begin
dbff8db
+         * with --gafton
dbff8db
+         */
dbff8db
 
dbff8db
 	create_mail ();
dbff8db
 
85c26f5
--- shadow-4.0.18.1/src/groupadd.c.redhat	2006-07-28 19:38:52.000000000 +0200
85c26f5
+++ shadow-4.0.18.1/src/groupadd.c	2006-12-06 16:29:01.000000000 +0100
dbff8db
@@ -74,6 +74,7 @@
dbff8db
 static int oflg = 0;		/* permit non-unique group ID to be specified with -g */
dbff8db
 static int gflg = 0;		/* ID value for the new group */
dbff8db
 static int fflg = 0;		/* if group already exists, do nothing and exit(0) */
dbff8db
+static int rflg = 0;            /* for adding system accounts (Red Hat) */
dbff8db
 
dbff8db
 /* local function prototypes */
dbff8db
 static void usage (void);
85c26f5
@@ -100,6 +101,7 @@
dbff8db
 			   "Options:\n"
dbff8db
 			   "  -f, --force			force exit with success status if the specified\n"
dbff8db
 			   "				group already exists\n"
dbff8db
+			   "  -r,                       create system account\n"
dbff8db
 			   "  -g, --gid GID			use GID for the new group\n"
dbff8db
 			   "  -h, --help			display this help message and exit\n"
dbff8db
 			   "  -K, --key KEY=VALUE		overrides /etc/login.defs defaults\n"
85c26f5
@@ -198,8 +200,13 @@
dbff8db
 	const struct group *grp;
dbff8db
 	gid_t gid_min, gid_max;
dbff8db
 
dbff8db
-	gid_min = getdef_unum ("GID_MIN", 1000);
dbff8db
-	gid_max = getdef_unum ("GID_MAX", 60000);
dbff8db
+	if (!rflg) {
dbff8db
+		gid_min = getdef_unum ("GID_MIN", 500);
dbff8db
+                gid_max = getdef_unum ("GID_MAX", 60000);
dbff8db
+        } else {
dbff8db
+                gid_min = 1;
dbff8db
+                gid_max = getdef_unum ("GID_MIN", 500) - 1;
dbff8db
+        }
dbff8db
 
dbff8db
 	/*
dbff8db
 	 * Start with some GID value if the user didn't provide us with
85c26f5
@@ -430,7 +437,7 @@
dbff8db
 		};
dbff8db
 
dbff8db
 		while ((c =
dbff8db
-			getopt_long (argc, argv, "fg:hK:o", long_options,
dbff8db
+			getopt_long (argc, argv, "frg:hK:o", long_options,
dbff8db
 				     &option_index)) != -1) {
dbff8db
 			switch (c) {
dbff8db
 			case 'f':
85c26f5
@@ -443,6 +450,12 @@
dbff8db
 				 */
dbff8db
 				fflg++;
dbff8db
 				break;
dbff8db
+	                case 'r':
dbff8db
+	                        /*
dbff8db
+	                         * create a system group
dbff8db
+	                         */
dbff8db
+	                        rflg++;
dbff8db
+	                        break;
dbff8db
 			case 'g':
dbff8db
 				gflg++;
85c26f5
 				group_id = get_gid (optarg);