Print this page
1666 libwrap is 32bit only
Reviewed by: Andrew Stormont <andyjstormont@gmail.com>
Reviewed by: Garrett D'Amore <garrett.damore@dey-sys.com>
Reviewed by: Richard Lowe <richlowe@richlowe.net>

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libwrap/tli.c
          +++ new/usr/src/lib/libwrap/tli.c
   1    1  /*
   2    2   * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
   3    3   * Use is subject to license terms.
   4    4   */
   5    5  
   6      -#pragma ident   "%Z%%M% %I%     %E% SMI"
   7      -
   8    6   /*
   9    7    * tli_host() determines the type of transport (connected, connectionless),
  10    8    * the transport address of a client host, and the transport address of a
  11    9    * server endpoint. In addition, it provides methods to map a transport
  12   10    * address to a printable host name or address. Socket address results are
  13   11    * in static memory; tli structures are allocated from the heap.
  14   12    * 
  15   13    * The result from the hostname lookup method is STRING_PARANOID when a host
  16   14    * pretends to have someone elses name, or when a host name is available but
  17   15    * could not be verified.
↓ open down ↓ 24 lines elided ↑ open up ↑
  42   40  #include <stdlib.h>
  43   41  #include <unistd.h>
  44   42  #include <syslog.h>
  45   43  #include <errno.h>
  46   44  #include <netconfig.h>
  47   45  #include <netdir.h>
  48   46  #include <string.h>
  49   47  
  50   48  extern char *nc_sperror();
  51   49  extern int errno;
  52      -extern char *sys_errlist[];
  53      -extern int sys_nerr;
  54   50  extern int t_errno;
  55   51  extern char *t_errlist[];
  56   52  extern int t_nerr;
  57   53  
  58   54  /* Local stuff. */
  59   55  
  60   56  #include "tcpd.h"
  61   57  
  62   58  /* Forward declarations. */
  63   59  
↓ open down ↓ 249 lines elided ↑ open up ↑
 313  309  }
 314  310  
 315  311  /* tli_error - convert tli error number to text */
 316  312  
 317  313  static char *tli_error()
 318  314  {
 319  315      static char buf[40];
 320  316  
 321  317      if (t_errno != TSYSERR) {
 322  318          if (t_errno < 0 || t_errno >= t_nerr) {
 323      -            sprintf(buf, "Unknown TLI error %d", t_errno);
      319 +            snprintf(buf, sizeof (buf), "Unknown TLI error %d", t_errno);
 324  320              return (buf);
 325  321          } else {
 326  322              return (t_errlist[t_errno]);
 327  323          }
 328  324      } else {
 329      -        if (errno < 0 || errno >= sys_nerr) {
 330      -            sprintf(buf, "Unknown UNIX error %d", errno);
 331      -            return (buf);
 332      -        } else {
 333      -            return (sys_errlist[errno]);
 334      -        }
      325 +        STRN_CPY(buf, strerror(errno), sizeof (buf));
      326 +        return (buf);
 335  327      }
 336  328  }
 337  329  
 338  330  /* tli_sink - absorb unreceived datagram */
 339  331  
 340  332  static void tli_sink(fd)
 341  333  int     fd;
 342  334  {
 343  335      struct t_unitdata *unit;
 344  336      int     flags;
↓ open down ↓ 18 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX