Subject: bin/6835: tcpdchk does not work (patch for -current and 1.3.3)
To: None <gnats-bugs@gnats.netbsd.org>
From: None <woods@proven.weird.com>
List: netbsd-bugs
Date: 01/18/1999 11:53:42
>Number:         6835
>Category:       bin
>Synopsis:       tcpdchk does not work
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jan 18 09:05:01 1999
>Last-Modified:
>Originator:     Greg A. Woods
>Organization:
Planix, Inc.; Toronto, Ontario; Canada
>Release:        NetBSD-1.3.3 and NetBSD-current
>Environment:

System: NetBSD

>Description:

	I've mumbled on about this problem before (PR#5278, and perhaps
	on the mailing lists), but the bottom line is that tcpdchk
	doesn't work, and the fix is pretty simple.

>How-To-Repeat:

	Note that tcpdchk doesn't show the "matched:" or "option:" lines
	in its reports.

>Fix:

	The patch to fakelog.c is the same as the one I suggested for
	PR#5278.

	The patch to the Makefile, at least the part about getting rid
	of the duplicate maintenance of CPPFLAGS was also suggested in
	PR#5278.

	The patch to tcpdchk.c itself was copied from my -current
	sources and IIRC is what's necessary to remove the WARNS flag.

	It would be really cool if these changes were pulled up in to
	1.3.4 too!

	If these changes are applied PR#5278 can also be closed.

cvs diff: Diffing usr.sbin/tcpdchk
cvs diff: usr.sbin/tcpdchk/.cvsignore is a new entry, no comparison available
Index: usr.sbin/tcpdchk/Makefile
===================================================================
RCS file: /cvs/NetBSD-1.3/usr.sbin/tcpdchk/Makefile,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 Makefile
--- usr.sbin/tcpdchk/Makefile	1998/12/24 07:03:31	1.1.1.1
+++ usr.sbin/tcpdchk/Makefile	1999/01/11 21:59:38
@@ -1,6 +1,6 @@
-#	$Netbsd$
+#	$NetBSD: Makefile,v 1.6 1998/03/05 18:03:35 christos Exp $
+#
 
-WARNS?=	0
 PROG=	tcpdchk
 SRCS=	tcpdchk.c fakelog.c inetcf.c scaffold.c percent_m.c
 MAN=	tcpdchk.8
@@ -8,10 +8,7 @@
 DPADD=	${LIBWRAP}
 
 CPPFLAGS+= -I${.CURDIR}/../../lib/libwrap
-CPPFLAGS+=-DFACILITY=LOG_AUTHPRIV -DSEVERITY=LOG_INFO -DPARANOID
-CPPFLAGS+=-DREAL_DAEMON_DIR=\"/usr/libexec\" -DHOSTS_ACCESS -DDAEMON_UMASK=022
-CPPFLAGS+=-DRFC931_TIMEOUT=10 -DALWAYS_HOSTNAME -DSYS_ERRLIST_DEFINED
-CPPFLAGS+=-DHOSTS_ALLOW=\"/etc/hosts.allow\" -DHOSTS_DENY=\"/etc/hosts.deny\"
-CPPFLAGS+=-DPROCESS_OPTIONS
+
+.include "${.CURDIR}/../../lib/libwrap/Makefile.cflags"
 
 .include <bsd.prog.mk>
Index: usr.sbin/tcpdchk/fakelog.c
===================================================================
RCS file: /cvs/NetBSD-1.3/usr.sbin/tcpdchk/fakelog.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 fakelog.c
--- usr.sbin/tcpdchk/fakelog.c	1998/12/24 07:03:31	1.1.1.1
+++ usr.sbin/tcpdchk/fakelog.c	1999/01/11 21:59:38
@@ -73,7 +73,6 @@
 #else
     va_start(ap, fmt);
 #endif
-    fmt = va_arg(ap, char *);
     vsyslog(severity, fmt, ap);
     va_end(ap);
 }
Index: usr.sbin/tcpdchk/tcpdchk.c
===================================================================
RCS file: /cvs/NetBSD-1.3/usr.sbin/tcpdchk/tcpdchk.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 tcpdchk.c
--- usr.sbin/tcpdchk/tcpdchk.c	1998/12/24 07:03:31	1.1.1.1
+++ usr.sbin/tcpdchk/tcpdchk.c	1999/01/13 02:49:59
@@ -54,6 +54,14 @@
 #include "inetcf.h"
 #include "scaffold.h"
 
+#ifdef NO_NETGRENT
+	/* SCO has no *netgrent() support */
+#else
+# ifdef NETGROUP
+#  include <netgroup.h>
+# endif
+#endif
+
  /*
   * Stolen from hosts_access.c...
   */
@@ -419,9 +427,9 @@
 	/* SCO has no *netgrent() support */
 #else
 #ifdef NETGROUP
-	char   *machinep;
-	char   *userp;
-	char   *domainp;
+	const char   *machinep;
+	const char   *userp;
+	const char   *domainp;
 
 	setnetgrent(pat + 1);
 	if (getnetgrent(&machinep, &userp, &domainp) == 0)
>Audit-Trail:
>Unformatted: