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/types.h>
#include <sys/param.h>
#include <sys/signal.h>
#include <sys/sysmacros.h>
#include <sys/stat.h>
@@ -39,10 +39,11 @@
#include <string.h>
#include <ctype.h>
#include <locale.h>
#include <errno.h>
#include <unistd.h>
+#include <limits.h>
#define ERROR1 "Too many/few fields"
#define ERROR2 "Bad character(s) in logname"
#define ERROR2a "First char in logname not alphabetic"
#define ERROR2b "Logname field NULL"
@@ -161,11 +162,11 @@
if (badc > 0)
error(ERROR2);
/* Check for valid number of characters in logname */
- if (i <= 0 || i > 8)
+ if (i <= 0 || i > LOGNAME_MAX)
error(ERROR3);
/* Check that UID is numeric and <= MAXUID */
errno = 0;