Print this page
2989 Eliminate use of LOGNAME_MAX in ON
1166 useradd have warning with name more 8 chars

@@ -17,20 +17,20 @@
  * information: Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
  */
 /*
+ * Copyright (c) 2013 Gary Mills
+ *
  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
 /*        All Rights Reserved   */
 
 
-#pragma ident   "%Z%%M% %I%     %E% SMI"
-
 #include <sys/param.h>
 #include <sys/types.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdio.h>

@@ -53,10 +53,16 @@
 #define NOMEM   "Out of memory"
 #define NGROUPS "Maximum groups exceeded for logname "
 #define BLANKLINE "Blank line detected. Please remove line"
 #define LONGNAME  "Group name too long"
 
+#ifdef  LOGNAME_MAX_ILLUMOS
+#define _LOGNAME_MAX    LOGNAME_MAX_ILLUMOS
+#else /* LOGNAME_MAX_ILLUMOS */
+#define _LOGNAME_MAX    LOGNAME_MAX
+#endif /* LOGNAME_MAX_ILLUMOS */
+
 int eflag, badchar, baddigit, badlognam, colons, len;
 static int longnam = 0;
 int code;
 
 #define MYBUFSIZE (LINE_MAX)    /* max line length including newline and null */

@@ -245,11 +251,11 @@
 
                 if (buf[0] == ':')
                         error(NONAME);
                 else {
                         for (i = 0; buf[i] != ':'; i++) {
-                                if (i >= LOGNAME_MAX)
+                                if (i >= _LOGNAME_MAX)
                                         longnam++;
                                 if (!(islower(buf[i]) || isdigit(buf[i])))
                                         badchar++;
                         }
                         if (longnam > 0)