svn commit: r350296 - stable/12/contrib/tcp_wrappers

Brooks Davis brooks at FreeBSD.org
Wed Jul 24 19:16:06 UTC 2019


Author: brooks
Date: Wed Jul 24 19:16:02 2019
New Revision: 350296
URL: https://svnweb.freebsd.org/changeset/base/350296

Log:
  MFC r350098, r350100-r350101
  
  r350098:
  Use ANSI C function definitions and declerations.
  
  r350100:
  Use headers instead of manual declerations of standard functions and
  variables.
  
  r350101:
  Remove a duplicate global (rfc931_timeout).
  
  It is declared here and in rfc931.c and unused here so keep that copy
  and discard this one.
  
  Obtained from:	CheriBSD
  Sponsored by:	DARPA, AFRL

Modified:
  stable/12/contrib/tcp_wrappers/hosts_access.c
  stable/12/contrib/tcp_wrappers/inetcf.c
  stable/12/contrib/tcp_wrappers/inetcf.h
  stable/12/contrib/tcp_wrappers/mystdarg.h
  stable/12/contrib/tcp_wrappers/options.c
  stable/12/contrib/tcp_wrappers/rfc931.c
  stable/12/contrib/tcp_wrappers/scaffold.c
  stable/12/contrib/tcp_wrappers/scaffold.h
  stable/12/contrib/tcp_wrappers/shell_cmd.c
  stable/12/contrib/tcp_wrappers/socket.c
  stable/12/contrib/tcp_wrappers/tcpd.c
  stable/12/contrib/tcp_wrappers/tcpdchk.c
  stable/12/contrib/tcp_wrappers/tcpdmatch.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/contrib/tcp_wrappers/hosts_access.c
==============================================================================
--- stable/12/contrib/tcp_wrappers/hosts_access.c	Wed Jul 24 17:41:40 2019	(r350295)
+++ stable/12/contrib/tcp_wrappers/hosts_access.c	Wed Jul 24 19:16:02 2019	(r350296)
@@ -87,16 +87,17 @@ int     resident = (-1);		/* -1, 0: unknown; +1: yes *
 
 /* Forward declarations. */
 
-static int table_match();
-static int list_match();
-static int server_match();
-static int client_match();
-static int host_match();
-static int string_match();
-static int masked_match();
+static int table_match(char *table, struct request_info *request);
+static int list_match(char *list, struct request_info *request,
+    int (*match_fn)(char *, struct request_info *));
+static int server_match(char *tok, struct request_info *request);
+static int client_match(char *tok, struct request_info *request);
+static int host_match(char *tok, struct host_info *host);
+static int string_match(char *tok, char *string);
+static int masked_match(char *net_tok, char *mask_tok, char *string);
 #ifdef INET6
-static int masked_match4();
-static int masked_match6();
+static int masked_match4(char *net_tok, char *mask_tok, char *string);
+static int masked_match6(char *net_tok, char *mask_tok, char *string);
 #endif
 
 /* Size of logical line buffer. */
@@ -213,10 +214,8 @@ struct request_info *request;
 
 /* list_match - match a request against a list of patterns with exceptions */
 
-static int list_match(list, request, match_fn)
-char   *list;
-struct request_info *request;
-int   (*match_fn) ();
+static int list_match(char *list, struct request_info *request,
+    int (*match_fn)(char *, struct request_info *))
 {
     char   *tok;
 

Modified: stable/12/contrib/tcp_wrappers/inetcf.c
==============================================================================
--- stable/12/contrib/tcp_wrappers/inetcf.c	Wed Jul 24 17:41:40 2019	(r350295)
+++ stable/12/contrib/tcp_wrappers/inetcf.c	Wed Jul 24 19:16:02 2019	(r350296)
@@ -14,12 +14,9 @@ static char sccsid[] = "@(#) inetcf.c 1.7 97/02/12 02:
 #include <sys/stat.h>
 #include <stdio.h>
 #include <errno.h>
-#include <string.h>
 #include <stdlib.h>
+#include <string.h>
 
-extern int errno;
-extern void exit();
-
 #include "tcpd.h"
 #include "inetcf.h"
 #include "scaffold.h"
@@ -39,8 +36,9 @@ char   *inet_files[] = {
     0,
 };
 
-static void inet_chk();
-static char *base_name();
+static void inet_chk(char *protocol, char *path, char *arg0, char *arg1);
+static char *base_name(char *path);
+extern char *percent_m(char *obuf, char *ibuf);
 
  /*
   * Structure with everything we know about a service.
@@ -69,7 +67,6 @@ char   *conf;
     char   *arg0;
     char   *arg1;
     struct tcpd_context saved_context;
-    char   *percent_m();
     int     i;
     struct stat st;
 

Modified: stable/12/contrib/tcp_wrappers/inetcf.h
==============================================================================
--- stable/12/contrib/tcp_wrappers/inetcf.h	Wed Jul 24 17:41:40 2019	(r350295)
+++ stable/12/contrib/tcp_wrappers/inetcf.h	Wed Jul 24 19:16:02 2019	(r350296)
@@ -4,9 +4,9 @@
   * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
   */
 
-extern char *inet_cfg();		/* read inetd.conf file */
-extern void inet_set();			/* remember internet service */
-extern int inet_get();			/* look up internet service */
+extern char *inet_cfg(char *conf);		/* read inetd.conf file */
+extern void inet_set(char *name, int type);	/* remember internet service */
+extern int inet_get(char *name);		/* look up internet service */
 
 #define	WR_UNKNOWN	(-1)		/* service unknown */
 #define	WR_NOT		1		/* may not be wrapped */

Modified: stable/12/contrib/tcp_wrappers/mystdarg.h
==============================================================================
--- stable/12/contrib/tcp_wrappers/mystdarg.h	Wed Jul 24 17:41:40 2019	(r350295)
+++ stable/12/contrib/tcp_wrappers/mystdarg.h	Wed Jul 24 19:16:02 2019	(r350296)
@@ -16,4 +16,4 @@
 #define	VAEND(ap)              va_end(ap);}
 #endif
 
-extern char *percent_m();
+extern char *percent_m(char *obuf, char *ibuf);

Modified: stable/12/contrib/tcp_wrappers/options.c
==============================================================================
--- stable/12/contrib/tcp_wrappers/options.c	Wed Jul 24 17:41:40 2019	(r350295)
+++ stable/12/contrib/tcp_wrappers/options.c	Wed Jul 24 19:16:02 2019	(r350296)
@@ -71,8 +71,8 @@ extern jmp_buf tcpd_buf;		/* tcpd_jump() support */
 static char whitespace_eq[] = "= \t\r\n";
 #define whitespace (whitespace_eq + 1)
 
-static char *get_field();		/* chew :-delimited field off string */
-static char *chop_string();		/* strip leading and trailing blanks */
+static char *get_field(char *string);		/* chew :-delimited field off string */
+static char *chop_string(char *string);		/* strip leading and trailing blanks */
 
 /* List of functions that implement the options. Add yours here. */
 

Modified: stable/12/contrib/tcp_wrappers/rfc931.c
==============================================================================
--- stable/12/contrib/tcp_wrappers/rfc931.c	Wed Jul 24 17:41:40 2019	(r350295)
+++ stable/12/contrib/tcp_wrappers/rfc931.c	Wed Jul 24 19:16:02 2019	(r350296)
@@ -66,8 +66,7 @@ int     protocol;
 
 /* timeout - handle timeouts */
 
-static void timeout(sig)
-int     sig;
+static void timeout(int sig)
 {
     longjmp(timebuf, sig);
 }

Modified: stable/12/contrib/tcp_wrappers/scaffold.c
==============================================================================
--- stable/12/contrib/tcp_wrappers/scaffold.c	Wed Jul 24 17:41:40 2019	(r350295)
+++ stable/12/contrib/tcp_wrappers/scaffold.c	Wed Jul 24 19:16:02 2019	(r350296)
@@ -21,6 +21,7 @@ static char sccs_id[] = "@(#) scaffold.c 1.6 97/03/21 
 #include <stdio.h>
 #include <syslog.h>
 #include <setjmp.h>
+#include <stdlib.h>
 #include <string.h>
 #include <stdlib.h>
 
@@ -38,7 +39,6 @@ static char sccs_id[] = "@(#) scaffold.c 1.6 97/03/21 
   */
 int     allow_severity = SEVERITY;
 int     deny_severity = LOG_WARNING;
-int     rfc931_timeout = RFC931_TIMEOUT;
 
 #ifndef INET6
 /* dup_hostent - create hostent in one memory block */

Modified: stable/12/contrib/tcp_wrappers/scaffold.h
==============================================================================
--- stable/12/contrib/tcp_wrappers/scaffold.h	Wed Jul 24 17:41:40 2019	(r350295)
+++ stable/12/contrib/tcp_wrappers/scaffold.h	Wed Jul 24 19:16:02 2019	(r350296)
@@ -7,9 +7,9 @@
   */
 
 #ifdef INET6
-extern struct addrinfo *find_inet_addr();
+extern struct addrinfo *find_inet_addr(char *host);
 #else
-extern struct hostent *find_inet_addr();
+extern struct hostent *find_inet_addr(char *host);
 #endif
-extern int check_dns();
-extern int check_path();
+extern int check_dns(char *host);
+extern int check_path(char *path, struct stat *st);

Modified: stable/12/contrib/tcp_wrappers/shell_cmd.c
==============================================================================
--- stable/12/contrib/tcp_wrappers/shell_cmd.c	Wed Jul 24 17:41:40 2019	(r350295)
+++ stable/12/contrib/tcp_wrappers/shell_cmd.c	Wed Jul 24 19:16:02 2019	(r350296)
@@ -32,7 +32,7 @@ extern void exit();
 
 /* Forward declarations. */
 
-static void do_child();
+static void do_child(char *command);
 
 /* shell_cmd - execute shell command */
 
@@ -62,8 +62,7 @@ char   *command;
 
 /* do_child - exec command with { stdin, stdout, stderr } to /dev/null */
 
-static void do_child(command)
-char   *command;
+static void do_child(char *command)
 {
     char   *error;
     int     tmp_fd;

Modified: stable/12/contrib/tcp_wrappers/socket.c
==============================================================================
--- stable/12/contrib/tcp_wrappers/socket.c	Wed Jul 24 17:41:40 2019	(r350295)
+++ stable/12/contrib/tcp_wrappers/socket.c	Wed Jul 24 19:16:02 2019	(r350296)
@@ -42,7 +42,7 @@ extern char *inet_ntoa();
 
 /* Forward declarations. */
 
-static void sock_sink();
+static void sock_sink(int);
 
 #ifdef APPEND_DOT
 
@@ -406,8 +406,7 @@ struct host_info *host;
 
 /* sock_sink - absorb unreceived IP datagram */
 
-static void sock_sink(fd)
-int     fd;
+static void sock_sink(int fd)
 {
     char    buf[BUFSIZ];
 #ifdef INET6

Modified: stable/12/contrib/tcp_wrappers/tcpd.c
==============================================================================
--- stable/12/contrib/tcp_wrappers/tcpd.c	Wed Jul 24 17:41:40 2019	(r350295)
+++ stable/12/contrib/tcp_wrappers/tcpd.c	Wed Jul 24 19:16:02 2019	(r350296)
@@ -26,6 +26,7 @@ static char sccsid[] = "@(#) tcpd.c 1.10 96/02/11 17:0
 #include <stdio.h>
 #include <syslog.h>
 #include <string.h>
+#include <unistd.h>
 
 #ifndef MAXPATHNAMELEN
 #define MAXPATHNAMELEN	BUFSIZ

Modified: stable/12/contrib/tcp_wrappers/tcpdchk.c
==============================================================================
--- stable/12/contrib/tcp_wrappers/tcpdchk.c	Wed Jul 24 17:41:40 2019	(r350295)
+++ stable/12/contrib/tcp_wrappers/tcpdchk.c	Wed Jul 24 19:16:02 2019	(r350296)
@@ -34,15 +34,10 @@ static char sccsid[] = "@(#) tcpdchk.c 1.8 97/02/12 02
 #include <setjmp.h>
 #include <errno.h>
 #include <netdb.h>
+#include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#include <stdlib.h>
 
-extern int errno;
-extern void exit();
-extern int optind;
-extern char *optarg;
-
 #ifndef INADDR_NONE
 #define INADDR_NONE     (-1)		/* XXX should be 0xffffffff */
 #endif
@@ -73,15 +68,15 @@ extern jmp_buf tcpd_buf;
  /*
   * Local stuff.
   */
-static void usage();
-static void parse_table();
-static void print_list();
-static void check_daemon_list();
-static void check_client_list();
-static void check_daemon();
-static void check_user();
-static int check_host();
-static int reserved_name();
+static void usage(void);
+static void parse_table(char *table, struct request_info *request);
+static void print_list(char *title, char *list);
+static void check_daemon_list(char *list);
+static void check_client_list(char *list);
+static void check_daemon(char *pat);
+static void check_user(char *pat);
+static int check_host(char *pat);
+static int reserved_name(char *pat);
 
 #define PERMIT	1
 #define DENY	0
@@ -185,7 +180,7 @@ char  **argv;
 
 /* usage - explain */
 
-static void usage()
+static void usage(void)
 {
     fprintf(stderr, "usage: %s [-a] [-d] [-i inet_conf] [-v]\n", myname);
     fprintf(stderr, "	-a: report rules with implicit \"ALLOW\" at end\n");

Modified: stable/12/contrib/tcp_wrappers/tcpdmatch.c
==============================================================================
--- stable/12/contrib/tcp_wrappers/tcpdmatch.c	Wed Jul 24 17:41:40 2019	(r350295)
+++ stable/12/contrib/tcp_wrappers/tcpdmatch.c	Wed Jul 24 19:16:02 2019	(r350296)
@@ -30,13 +30,10 @@ static char sccsid[] = "@(#) tcpdmatch.c 1.5 96/02/11 
 #include <stdio.h>
 #include <syslog.h>
 #include <setjmp.h>
+#include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
 
-extern void exit();
-extern int optind;
-extern char *optarg;
-
 #ifndef	INADDR_NONE
 #define	INADDR_NONE	(-1)		/* XXX should be 0xffffffff */
 #endif
@@ -51,8 +48,8 @@ extern char *optarg;
 #include "inetcf.h"
 #include "scaffold.h"
 
-static void usage();
-static void tcpdmatch();
+static void usage(char *myname);
+static void tcpdmatch(struct request_info *request);
 
 /* The main program */
 


More information about the svn-src-all mailing list