Print this page
4385 Missing hosts_ctl() prototype in tcpd.h

@@ -1,17 +1,20 @@
 /*
+ * Copyright 2014 Sachidananda Urs <sacchi@gmail.com>
  * Copyright 2001 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
-#pragma ident   "%Z%%M% %I%     %E% SMI"
 
- /*
+/*
   * @(#) tcpd.h 1.5 96/03/19 16:22:24
   * 
   * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
   */
 
+#ifndef _TCPD_H
+#define _TCPD_H
+
 /*
  * HAVE_IPV6 is traditionally configured at tcp_wrappers build time but for
  * Solaris it must always be defined to keep the library interface binary
  * compatible.
  */

@@ -56,12 +59,12 @@
                                     sizeof (struct sockaddr_in))
 #define SGPORT(sag)             (*((sag)->sg_family == AF_INET6 ? \
                                     &(sag)->sg_sin6.sin6_port : \
                                     &(sag)->sg_sin.sin_port))
 #define SGADDRP(sag)            (((sag)->sg_family == AF_INET6 ? \
-                                    (char *) &(sag)->sg_sin6.sin6_addr : \
-                                    (char *) &(sag)->sg_sin.sin_addr))
+                                    (char *)&(sag)->sg_sin6.sin6_addr : \
+                                    (char *)&(sag)->sg_sin.sin_addr))
 #define SGFAM(sag)              ((sag)->sg_family == AF_INET6 ? \
                                     AF_INET6 : AF_INET)
 
 #define SG_IS_UNSPECIFIED(sag) \
                 ((sag)->sg_family == AF_INET6 ? \

@@ -74,14 +77,14 @@
 #define IPV6_ABITS 128                  /* Size of IPV6 address in bits */
 #endif
 
 #else /* HAVE_IPV6 */
 
-#define SGADDRSZ(sag)           sizeof(struct in_addr)
-#define SGSOCKADDRSZ(sag)       sizeof(struct sockaddr_in)
+#define SGADDRSZ(sag)           sizeof (struct in_addr)
+#define SGSOCKADDRSZ(sag)       sizeof (struct sockaddr_in)
 #define SGPORT(sag)             ((sag)->sg_sin.sin_port)
-#define SGADDRP(sag)            ((char*) &(sag)->sg_sin.sin_addr)
+#define SGADDRP(sag)            ((char *)&(sag)->sg_sin.sin_addr)
 #define SGFAM(sag)              AF_INET
 #define SG_IS_UNSPECIFIED(sag)  ((sag)->sg_sin.sin_addr.s_addr == 0)
 
 #define VALID_ADDRTYPE(t)       ((t) == AF_INET)
 

@@ -111,18 +114,18 @@
     struct netconfig *config;           /* netdir handle */
 };
 
 /* Common string operations. Less clutter should be more readable. */
 
-#define STRN_CPY(d,s,l) { strncpy((d),(s),(l)); (d)[(l)-1] = 0; }
+#define STRN_CPY(d, s, l)       { strncpy((d), (s), (l)); (d)[(l)-1] = 0; }
 
-#define STRN_EQ(x,y,l)  (strncasecmp((x),(y),(l)) == 0)
-#define STRN_NE(x,y,l)  (strncasecmp((x),(y),(l)) != 0)
-#define STR_EQ(x,y)     (strcasecmp((x),(y)) == 0)
-#define STR_NE(x,y)     (strcasecmp((x),(y)) != 0)
+#define STRN_EQ(x, y, l)        (strncasecmp((x), (y), (l)) == 0)
+#define STRN_NE(x, y, l)        (strncasecmp((x), (y), (l)) != 0)
+#define STR_EQ(x, y)            (strcasecmp((x), (y)) == 0)
+#define STR_NE(x, y)            (strcasecmp((x), (y)) != 0)
 
- /*
+/*
   * Initially, all above strings have the empty value. Information that
   * cannot be determined at runtime is set to "unknown", so that we can
   * distinguish between `unavailable' and `not yet looked up'. A hostname
   * that we do not believe in is set to "paranoid".
   */

@@ -131,26 +134,27 @@
 #define STRING_PARANOID "paranoid"      /* hostname conflict */
 
 extern char unknown[];
 extern char paranoid[];
 
-#define HOSTNAME_KNOWN(s) (STR_NE((s),unknown) && STR_NE((s),paranoid))
+#define HOSTNAME_KNOWN(s) (STR_NE((s), unknown) && STR_NE((s), paranoid))
 
 #ifdef HAVE_IPV6
-#define NOT_INADDR(s) (strchr(s,':') == 0 && s[strspn(s,"0123456789./")] != 0)
+#define NOT_INADDR(s) (strchr(s, ':') == 0 && s[strspn(s, "0123456789./")] != 0)
 #else
-#define NOT_INADDR(s) (s[strspn(s,"0123456789./")] != 0)
+#define NOT_INADDR(s) (s[strspn(s, "0123456789./")] != 0)
 #endif
 
 /* Global functions. */
 
 #if defined(TLI) || defined(PTX) || defined(TLI_SEQUENT)
 extern void fromhost();                 /* get/validate client host info */
 #else
 #define fromhost sock_host              /* no TLI support needed */
 #endif
 
+extern int hosts_ctl();                 /* wrapper around request_init() */
 extern int hosts_access();              /* access control */
 extern void shell_cmd();                /* execute shell command */
 extern char *percent_x();               /* do %<char> expansion */
 extern void rfc931();                   /* client name from RFC 931 daemon */
 extern void clean_exit();               /* clean up and exit */

@@ -175,18 +179,18 @@
 extern char *hosts_deny_table;          /* for verification mode redirection */
 extern int hosts_access_verbose;        /* for verbose matching mode */
 extern int rfc931_timeout;              /* user lookup timeout */
 extern int resident;                    /* > 0 if resident process */
 
- /*
+/*
   * Routines for controlled initialization and update of request structure
   * attributes. Each attribute has its own key.
   */
 
 #ifdef __STDC__
-extern struct request_info *request_init(struct request_info *,...);
-extern struct request_info *request_set(struct request_info *,...);
+extern struct request_info *request_init(struct request_info *, ...);
+extern struct request_info *request_set(struct request_info *, ...);
 #else
 extern struct request_info *request_init();     /* initialize request */
 extern struct request_info *request_set();      /* update request structure */
 #endif
 

@@ -198,11 +202,11 @@
 #define RQ_CLIENT_SIN   6               /* client endpoint (internal) */
 #define RQ_SERVER_NAME  7               /* server host name */
 #define RQ_SERVER_ADDR  8               /* server host address */
 #define RQ_SERVER_SIN   9               /* server endpoint (internal) */
 
- /*
+/*
   * Routines for delayed evaluation of request attributes. Each attribute
   * type has its own access method. The trivial ones are implemented by
   * macros. The other ones are wrappers around the transport-specific host
   * name, address, and client user lookup methods. The request_info and
   * host_info structures serve as caches for the lookup results.

@@ -229,11 +233,11 @@
 
 #if defined(TLI) || defined(PTX) || defined(TLI_SEQUENT)
 extern void tli_host();                 /* look up endpoint addresses etc. */
 #endif
 
- /*
+/*
   * Problem reporting interface. Additional file/line context is reported
   * when available. The jump buffer (tcpd_buf) is not declared here, or
   * everyone would have to include <setjmp.h>.
   */
 

@@ -249,22 +253,22 @@
     char   *file;                       /* current file */
     int     line;                       /* current line */
 };
 extern struct tcpd_context tcpd_context;
 
- /*
+/*
   * While processing access control rules, error conditions are handled by
   * jumping back into the hosts_access() routine. This is cleaner than
   * checking the return value of each and every silly little function. The
   * (-1) returns are here because zero is already taken by longjmp().
   */
 
 #define AC_PERMIT       1               /* permit access */
 #define AC_DENY         (-1)            /* deny_access */
 #define AC_ERROR        AC_DENY         /* XXX */
 
- /*
+/*
   * In verification mode an option function should just say what it would do,
   * instead of really doing it. An option function that would not return
   * should clear the dry_run flag to inform the caller of this unusual
   * behavior.
   */

@@ -306,5 +310,7 @@
 
 #ifdef LIBC_CALLS_STRTOK                /* libc calls strtok() */
 #define strtok  my_strtok
 extern char *my_strtok();
 #endif
+
+#endif /* _TCPD_H */