From ae9447bd2bc98a5b32dec764b7e4a76ee850f6ad Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Thu, 5 Dec 2013 04:12:37 +0100 Subject: [PATCH] tcpd{chk,match}(8): Raise WARNS to 2 and fix warnings. --- contrib/tcp_wrappers/fakelog.c | 4 ---- contrib/tcp_wrappers/inetcf.c | 4 ---- contrib/tcp_wrappers/scaffold.c | 8 ++------ contrib/tcp_wrappers/tcpd.h | 2 +- contrib/tcp_wrappers/tcpdchk.c | 15 ++++++--------- contrib/tcp_wrappers/tcpdmatch.c | 7 ++----- usr.sbin/tcpdchk/Makefile | 2 +- usr.sbin/tcpdmatch/Makefile | 2 +- 8 files changed, 13 insertions(+), 31 deletions(-) diff --git a/contrib/tcp_wrappers/fakelog.c b/contrib/tcp_wrappers/fakelog.c index a8727c610f..d8ba998164 100644 --- a/contrib/tcp_wrappers/fakelog.c +++ b/contrib/tcp_wrappers/fakelog.c @@ -5,10 +5,6 @@ * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands. */ -#ifndef lint -static char sccsid[] = "@(#) fakelog.c 1.3 94/12/28 17:42:21"; -#endif - #include #include "mystdarg.h" diff --git a/contrib/tcp_wrappers/inetcf.c b/contrib/tcp_wrappers/inetcf.c index e89d89058c..272287ade2 100644 --- a/contrib/tcp_wrappers/inetcf.c +++ b/contrib/tcp_wrappers/inetcf.c @@ -5,10 +5,6 @@ * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands. */ -#ifndef lint -static char sccsid[] = "@(#) inetcf.c 1.7 97/02/12 02:13:23"; -#endif - #include #include #include diff --git a/contrib/tcp_wrappers/scaffold.c b/contrib/tcp_wrappers/scaffold.c index 387bcbf10d..acf9d412fb 100644 --- a/contrib/tcp_wrappers/scaffold.c +++ b/contrib/tcp_wrappers/scaffold.c @@ -6,10 +6,6 @@ * $FreeBSD: src/contrib/tcp_wrappers/scaffold.c,v 1.2.2.1 2000/07/18 08:34:55 ume Exp $ */ -#ifndef lint -static char sccs_id[] = "@(#) scaffold.c 1.6 97/03/21 19:27:24"; -#endif - /* System libraries. */ #include @@ -111,7 +107,7 @@ char *host; } if (!res->ai_canonname) { tcpd_warn("%s: hostname alias", host); - tcpd_warn("(cannot obtain official name)", res->ai_canonname); + tcpd_warn("(cannot obtain official name)"); } else if (STR_NE(host, res->ai_canonname)) { tcpd_warn("%s: hostname alias", host); tcpd_warn("(official name: %.*s)", STRING_LENGTH, res->ai_canonname); @@ -175,9 +171,9 @@ char *host; #else struct sockaddr_in sin; struct hostent *hp; + char *addr; #endif int count; - char *addr; if ((hp = find_inet_addr(host)) == 0) return (0); diff --git a/contrib/tcp_wrappers/tcpd.h b/contrib/tcp_wrappers/tcpd.h index 8900f235ee..0c3bce5ac3 100644 --- a/contrib/tcp_wrappers/tcpd.h +++ b/contrib/tcp_wrappers/tcpd.h @@ -4,13 +4,13 @@ * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands. * * $FreeBSD: src/contrib/tcp_wrappers/tcpd.h,v 1.2 2000/02/03 10:26:59 shin Exp $ - * $DragonFly: src/contrib/tcp_wrappers/tcpd.h,v 1.5 2005/09/24 02:34:11 sephe Exp $ */ #ifndef _LIBWRAP_TCPD_H #define _LIBWRAP_TCPD_H #include +#include #include /* Structure to describe one communications endpoint. */ diff --git a/contrib/tcp_wrappers/tcpdchk.c b/contrib/tcp_wrappers/tcpdchk.c index c1b8e4f2aa..aa02c23d3e 100644 --- a/contrib/tcp_wrappers/tcpdchk.c +++ b/contrib/tcp_wrappers/tcpdchk.c @@ -16,10 +16,6 @@ * $FreeBSD: src/contrib/tcp_wrappers/tcpdchk.c,v 1.3.2.1 2000/07/18 08:34:55 ume Exp $ */ -#ifndef lint -static char sccsid[] = "@(#) tcpdchk.c 1.8 97/02/12 02:13:25"; -#endif - /* System libraries. */ #include @@ -201,17 +197,18 @@ char *table; struct request_info *request; { FILE *fp; - int real_verdict; char sv_list[BUFLEN]; /* becomes list of daemons */ char *cl_list; /* becomes list of requests */ char *sh_cmd; /* becomes optional shell command */ char buf[BUFSIZ]; - int verdict; +#ifdef PROCESS_OPTIONS + int real_verdict, verdict; +#endif struct tcpd_context saved_context; saved_context = tcpd_context; /* stupid compilers */ - if (fp = fopen(table, "r")) { + if ((fp = fopen(table, "r")) != NULL) { tcpd_context.file = table; tcpd_context.line = 0; while (xgets(sv_list, sizeof(sv_list), fp)) { @@ -337,7 +334,7 @@ char *list; clients = 0; } else { clients++; - if (host = split_at(cp + 1, '@')) { /* user@host */ + if ((host = split_at(cp + 1, '@')) != NULL) { /* user@host */ check_user(cp); check_host(host); } else { @@ -477,7 +474,7 @@ char *pat; } else if (errno != ENOENT) { tcpd_warn("open %s: %m", pat); } - } else if (mask = split_at(pat, '/')) { /* network/netmask */ + } else if ((mask = split_at(pat, '/')) != NULL) { /* network/netmask */ #ifdef INET6 int mask_len; diff --git a/contrib/tcp_wrappers/tcpdmatch.c b/contrib/tcp_wrappers/tcpdmatch.c index 1e073c38ce..17d7f38b5b 100644 --- a/contrib/tcp_wrappers/tcpdmatch.c +++ b/contrib/tcp_wrappers/tcpdmatch.c @@ -15,10 +15,6 @@ * $FreeBSD: src/contrib/tcp_wrappers/tcpdmatch.c,v 1.2.2.1 2000/07/18 08:34:55 ume Exp $ */ -#ifndef lint -static char sccsid[] = "@(#) tcpdmatch.c 1.5 96/02/11 17:01:36"; -#endif - /* System libraries. */ #include @@ -28,6 +24,7 @@ static char sccsid[] = "@(#) tcpdmatch.c 1.5 96/02/11 17:01:36"; #include #include #include +#include #include #include #include @@ -68,7 +65,6 @@ char **argv; char *myname = argv[0]; char *client; char *server; - char *addr; char *user; char *daemon; struct request_info request; @@ -79,6 +75,7 @@ char **argv; struct sockaddr_storage server_sin; struct sockaddr_storage client_sin; #else + char *addr; struct sockaddr_in server_sin; struct sockaddr_in client_sin; #endif diff --git a/usr.sbin/tcpdchk/Makefile b/usr.sbin/tcpdchk/Makefile index 98afb1459e..085ac9f215 100644 --- a/usr.sbin/tcpdchk/Makefile +++ b/usr.sbin/tcpdchk/Makefile @@ -5,7 +5,7 @@ PROG= tcpdchk MAN= tcpdchk.8 SRCS= tcpdchk.c fakelog.c inetcf.c scaffold.c -WARNS?= 1 +WARNS?= 2 CFLAGS= -DREAL_DAEMON_DIR=\"/usr/libexec\" \ -DSEVERITY=LOG_INFO -DRFC931_TIMEOUT=10 \ diff --git a/usr.sbin/tcpdmatch/Makefile b/usr.sbin/tcpdmatch/Makefile index e40262ae24..479b8a577d 100644 --- a/usr.sbin/tcpdmatch/Makefile +++ b/usr.sbin/tcpdmatch/Makefile @@ -5,7 +5,7 @@ PROG= tcpdmatch MAN= tcpdmatch.8 SRCS= tcpdmatch.c fakelog.c inetcf.c scaffold.c -WARNS?= 1 +WARNS?= 2 CFLAGS= -DREAL_DAEMON_DIR=\"/usr/libexec\" \ -DSEVERITY=LOG_INFO -DRFC931_TIMEOUT=10 -- 2.41.0