Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Apr 2004 17:59:02 -0400 (EDT)
From:      Matthew George <mdg@secureworks.net>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/65508: [PATCH] net-mgmt/arpwatch: dns resolver bug
Message-ID:  <20040413175227.E33409@localhost>
Resent-Message-ID: <200404132200.i3DM0c6O077086@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         65508
>Category:       ports
>Synopsis:       [PATCH] net-mgmt/arpwatch: dns resolver bug
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Apr 13 15:00:38 PDT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Matthew George
>Release:        FreeBSD 5.2-CURRENT i386
>Organization:
SecureWorks
>Environment:
System: FreeBSD mdg.secureworks.net 5.2-CURRENT FreeBSD 5.2-CURRENT #2: Mon Mar 29 12:02:58 EST 2004 mdg@mdg.secureworks.net:/usr/obj/usr/src/sys/GENERIC i386


>Description:
	This fixes the same dns bug described in ports/65501, but it has
been made to apply cleanly to the non -devel arpwatch

>How-To-Repeat:

>Fix:

--- Makefile.orig	Tue Apr 13 17:50:47 2004
+++ Makefile	Tue Apr 13 17:51:11 2004
@@ -7,7 +7,7 @@

 PORTNAME=	arpwatch
 PORTVERSION=	2.1.a11
-PORTREVISION=	3
+PORTREVISION=	4
 CATEGORIES=	net-mgmt
 MASTER_SITES=	http://www.Awfulhak.org/arpwatch/ \
 		ftp://ftp.ee.lbl.gov/

--- patch-ah.orig	Tue Apr 13 17:47:35 2004
+++ patch-ah	Tue Apr 13 17:48:42 2004
@@ -1,5 +1,5 @@
---- report.c.orig	Sun Oct  1 00:41:10 2000
-+++ report.c	Thu May 16 11:34:33 2002
+--- report.c.orig	Sat Sep 30 19:41:10 2000
++++ report.c	Tue Apr 13 17:47:16 2004
 @@ -45,6 +45,8 @@

  #include <ctype.h>
@@ -27,6 +27,15 @@
  	char *watchee = WATCHEE;
  	char *sendmail = PATH_SENDMAIL;
  	char *unknown = "<unknown>";
+@@ -303,7 +307,7 @@
+ 	(void)fprintf(f, "From: %s\n", watchee);
+ 	(void)fprintf(f, "To: %s\n", watcher);
+ 	hn = gethname(a);
+-	if (!isdigit(*hn))
++	if (hn != NULL)
+ 		(void)fprintf(f, "Subject: %s (%s)\n", title, hn);
+ 	else {
+ 		(void)fprintf(f, "Subject: %s\n", title);
 @@ -344,6 +348,25 @@
  		exit(1);
  	}

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	patch-al
#	patch-am
#
echo x - patch-al
sed 's/^X//' >patch-al << 'END-of-patch-al'
X--- db.c.orig	Sat Sep 30 19:39:58 2000
X+++ db.c	Tue Apr 13 17:42:20 2004
X@@ -283,7 +283,7 @@
X 	BCOPY(e, ep->e, 6);
X 	if (h == NULL && !initializing)
X 		h = getsname(a);
X-	if (h != NULL && !isdigit((int)*h))
X+	if (h != NULL)
X 		strcpy(ep->h, h);
X 	ep->t = t;
X 	return (ep);
X@@ -301,7 +301,7 @@
X 		return;
X 	ep = ap->elist[0];
X 	h = getsname(ap->a);
X-	if (!isdigit((int)*h) && strcmp(h, ep->h) != 0) {
X+	if (h != NULL && strcmp(h, ep->h) != 0) {
X 		syslog(LOG_INFO, "hostname changed %s %s %s -> %s",
X 		    intoa(ap->a), e2str(ep->e), ep->h, h);
X 		strcpy(ep->h, h);
END-of-patch-al
echo x - patch-am
sed 's/^X//' >patch-am << 'END-of-patch-am'
X--- dns.c.orig	Fri Oct 13 21:50:52 2000
X+++ dns.c	Tue Apr 13 17:35:07 2004
X@@ -137,7 +137,7 @@
X 	return (0);
X }
X
X-/* Return the cannonical name of the host */
X+/* Return the canonical name of the host (NULL if not found) */
X char *
X gethname(u_int32_t a)
X {
X@@ -150,18 +150,18 @@
X 	hp = gethostbyaddr((char *)&a, sizeof(a), AF_INET);
X 	_res.options = options;
X 	if (hp == NULL)
X-		return (intoa(a));
X+		return NULL;
X 	return (hp->h_name);
X }
X
X-/* Return the simple name of the host */
X+/* Return the simple name of the host (NULL if not found) */
X char *
X getsname(register u_int32_t a)
X {
X 	register char *s, *cp;
X
X 	s = gethname(a);
X-	if (!isdigit((int)*s)) {
X+	if (s != NULL) {
X 		cp = strchr(s, '.');
X 		if (cp != NULL)
X 			*cp = '\0';
END-of-patch-am
exit


-- 
Matthew George
SecureWorks Technical Operations

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040413175227.E33409>