arpwatch/arpwatch.patch

Wed, 14 Jan 2009 15:59:12 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 14 Jan 2009 15:59:12 +0100
changeset 86
78e7deb1d6ab
permissions
-rw-r--r--

Correct and improve many buildconf and code logic blocks. In particular:
1. Document potential problems building with current binutils releases.
2. Document the flawed webkit and explain its temporary exclusion.
3. Document the edition of Qt which is built and installed.
4. Remove the Solaris x11_supdir logic as it is no longer found.
5. Correct several .pr[io] files including QMAKE_CXXFLAGS and INCPATH,
which previously caused preexisting Qt installations to deliver
erroneous old include and library logic instead of relying on
that of the currently building package. -I/opkg/include is now
placed at the end of the compile statements.
6. Don't trust the QMAKE_[INC|LIB]DIR_X11 identifiers in qmake.conf.
7. Allow more 64-bit builds and more properly identify the platform.
8. Place plugins (which are shared objects) in lib instead of share.
9. Build components as plugins when possible if with_shared is enabled.
10. Translate German text to English to be more consistent.
11. Instead of removing the pkgconfig directory of with_shared builds,
place it in a child directory useful for shared building.
12. Document the nonstandard shared build directory structure,
including using the hidden pkgconfig directory (PKG_CONFIG_PATH.)
13. Change %doc to specify files rather than directories in the RPM DB.

     1 Index: configure
     2 --- configure.orig	2006-06-21 22:32:38.000000000 +0200
     3 +++ configure	2006-10-20 15:30:45.862899000 +0200
     4 @@ -5259,11 +5259,7 @@
     5      echo "$as_me:$LINENO: result: $ac_cv_lbl_have_" >&5
     6  echo "${ECHO_T}$ac_cv_lbl_have_" >&6
     7      if test $ac_cv_lbl_have_ = no ; then
     8 -
     9 -cat >>confdefs.h <<\_ACEOF
    10 -#define
    11 -_ACEOF
    12 -
    13 +        :
    14      fi
    16  rm -f os-proto.h
    17 Index: Makefile.in
    18 --- Makefile.in.orig	2000-06-15 02:39:55.000000000 +0200
    19 +++ Makefile.in	2006-10-20 17:41:03.246914000 +0200
    20 @@ -31,7 +31,7 @@
    21  # Pathname of directory to install the man page
    22  MANDEST = @mandir@
    23  # Pathname of directory to install database file
    24 -ARPDIR = $(prefix)/arpwatch
    25 +ARPDIR = @localstatedir@
    27  # VPATH
    28  srcdir = @srcdir@
    29 @@ -42,16 +42,17 @@
    30  #
    32  CC = @CC@
    33 +CFLAGS = @CFLAGS@
    34 +CPPFLAGS = @CPPFLAGS@
    35 +
    36  PROG = arpwatch
    37  CCOPT = @V_CCOPT@
    38  INCLS = -I. @V_INCLS@
    39  DEFS = -DDEBUG @DEFS@ -DARPDIR=\"$(ARPDIR)\" -DPATH_SENDMAIL=\"$(SENDMAIL)\"
    41 -# Standard CFLAGS
    42 -CFLAGS = $(CCOPT) $(DEFS) $(INCLS)
    43 -
    44  # Standard LIBS
    45  LIBS = @LIBS@
    46 +LDFLAGS = @LDFLAGS@
    47  # Standard LIBS without libpcap.a
    48  SLIBS = @LBL_LIBS@
    50 @@ -63,7 +64,7 @@
    51  # problem if you don't own the file but can write to the directory.
    52  .c.o:
    53  	@rm -f $@
    54 -	$(CC) $(CFLAGS) -c $(srcdir)/$*.c
    55 +	$(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) -c $(srcdir)/$*.c
    57  CSRC =	db.c dns.c ec.c file.c intoa.c machdep.c util.c report.c setsignal.c
    58  WSRC =	arpwatch.c
    59 @@ -95,11 +96,11 @@
    61  arpwatch: $(WOBJ) @V_PCAPDEP@
    62  	@rm -f $@
    63 -	$(CC) $(CFLAGS) -o $@ $(WOBJ) $(LIBS)
    64 +	$(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) -o $@ $(WOBJ) $(LDFLAGS) $(LIBS)
    66  arpsnmp: $(SOBJ)
    67  	@rm -f $@
    68 -	$(CC) $(CFLAGS) -o $@ $(SOBJ) $(SLIBS)
    69 +	$(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) -o $@ $(SOBJ) $(LDFLAGS) $(SLIBS)
    71  version.o: version.c
    72  version.c: $(srcdir)/VERSION
    73 @@ -107,18 +108,22 @@
    74  	sed -e 's/.*/char version[] = "&";/' $(srcdir)/VERSION > $@
    76  zap: zap.o intoa.o
    77 -	$(CC) $(CFLAGS) -o $@ zap.o intoa.o -lutil
    78 +	$(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) -o $@ zap.o intoa.o $(LDFLAGS) -lutil
    80  install: force
    81 -	$(INSTALL) -m 555 -o bin -g bin arpwatch $(DESTDIR)$(BINDEST)
    82 -	$(INSTALL) -m 555 -o bin -g bin arpsnmp $(DESTDIR)$(BINDEST)
    83 +	$(INSTALL) -s -m 555 arpwatch $(DESTDIR)$(BINDEST)
    84 +	$(INSTALL) -s -m 555 arpsnmp $(DESTDIR)$(BINDEST)
    86  install-man: force
    87 -	$(INSTALL) -m 444 -o bin -g bin $(srcdir)/arpwatch.8 \
    88 +	$(INSTALL) -m 644 $(srcdir)/arpwatch.8 \
    89  	    $(DESTDIR)$(MANDEST)/man8
    90 -	$(INSTALL) -m 444 -o bin -g bin $(srcdir)/arpsnmp.8 \
    91 +	$(INSTALL) -m 644 $(srcdir)/arpsnmp.8 \
    92  	    $(DESTDIR)$(MANDEST)/man8
    94 +install-data: force
    95 +	$(INSTALL) -m 444 $(srcdir)/ethercodes.dat \
    96 +	    $(DESTDIR)$(ARPDIR)
    97 +
    98  lint:	$(GENSRC) force
    99  	lint -hbxn $(SRC) | \
   100  	    grep -v 'struct/union .* never defined' | \
   101 Index: arpwatch.8
   102 --- arpwatch.8.orig	2006-10-20 16:13:53.268590000 +0200
   103 +++ arpwatch.8	2006-10-20 16:15:01.537612000 +0200
   104 @@ -152,9 +152,8 @@
   105  .na
   106  .nh
   107  .nf
   108 -/usr/operator/arpwatch - default directory
   109 -arp.dat - ethernet/ip address database
   110 -ethercodes.dat - vendor ethernet block list
   111 +@l_prefix@/var/arpwatch/arp.dat - ethernet/ip address database
   112 +@l_prefix@/var/arpwatch/ethercodes.dat - vendor ethernet block list
   113  .ad
   114  .hy
   115  .fi
   116 Index: arpsnmp.8
   117 --- arpsnmp.8.orig	2006-10-20 16:14:50.412624000 +0200
   118 +++ arpsnmp.8	2006-10-20 16:14:59.301665000 +0200
   119 @@ -69,9 +69,8 @@
   120  .na
   121  .nh
   122  .nf
   123 -/usr/operator/arpwatch - default directory
   124 -arp.dat - ethernet/ip address database
   125 -ethercodes.dat - vendor ethernet block list
   126 +@l_prefix@/var/arpwatch/arp.dat - ethernet/ip address database
   127 +@l_prefix@/var/arpwatch/ethercodes.dat - vendor ethernet block list
   128  .ad
   129  .hy
   130  .fi
   131 Index: arpwatch.h
   132 --- arpwatch.h.orig	2000-10-01 01:40:55.000000000 +0200
   133 +++ arpwatch.h	2006-10-21 07:41:55.629111000 +0200
   134 @@ -8,6 +8,20 @@
   135  #define BCOPY(a, b, n) memmove((char *)b, (char *)a, n)
   136  #define MEMSET(s, c, n) memset((char *)s, c, n)
   138 +/* Repair unportable usage of u_int*_t declarations */
   139 +#ifndef u_int64_t
   140 +#define u_int64_t unsigned long long
   141 +#endif
   142 +#ifndef u_int32_t
   143 +#define u_int32_t unsigned int
   144 +#endif
   145 +#ifndef u_int16_t
   146 +#define u_int16_t unsigned short
   147 +#endif
   148 +#ifndef u_int6_t
   149 +#define u_int8_t unsigned char
   150 +#endif
   151 +
   152  char	*intoa(u_int32_t);
   154  #ifndef HAVE_BCOPY
   155 Index: arpwatch.c
   156 --- arpwatch.c.orig	2004-01-22 23:18:20.000000000 +0100
   157 +++ arpwatch.c	2006-10-20 19:28:25.417689000 +0200
   158 @@ -234,8 +234,11 @@
   159  			if (pid < 0) {
   160  				syslog(LOG_ERR, "main fork(): %m");
   161  				exit(1);
   162 -			} else if (pid != 0)
   163 +			} else if (pid != 0) {
   164 +				printf("%d\n", pid);
   165 +				fflush(stdout);
   166  				exit(0);
   167 +			}
   168  			(void)close(fileno(stdin));
   169  			(void)close(fileno(stdout));
   170  			(void)close(fileno(stderr));
   171 @@ -321,7 +324,6 @@
   173  	(void)setsignal(SIGINT, die);
   174  	(void)setsignal(SIGTERM, die);
   175 -	(void)setsignal(SIGHUP, die);
   176  	if (rfilename == NULL) {
   177  		(void)setsignal(SIGQUIT, checkpoint);
   178  		(void)setsignal(SIGALRM, checkpoint);
   179 Index: dns.c
   180 --- dns.c.orig	2006-10-20 19:06:40.704886000 +0200
   181 +++ dns.c	2006-10-20 19:20:09.611322000 +0200
   182 @@ -137,7 +137,7 @@
   183  	return (0);
   184  }
   186 -/* Return the cannonical name of the host */
   187 +/* Return the canonical name of the host (NULL if not found) */
   188  char *
   189  gethname(u_int32_t a)
   190  {
   191 @@ -150,18 +150,18 @@
   192  	hp = gethostbyaddr((char *)&a, sizeof(a), AF_INET);
   193  	_res.options = options;
   194  	if (hp == NULL)
   195 -		return (intoa(a));
   196 +		return NULL;
   197  	return (hp->h_name);
   198  }
   200 -/* Return the simple name of the host */
   201 +/* Return the simple name of the host (NULL if not found) */
   202  char *
   203  getsname(register u_int32_t a)
   204  {
   205  	register char *s, *cp;
   207  	s = gethname(a);
   208 -	if (!isdigit((int)*s)) {
   209 +	if (s != NULL) {
   210  		cp = strchr(s, '.');
   211  		if (cp != NULL)
   212  			*cp = '\0';

mercurial