document some useradd/groupadd caveats

Mike Frysinger <[email protected]> Mon, 22 Aug 2005 20:40:36 -0400
Newsgroups gmane.linux.pld.shadow.general
Organization wh0rd.org
Message-ID <[email protected]>
find attached a patch which documents the limitations shadow places on user 
and group names
-mike
user-group-add-caveats.patch (text/x-diff, 2.1 KB)
Index: libmisc/chkname.c
===================================================================
RCS file: /cvsroot/shadow/libmisc/chkname.c,v
retrieving revision 1.8
diff -u -p -r1.8 chkname.c
--- libmisc/chkname.c	12 May 2003 05:29:14 -0000	1.8
+++ libmisc/chkname.c	23 Aug 2005 00:39:16 -0000
@@ -18,7 +18,7 @@ RCSID ("$Id: chkname.c,v 1.8 2003/05/12 
 static int good_name (const char *name)
 {
 	/*
-	 * User/group names must match [a-z_][a-z0-9_-]*
+	 * User/group names must match [a-z_][a-z0-9_-$]*
 	 */
 	if (!*name || !((*name >= 'a' && *name <= 'z') || *name == '_'))
 		return 0;
Index: man/useradd.8.xml
===================================================================
RCS file: /cvsroot/shadow/man/useradd.8.xml,v
retrieving revision 1.14
diff -u -p -r1.14 useradd.8.xml
--- man/useradd.8.xml	10 Aug 2005 07:43:51 -0000	1.14
+++ man/useradd.8.xml	23 Aug 2005 00:39:16 -0000
@@ -329,6 +329,10 @@
     <para>You may not add a user to a NIS group. This must be performed on
       the NIS server.
     </para>
+    <para>Usernames must begin with a lower case letter or an underscore, and 
+      only lower case letters, underscores, dashes, and dollar signs may 
+      follow.  In regular expression terms: [a-z_][a-z0-9_-$]*
+    </para>
   </refsect1>
   
   <refsect1 id='files'>
Index: man/groupadd.8.xml
===================================================================
RCS file: /cvsroot/shadow/man/groupadd.8.xml,v
retrieving revision 1.11
diff -u -p -r1.11 groupadd.8.xml
--- man/groupadd.8.xml	7 Jul 2005 19:25:36 -0000	1.11
+++ man/groupadd.8.xml	23 Aug 2005 00:39:16 -0000
@@ -99,6 +99,15 @@
     </variablelist>
   </refsect1>
   
+  <refsect1 id='caveats'>
+    <title>CAVEATS</title>
+    <para>Groupnames must begin with a lower case letter or an underscore, and 
+      only lower case letters, underscores, dashes, and dollar signs may 
+      follow.  In regular expression terms: [a-z_][a-z0-9_-$]*
+    </para>
+    <para>Groupnames may only be up to 16 characters long</para>
+  </refsect1>
+  
   <refsect1 id='files'>
     <title>FILES</title>
     <variablelist>