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

@@ -17,10 +17,12 @@
  * information: Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
  */
 /*
+ * Copyright (c) 2013 Gary Mills
+ *
  * Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
  */
 
 #include <sys/types.h>
 #include <sys/param.h>

@@ -50,22 +52,28 @@
 #define UNKNOWN_USER    (2)
 #define EXCLUDED_USER   (3)
 #define NO_ANONYMOUS    (4)
 #define MISC_FAILURE    (5)
 
-static char             luser[LOGNAME_MAX + 1];
+#ifdef  LOGNAME_MAX_ILLUMOS
+#define _LOGNAME_MAX    LOGNAME_MAX_ILLUMOS
+#else /* LOGNAME_MAX_ILLUMOS */
+#define _LOGNAME_MAX    LOGNAME_MAX
+#endif /* LOGNAME_MAX_ILLUMOS */
 
+static char             luser[_LOGNAME_MAX + 1];
+
 static void generate_record(char *, int, char *);
 static int selected(uid_t, char *, au_event_t, int);
 
 void
 audit_ftpd_bad_pw(char *uname)
 {
         if (cannot_audit(0)) {
                 return;
         }
-        (void) strncpy(luser, uname, LOGNAME_MAX);
+        (void) strncpy(luser, uname, _LOGNAME_MAX);
         generate_record(luser, BAD_PASSWD, dgettext(bsm_dom, "bad password"));
 }
 
 
 void

@@ -72,11 +80,11 @@
 audit_ftpd_unknown(char *uname)
 {
         if (cannot_audit(0)) {
                 return;
         }
-        (void) strncpy(luser, uname, LOGNAME_MAX);
+        (void) strncpy(luser, uname, _LOGNAME_MAX);
         generate_record(luser, UNKNOWN_USER, dgettext(bsm_dom, "unknown user"));
 }
 
 
 void

@@ -83,11 +91,11 @@
 audit_ftpd_excluded(char *uname)
 {
         if (cannot_audit(0)) {
                 return;
         }
-        (void) strncpy(luser, uname, LOGNAME_MAX);
+        (void) strncpy(luser, uname, _LOGNAME_MAX);
         generate_record(luser, EXCLUDED_USER, dgettext(bsm_dom,
             "excluded user"));
 }
 
 

@@ -113,11 +121,11 @@
 audit_ftpd_success(char *uname)
 {
         if (cannot_audit(0)) {
                 return;
         }
-        (void) strncpy(luser, uname, LOGNAME_MAX);
+        (void) strncpy(luser, uname, _LOGNAME_MAX);
         generate_record(luser, 0, "");
 }