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

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libbsm/common/audit_ftpd.c
          +++ new/usr/src/lib/libbsm/common/audit_ftpd.c
↓ open down ↓ 11 lines elided ↑ open up ↑
  12   12   *
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
       22 + * Copyright (c) 2013 Gary Mills
       23 + *
  22   24   * Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
  23   25   */
  24   26  
  25   27  #include <sys/types.h>
  26   28  #include <sys/param.h>
  27   29  #include <stdio.h>
  28   30  #include <sys/fcntl.h>
  29   31  #include <stdlib.h>
  30   32  #include <string.h>
  31   33  #include <syslog.h>
↓ open down ↓ 13 lines elided ↑ open up ↑
  45   47  #include <locale.h>
  46   48  #include <pwd.h>
  47   49  #include <generic.h>
  48   50  
  49   51  #define BAD_PASSWD      (1)
  50   52  #define UNKNOWN_USER    (2)
  51   53  #define EXCLUDED_USER   (3)
  52   54  #define NO_ANONYMOUS    (4)
  53   55  #define MISC_FAILURE    (5)
  54   56  
  55      -static char             luser[LOGNAME_MAX + 1];
       57 +#ifdef  LOGNAME_MAX_ILLUMOS
       58 +#define _LOGNAME_MAX    LOGNAME_MAX_ILLUMOS
       59 +#else /* LOGNAME_MAX_ILLUMOS */
       60 +#define _LOGNAME_MAX    LOGNAME_MAX
       61 +#endif /* LOGNAME_MAX_ILLUMOS */
  56   62  
       63 +static char             luser[_LOGNAME_MAX + 1];
       64 +
  57   65  static void generate_record(char *, int, char *);
  58   66  static int selected(uid_t, char *, au_event_t, int);
  59   67  
  60   68  void
  61   69  audit_ftpd_bad_pw(char *uname)
  62   70  {
  63   71          if (cannot_audit(0)) {
  64   72                  return;
  65   73          }
  66      -        (void) strncpy(luser, uname, LOGNAME_MAX);
       74 +        (void) strncpy(luser, uname, _LOGNAME_MAX);
  67   75          generate_record(luser, BAD_PASSWD, dgettext(bsm_dom, "bad password"));
  68   76  }
  69   77  
  70   78  
  71   79  void
  72   80  audit_ftpd_unknown(char *uname)
  73   81  {
  74   82          if (cannot_audit(0)) {
  75   83                  return;
  76   84          }
  77      -        (void) strncpy(luser, uname, LOGNAME_MAX);
       85 +        (void) strncpy(luser, uname, _LOGNAME_MAX);
  78   86          generate_record(luser, UNKNOWN_USER, dgettext(bsm_dom, "unknown user"));
  79   87  }
  80   88  
  81   89  
  82   90  void
  83   91  audit_ftpd_excluded(char *uname)
  84   92  {
  85   93          if (cannot_audit(0)) {
  86   94                  return;
  87   95          }
  88      -        (void) strncpy(luser, uname, LOGNAME_MAX);
       96 +        (void) strncpy(luser, uname, _LOGNAME_MAX);
  89   97          generate_record(luser, EXCLUDED_USER, dgettext(bsm_dom,
  90   98              "excluded user"));
  91   99  }
  92  100  
  93  101  
  94  102  void
  95  103  audit_ftpd_no_anon(void)
  96  104  {
  97  105          if (cannot_audit(0)) {
  98  106                  return;
↓ open down ↓ 9 lines elided ↑ open up ↑
 108  116          }
 109  117          generate_record(uname, MISC_FAILURE, dgettext(bsm_dom, "misc failure"));
 110  118  }
 111  119  
 112  120  void
 113  121  audit_ftpd_success(char *uname)
 114  122  {
 115  123          if (cannot_audit(0)) {
 116  124                  return;
 117  125          }
 118      -        (void) strncpy(luser, uname, LOGNAME_MAX);
      126 +        (void) strncpy(luser, uname, _LOGNAME_MAX);
 119  127          generate_record(luser, 0, "");
 120  128  }
 121  129  
 122  130  
 123  131  
 124  132  static void
 125  133  generate_record(
 126  134                  char    *locuser,       /* username of local user */
 127  135                  int     err,            /* error status */
 128  136                                          /* (=0 success, >0 error code) */
↓ open down ↓ 174 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX