1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/arpwatch/arpwatch.patch Fri Jan 09 19:02:45 2009 +0100 1.3 @@ -0,0 +1,212 @@ 1.4 +Index: configure 1.5 +--- configure.orig 2006-06-21 22:32:38.000000000 +0200 1.6 ++++ configure 2006-10-20 15:30:45.862899000 +0200 1.7 +@@ -5259,11 +5259,7 @@ 1.8 + echo "$as_me:$LINENO: result: $ac_cv_lbl_have_" >&5 1.9 + echo "${ECHO_T}$ac_cv_lbl_have_" >&6 1.10 + if test $ac_cv_lbl_have_ = no ; then 1.11 +- 1.12 +-cat >>confdefs.h <<\_ACEOF 1.13 +-#define 1.14 +-_ACEOF 1.15 +- 1.16 ++ : 1.17 + fi 1.18 + 1.19 + rm -f os-proto.h 1.20 +Index: Makefile.in 1.21 +--- Makefile.in.orig 2000-06-15 02:39:55.000000000 +0200 1.22 ++++ Makefile.in 2006-10-20 17:41:03.246914000 +0200 1.23 +@@ -31,7 +31,7 @@ 1.24 + # Pathname of directory to install the man page 1.25 + MANDEST = @mandir@ 1.26 + # Pathname of directory to install database file 1.27 +-ARPDIR = $(prefix)/arpwatch 1.28 ++ARPDIR = @localstatedir@ 1.29 + 1.30 + # VPATH 1.31 + srcdir = @srcdir@ 1.32 +@@ -42,16 +42,17 @@ 1.33 + # 1.34 + 1.35 + CC = @CC@ 1.36 ++CFLAGS = @CFLAGS@ 1.37 ++CPPFLAGS = @CPPFLAGS@ 1.38 ++ 1.39 + PROG = arpwatch 1.40 + CCOPT = @V_CCOPT@ 1.41 + INCLS = -I. @V_INCLS@ 1.42 + DEFS = -DDEBUG @DEFS@ -DARPDIR=\"$(ARPDIR)\" -DPATH_SENDMAIL=\"$(SENDMAIL)\" 1.43 + 1.44 +-# Standard CFLAGS 1.45 +-CFLAGS = $(CCOPT) $(DEFS) $(INCLS) 1.46 +- 1.47 + # Standard LIBS 1.48 + LIBS = @LIBS@ 1.49 ++LDFLAGS = @LDFLAGS@ 1.50 + # Standard LIBS without libpcap.a 1.51 + SLIBS = @LBL_LIBS@ 1.52 + 1.53 +@@ -63,7 +64,7 @@ 1.54 + # problem if you don't own the file but can write to the directory. 1.55 + .c.o: 1.56 + @rm -f $@ 1.57 +- $(CC) $(CFLAGS) -c $(srcdir)/$*.c 1.58 ++ $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) -c $(srcdir)/$*.c 1.59 + 1.60 + CSRC = db.c dns.c ec.c file.c intoa.c machdep.c util.c report.c setsignal.c 1.61 + WSRC = arpwatch.c 1.62 +@@ -95,11 +96,11 @@ 1.63 + 1.64 + arpwatch: $(WOBJ) @V_PCAPDEP@ 1.65 + @rm -f $@ 1.66 +- $(CC) $(CFLAGS) -o $@ $(WOBJ) $(LIBS) 1.67 ++ $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) -o $@ $(WOBJ) $(LDFLAGS) $(LIBS) 1.68 + 1.69 + arpsnmp: $(SOBJ) 1.70 + @rm -f $@ 1.71 +- $(CC) $(CFLAGS) -o $@ $(SOBJ) $(SLIBS) 1.72 ++ $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) -o $@ $(SOBJ) $(LDFLAGS) $(SLIBS) 1.73 + 1.74 + version.o: version.c 1.75 + version.c: $(srcdir)/VERSION 1.76 +@@ -107,18 +108,22 @@ 1.77 + sed -e 's/.*/char version[] = "&";/' $(srcdir)/VERSION > $@ 1.78 + 1.79 + zap: zap.o intoa.o 1.80 +- $(CC) $(CFLAGS) -o $@ zap.o intoa.o -lutil 1.81 ++ $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) -o $@ zap.o intoa.o $(LDFLAGS) -lutil 1.82 + 1.83 + install: force 1.84 +- $(INSTALL) -m 555 -o bin -g bin arpwatch $(DESTDIR)$(BINDEST) 1.85 +- $(INSTALL) -m 555 -o bin -g bin arpsnmp $(DESTDIR)$(BINDEST) 1.86 ++ $(INSTALL) -s -m 555 arpwatch $(DESTDIR)$(BINDEST) 1.87 ++ $(INSTALL) -s -m 555 arpsnmp $(DESTDIR)$(BINDEST) 1.88 + 1.89 + install-man: force 1.90 +- $(INSTALL) -m 444 -o bin -g bin $(srcdir)/arpwatch.8 \ 1.91 ++ $(INSTALL) -m 644 $(srcdir)/arpwatch.8 \ 1.92 + $(DESTDIR)$(MANDEST)/man8 1.93 +- $(INSTALL) -m 444 -o bin -g bin $(srcdir)/arpsnmp.8 \ 1.94 ++ $(INSTALL) -m 644 $(srcdir)/arpsnmp.8 \ 1.95 + $(DESTDIR)$(MANDEST)/man8 1.96 + 1.97 ++install-data: force 1.98 ++ $(INSTALL) -m 444 $(srcdir)/ethercodes.dat \ 1.99 ++ $(DESTDIR)$(ARPDIR) 1.100 ++ 1.101 + lint: $(GENSRC) force 1.102 + lint -hbxn $(SRC) | \ 1.103 + grep -v 'struct/union .* never defined' | \ 1.104 +Index: arpwatch.8 1.105 +--- arpwatch.8.orig 2006-10-20 16:13:53.268590000 +0200 1.106 ++++ arpwatch.8 2006-10-20 16:15:01.537612000 +0200 1.107 +@@ -152,9 +152,8 @@ 1.108 + .na 1.109 + .nh 1.110 + .nf 1.111 +-/usr/operator/arpwatch - default directory 1.112 +-arp.dat - ethernet/ip address database 1.113 +-ethercodes.dat - vendor ethernet block list 1.114 ++@l_prefix@/var/arpwatch/arp.dat - ethernet/ip address database 1.115 ++@l_prefix@/var/arpwatch/ethercodes.dat - vendor ethernet block list 1.116 + .ad 1.117 + .hy 1.118 + .fi 1.119 +Index: arpsnmp.8 1.120 +--- arpsnmp.8.orig 2006-10-20 16:14:50.412624000 +0200 1.121 ++++ arpsnmp.8 2006-10-20 16:14:59.301665000 +0200 1.122 +@@ -69,9 +69,8 @@ 1.123 + .na 1.124 + .nh 1.125 + .nf 1.126 +-/usr/operator/arpwatch - default directory 1.127 +-arp.dat - ethernet/ip address database 1.128 +-ethercodes.dat - vendor ethernet block list 1.129 ++@l_prefix@/var/arpwatch/arp.dat - ethernet/ip address database 1.130 ++@l_prefix@/var/arpwatch/ethercodes.dat - vendor ethernet block list 1.131 + .ad 1.132 + .hy 1.133 + .fi 1.134 +Index: arpwatch.h 1.135 +--- arpwatch.h.orig 2000-10-01 01:40:55.000000000 +0200 1.136 ++++ arpwatch.h 2006-10-21 07:41:55.629111000 +0200 1.137 +@@ -8,6 +8,20 @@ 1.138 + #define BCOPY(a, b, n) memmove((char *)b, (char *)a, n) 1.139 + #define MEMSET(s, c, n) memset((char *)s, c, n) 1.140 + 1.141 ++/* Repair unportable usage of u_int*_t declarations */ 1.142 ++#ifndef u_int64_t 1.143 ++#define u_int64_t unsigned long long 1.144 ++#endif 1.145 ++#ifndef u_int32_t 1.146 ++#define u_int32_t unsigned int 1.147 ++#endif 1.148 ++#ifndef u_int16_t 1.149 ++#define u_int16_t unsigned short 1.150 ++#endif 1.151 ++#ifndef u_int6_t 1.152 ++#define u_int8_t unsigned char 1.153 ++#endif 1.154 ++ 1.155 + char *intoa(u_int32_t); 1.156 + 1.157 + #ifndef HAVE_BCOPY 1.158 +Index: arpwatch.c 1.159 +--- arpwatch.c.orig 2004-01-22 23:18:20.000000000 +0100 1.160 ++++ arpwatch.c 2006-10-20 19:28:25.417689000 +0200 1.161 +@@ -234,8 +234,11 @@ 1.162 + if (pid < 0) { 1.163 + syslog(LOG_ERR, "main fork(): %m"); 1.164 + exit(1); 1.165 +- } else if (pid != 0) 1.166 ++ } else if (pid != 0) { 1.167 ++ printf("%d\n", pid); 1.168 ++ fflush(stdout); 1.169 + exit(0); 1.170 ++ } 1.171 + (void)close(fileno(stdin)); 1.172 + (void)close(fileno(stdout)); 1.173 + (void)close(fileno(stderr)); 1.174 +@@ -321,7 +324,6 @@ 1.175 + 1.176 + (void)setsignal(SIGINT, die); 1.177 + (void)setsignal(SIGTERM, die); 1.178 +- (void)setsignal(SIGHUP, die); 1.179 + if (rfilename == NULL) { 1.180 + (void)setsignal(SIGQUIT, checkpoint); 1.181 + (void)setsignal(SIGALRM, checkpoint); 1.182 +Index: dns.c 1.183 +--- dns.c.orig 2006-10-20 19:06:40.704886000 +0200 1.184 ++++ dns.c 2006-10-20 19:20:09.611322000 +0200 1.185 +@@ -137,7 +137,7 @@ 1.186 + return (0); 1.187 + } 1.188 + 1.189 +-/* Return the cannonical name of the host */ 1.190 ++/* Return the canonical name of the host (NULL if not found) */ 1.191 + char * 1.192 + gethname(u_int32_t a) 1.193 + { 1.194 +@@ -150,18 +150,18 @@ 1.195 + hp = gethostbyaddr((char *)&a, sizeof(a), AF_INET); 1.196 + _res.options = options; 1.197 + if (hp == NULL) 1.198 +- return (intoa(a)); 1.199 ++ return NULL; 1.200 + return (hp->h_name); 1.201 + } 1.202 + 1.203 +-/* Return the simple name of the host */ 1.204 ++/* Return the simple name of the host (NULL if not found) */ 1.205 + char * 1.206 + getsname(register u_int32_t a) 1.207 + { 1.208 + register char *s, *cp; 1.209 + 1.210 + s = gethname(a); 1.211 +- if (!isdigit((int)*s)) { 1.212 ++ if (s != NULL) { 1.213 + cp = strchr(s, '.'); 1.214 + if (cp != NULL) 1.215 + *cp = '\0';