Goal: Add missing documentation of options in useradd, groupadd and
      newusers
      Implement the -r, --system option of newusers (already documented in
      --help, implemented in code, but missing getopt handling)

Status wrt upstream: Already applied.

Index: shadow-4.1.1/man/useradd.8.xml
===================================================================
--- shadow-4.1.1.orig/man/useradd.8.xml	2008-06-12 23:29:12.210795802 +0200
+++ shadow-4.1.1/man/useradd.8.xml	2008-06-12 23:29:12.258795502 +0200
@@ -189,23 +189,25 @@
       </varlistentry>
       <varlistentry>
 	<term>
-	  <option>-m</option>, <option>--create-home</option>
+	  <option>-k</option>, <option>--skel</option>
+	  <replaceable>SKEL_DIR</replaceable>
 	</term>
 	<listitem>
 	  <para>
-	    The user's home directory will be created if it does not exist. 
-	    The files contained in <replaceable>SKEL_DIR</replaceable> will
-	    be copied to the home directory if the <option>-k</option>
-	    option is used, otherwise the files contained in
-	    <filename>/etc/skel</filename> will be used instead. Any
-	    directories contained in <replaceable>SKEL_DIR</replaceable> or
-	    <filename>/etc/skel</filename> will be created in the user's
-	    home directory as well. The <option>-k</option> option is only
-	    valid in conjunction with the <option>-m</option> option. The
-	    default is to not create the directory and to not copy any
-	    files.
-	    This option may not function correctly if the username has a / in it.
+	    The skeleton directory, which contains files and directories
+	    to be copied in the user's home directory, when the home
+	    directory is created by <command>useradd</command>.
+	  </para>
+	  <para>
+	    This option is only valid if the <option>-m</option> (or
+	    <option>--create-home</option>) option is specified.
 	  </para>
+	  <para>
+	    If this option is not set, the skeleton directory is defined
+	    in <filename>/etc/default/useradd</filename> or, by default,
+	    <filename>/etc/skel</filename>.
+	  </para>
+	  <para>This option may not function correctly if the username has a / in it.</para>
 	</listitem>
       </varlistentry>
       <varlistentry>
@@ -255,6 +257,22 @@
       </varlistentry>
       <varlistentry>
 	<term>
+	  <option>-m</option>, <option>--create-home</option>
+	</term>
+	<listitem>
+	  <para>
+	    Create the user's home directory if it does not exist.
+	    The files and directories contained in the skeleton directory
+	    (which can be defined with the <option>-k</option> option)
+	    will be copied to the home directory.
+	  </para>
+	  <para>
+	    By default, no home directories are created.
+	  </para>
+	</listitem>
+      </varlistentry>
+      <varlistentry>
+	<term>
 	  <option>-N</option>, <option>--no-user-group</option>
 	</term>
 	<listitem>
@@ -295,6 +313,25 @@
       </varlistentry>
       <varlistentry>
 	<term>
+	  <option>-r</option>, <option>--system</option>
+	</term>
+	<listitem>
+	  <para>
+	    Create a system account.
+	  </para>
+	  <para>
+	    System users will be created with no aging information in
+	    <filename>/etc/shadow</filename>, and their numeric
+	    identifiers are choosen in the
+	    <option>SYS_UID_MIN</option>-<option>SYS_UID_MAX</option>
+	    range, defined in <filename>login.defs</filename>, instead of
+	    <option>UID_MIN</option>-<option>UID_MAX</option> (and their
+	    <option>GID</option> counterparts for the creation of groups).
+	  </para>
+	</listitem>
+      </varlistentry>
+      <varlistentry>
+	<term>
 	  <option>-s</option>, <option>--shell</option>
 	  <replaceable>SHELL</replaceable>
 	</term>
Index: shadow-4.1.1/man/groupadd.8.xml
===================================================================
--- shadow-4.1.1.orig/man/groupadd.8.xml	2008-02-25 22:14:56.000000000 +0100
+++ shadow-4.1.1/man/groupadd.8.xml	2008-06-12 23:29:12.258795502 +0200
@@ -126,6 +126,22 @@
 	  </para>
 	</listitem>
       </varlistentry>
+      <varlistentry>
+	<term>
+	  <option>-r</option>, <option>--system</option>
+	</term>
+	<listitem>
+	  <para>
+	    Create a system group.
+	  </para>
+	  <para>
+	    The numeric identifiers of new system groups are choosen in
+	    the <option>SYS_GID_MIN</option>-<option>SYS_GID_MAX</option>
+	    range, defined in <filename>login.defs</filename>, instead of
+	    <option>GID_MIN</option>-<option>GID_MAX</option>.
+	  </para>
+	</listitem>
+      </varlistentry>
     </variablelist>
   </refsect1>
 
Index: shadow-4.1.1/man/newusers.8.xml
===================================================================
--- shadow-4.1.1.orig/man/newusers.8.xml	2008-02-25 22:14:56.000000000 +0100
+++ shadow-4.1.1/man/newusers.8.xml	2008-06-12 23:29:12.258795502 +0200
@@ -94,6 +94,68 @@
     </para>
   </refsect1>
 
+  <refsect1 id='options'>
+    <title>OPTIONS</title>
+    <para>The options which apply to the <command>newusers</command> command are:
+    </para>
+    <variablelist remap='IP'>
+      <varlistentry>
+	<term><option>-c</option>, <option>--crypt-method</option></term>
+	<listitem>
+	  <para>Use the specified method to encrypt the passwords.</para>
+	  <para>
+	    The available methods are DES, MD5, NONE, and SHA256 or SHA512
+	    if your libc support these methods.
+	  </para>
+	</listitem>
+      </varlistentry>
+      <varlistentry>
+	<term>
+	  <option>-r</option>, <option>--system</option>
+	</term>
+	<listitem>
+	  <para>
+	    Create a system account.
+	  </para>
+	  <para>
+	    System users will be created with no aging information in
+	    <filename>/etc/shadow</filename>, and their numeric
+	    identifiers are choosen in the
+	    <option>SYS_UID_MIN</option>-<option>SYS_UID_MAX</option>
+	    range, defined in <filename>login.defs</filename>, instead of
+	    <option>UID_MIN</option>-<option>UID_MAX</option> (and their
+	    <option>GID</option> counterparts for the creation of groups).
+	  </para>
+	</listitem>
+      </varlistentry>
+      <varlistentry condition="sha_crypt">
+	<term><option>-s</option>, <option>--sha-rounds</option></term>
+	<listitem>
+	  <para>
+	    Use the specified number of rounds to encrypt the passwords.
+	  </para>
+	  <para>
+	    The value 0 means that the system will choose the default
+	    number of rounds for the crypt method (5000).
+	  </para>
+	  <para>
+	    A minimal value of 1000 and a maximal value of 999,999,999
+	    will be enforced.
+	  </para>
+	  <para>
+	    You can only use this option with the SHA256 or SHA512
+	    crypt method.
+	  </para>
+	  <para>
+	    By default, the number of rounds is defined by the
+	    SHA_CRYPT_MIN_ROUNDS and SHA_CRYPT_MAX_ROUNDS variables in
+	    <filename>/etc/login.defs</filename>.
+	  </para>
+	</listitem>
+      </varlistentry>
+    </variablelist>
+  </refsect1>
+
   <refsect1 id='caveats'>
     <title>CAVEATS</title>
     <para>
Index: shadow-4.1.1/src/newusers.c
===================================================================
--- shadow-4.1.1.orig/src/newusers.c	2008-06-12 23:34:34.859795564 +0200
+++ shadow-4.1.1/src/newusers.c	2008-06-12 23:38:33.290795654 +0200
@@ -443,6 +443,7 @@
 	static struct option long_options[] = {
 		{"crypt-method", required_argument, NULL, 'c'},
 		{"help", no_argument, NULL, 'h'},
+		{"system", no_argument, NULL, 'r'},
 #ifdef USE_SHA_CRYPT
 		{"sha-rounds", required_argument, NULL, 's'},
 #endif
@@ -451,9 +452,9 @@
 
 	while ((c = getopt_long (argc, argv,
 #ifdef USE_SHA_CRYPT
-	                     "c:hs:",
+	                     "c:hrs:",
 #else
-	                     "c:h",
+	                     "c:hr",
 #endif
 	                     long_options, &option_index)) != -1) {
 		switch (c) {
@@ -464,6 +465,9 @@
 		case 'h':
 			usage ();
 			break;
+		case 'r':
+			rflg = 1;
+			break;
 #ifdef USE_SHA_CRYPT
 		case 's':
 			sflg = 1;
