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 +static char             luser[LOGNAME_MAX_ILLUMOS + 1];
  56   58  
  57   59  static void generate_record(char *, int, char *);
  58   60  static int selected(uid_t, char *, au_event_t, int);
  59   61  
  60   62  void
  61   63  audit_ftpd_bad_pw(char *uname)
  62   64  {
  63   65          if (cannot_audit(0)) {
  64   66                  return;
  65   67          }
  66      -        (void) strncpy(luser, uname, LOGNAME_MAX);
       68 +        (void) strncpy(luser, uname, LOGNAME_MAX_ILLUMOS);
  67   69          generate_record(luser, BAD_PASSWD, dgettext(bsm_dom, "bad password"));
  68   70  }
  69   71  
  70   72  
  71   73  void
  72   74  audit_ftpd_unknown(char *uname)
  73   75  {
  74   76          if (cannot_audit(0)) {
  75   77                  return;
  76   78          }
  77      -        (void) strncpy(luser, uname, LOGNAME_MAX);
       79 +        (void) strncpy(luser, uname, LOGNAME_MAX_ILLUMOS);
  78   80          generate_record(luser, UNKNOWN_USER, dgettext(bsm_dom, "unknown user"));
  79   81  }
  80   82  
  81   83  
  82   84  void
  83   85  audit_ftpd_excluded(char *uname)
  84   86  {
  85   87          if (cannot_audit(0)) {
  86   88                  return;
  87   89          }
  88      -        (void) strncpy(luser, uname, LOGNAME_MAX);
       90 +        (void) strncpy(luser, uname, LOGNAME_MAX_ILLUMOS);
  89   91          generate_record(luser, EXCLUDED_USER, dgettext(bsm_dom,
  90   92              "excluded user"));
  91   93  }
  92   94  
  93   95  
  94   96  void
  95   97  audit_ftpd_no_anon(void)
  96   98  {
  97   99          if (cannot_audit(0)) {
  98  100                  return;
↓ open down ↓ 9 lines elided ↑ open up ↑
 108  110          }
 109  111          generate_record(uname, MISC_FAILURE, dgettext(bsm_dom, "misc failure"));
 110  112  }
 111  113  
 112  114  void
 113  115  audit_ftpd_success(char *uname)
 114  116  {
 115  117          if (cannot_audit(0)) {
 116  118                  return;
 117  119          }
 118      -        (void) strncpy(luser, uname, LOGNAME_MAX);
      120 +        (void) strncpy(luser, uname, LOGNAME_MAX_ILLUMOS);
 119  121          generate_record(luser, 0, "");
 120  122  }
 121  123  
 122  124  
 123  125  
 124  126  static void
 125  127  generate_record(
 126  128                  char    *locuser,       /* username of local user */
 127  129                  int     err,            /* error status */
 128  130                                          /* (=0 success, >0 error code) */
↓ open down ↓ 174 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX