Print this page
10107 librpcsvc needs smatch fixes

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/librpcsvc/common/rusers_simple.c
          +++ new/usr/src/lib/librpcsvc/common/rusers_simple.c
↓ open down ↓ 11 lines elided ↑ open up ↑
  12   12   * and limitations under the License.
  13   13   *
  14   14   * When distributing Covered Code, include this CDDL HEADER in each
  15   15   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16   16   * If applicable, add the following below this CDDL HEADER, with the
  17   17   * fields enclosed by brackets "[]" replaced with your own identifying
  18   18   * information: Portions Copyright [yyyy] [name of copyright owner]
  19   19   *
  20   20   * CDDL HEADER END
  21   21   */
  22      -#pragma ident   "%Z%%M% %I%     %E% SMI"
  23   22  
  24   23  /*
  25   24   * rusers_simple.c
  26   25   * These are the "easy to use" interfaces to rusers.
  27   26   *
  28   27   * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
  29   28   * Use is subject to license terms.
  30   29   */
  31   30  
       31 +/*
       32 + * Copyright (c) 2018, Joyent, Inc.
       33 + */
       34 +
  32   35  #include <string.h>
  33   36  #include <rpc/rpc.h>
  34   37  #include <rpcsvc/rusers.h>
  35   38  #include <stdlib.h>
  36   39  
  37   40  int
  38   41  rusers3(host, uap)
  39   42          char *host;
  40   43          utmp_array *uap;
  41   44  {
↓ open down ↓ 36 lines elided ↑ open up ↑
  78   81  
  79   82                                          while (--rutp >= uap->utmp_array_val) {
  80   83                                                  free(rutp->ut_line);
  81   84                                                  free(rutp->ut_user);
  82   85                                                  free(rutp->ut_host);
  83   86                                          }
  84   87                                          free(uap->utmp_array_val);
  85   88                                          xdr_free(xdr_utmpidlearr, (char *)&up);
  86   89                                          return (-1);
  87   90                                  }
  88      -                                strncpy(rutp->ut_line,
       91 +                                (void) strncpy(rutp->ut_line,
  89   92                                          up.uia_arr[i]->ui_utmp.ut_line,
  90   93                                          sizeof (forsize.ut_line)+1);
  91      -                                strncpy(rutp->ut_user,
       94 +                                (void) strncpy(rutp->ut_user,
  92   95                                          up.uia_arr[i]->ui_utmp.ut_name,
  93   96                                          sizeof (forsize.ut_name)+1);
  94      -                                strncpy(rutp->ut_host,
       97 +                                (void) strncpy(rutp->ut_host,
  95   98                                          up.uia_arr[i]->ui_utmp.ut_host,
  96   99                                          sizeof (forsize.ut_host)+1);
  97  100                                  rutp->ut_idle = up.uia_arr[i]->ui_idle;
  98  101                                  rutp->ut_time = up.uia_arr[i]->ui_utmp.ut_time;
  99  102                                  rutp->ut_type = RUSERS_USER_PROCESS;
 100  103                                                          /* assume this */
 101  104                          }
 102  105                          xdr_free(xdr_utmpidlearr, (char *)&up);
 103  106                  }
 104  107          }
↓ open down ↓ 5 lines elided ↑ open up ↑
 110  113          char *host;
 111  114  {
 112  115          int nusers;
 113  116  
 114  117          if (rpc_call(host, RUSERSPROG, RUSERSVERS_3, RUSERSPROC_NUM,
 115  118                          xdr_void, (char *) NULL,
 116  119                          xdr_u_int, (char *) &nusers, (char *) NULL) != 0) {
 117  120                  if (rpc_call(host, RUSERSPROG, RUSERSVERS_IDLE, RUSERSPROC_NUM,
 118  121                          xdr_void, (char *) NULL,
 119  122                          xdr_u_int, (char *) &nusers, (char *) NULL) != 0)
 120      -                return (-1);
      123 +                        return (-1);
 121  124          }
 122  125          return (nusers);
 123  126  }
 124  127  
 125  128  enum clnt_stat
 126  129  rusers(host, up)
 127  130          char *host;
 128  131          struct utmpidlearr *up;
 129  132  {
 130  133          return (rpc_call(host, RUSERSPROG, RUSERSVERS_IDLE, RUSERSPROC_NAMES,
 131  134                          xdr_void, (char *) NULL,
 132  135                          xdr_utmpidlearr, (char *) up, (char *) NULL));
 133  136  }
 134  137  
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX