Update version, modernize packaging, accommodate libevent version 2 opaque

Tue, 28 Aug 2012 18:35:40 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 28 Aug 2012 18:35:40 +0200
changeset 575
6e491d7671a4
parent 574
1074e5934dd9
child 576
b3a1e74cc78b

Update version, modernize packaging, accommodate libevent version 2 opaque
evbuffer datatype, port Linux style flock(2) to SVR4, include correct
non BSD and non SVR4 headers in DNS and resolving logic, correctly
include a arc4random(3) implementation for platforms lacking it,
conditionally implement the nonstandard MIN(a,b) macro, and use
parallel make for faster SMP and multicore builds.

honeyd/honeyd.patch file | annotate | diff | comparison | revisions
honeyd/honeyd.spec file | annotate | diff | comparison | revisions
     1.1 --- a/honeyd/honeyd.patch	Tue Aug 28 18:35:30 2012 +0200
     1.2 +++ b/honeyd/honeyd.patch	Tue Aug 28 18:35:40 2012 +0200
     1.3 @@ -64,27 +64,6 @@
     1.4   /* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
     1.5   #undef HAVE_SYS_WAIT_H
     1.6   
     1.7 -Index: configure
     1.8 ---- configure.orig	2006-08-19 09:11:11 +0200
     1.9 -+++ configure	2006-08-24 12:14:21 +0200
    1.10 -@@ -22317,7 +22317,7 @@
    1.11 - 
    1.12 - 
    1.13 - 
    1.14 --for ac_header in stdarg.h errno.h fcntl.h paths.h stdlib.h string.h time.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h sys/ioccom.h sys/file.h syslog.h unistd.h assert.h
    1.15 -+for ac_header in stdarg.h errno.h fcntl.h paths.h stdlib.h string.h time.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h sys/ioccom.h sys/file.h syslog.h unistd.h assert.h sys/cdefs.h
    1.16 - do
    1.17 - as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
    1.18 - if eval "test \"\${$as_ac_Header+set}\" = set"; then
    1.19 -@@ -23483,7 +23483,7 @@
    1.20 - 
    1.21 - 
    1.22 - 
    1.23 --for ac_func in asprintf dup2 fgetln gettimeofday memmove memset strcasecmp strchr strdup strncasecmp strtoul strspn getaddrinfo getnameinfo freeaddrinfo setgroups sendmsg recvmsg setregid setruid kqueue
    1.24 -+for ac_func in asprintf dup2 fgetln gettimeofday memmove memset strcasecmp strchr strdup strncasecmp strtoul strspn getaddrinfo getnameinfo freeaddrinfo setgroups sendmsg recvmsg setregid setruid setenv kqueue
    1.25 - do
    1.26 - as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
    1.27 - echo "$as_me:$LINENO: checking for $ac_func" >&5
    1.28  Index: dhcpclient.c
    1.29  --- dhcpclient.c.orig	2006-08-19 09:10:41 +0200
    1.30  +++ dhcpclient.c	2006-08-24 12:14:21 +0200
     2.1 --- a/honeyd/honeyd.spec	Tue Aug 28 18:35:30 2012 +0200
     2.2 +++ b/honeyd/honeyd.spec	Tue Aug 28 18:35:40 2012 +0200
     2.3 @@ -22,7 +22,7 @@
     2.4  ##
     2.5  
     2.6  #   package version
     2.7 -%define       V_honeyd    1.5b
     2.8 +%define       V_honeyd    1.5c
     2.9  %define       V_libdnsres 0.1a
    2.10  
    2.11  #   package information
    2.12 @@ -36,7 +36,7 @@
    2.13  Group:        Security
    2.14  License:      BSD
    2.15  Version:      %{V_honeyd}
    2.16 -Release:      20080101
    2.17 +Release:      20120800
    2.18  
    2.19  #   package options
    2.20  %option       with_fsl  yes
    2.21 @@ -60,14 +60,13 @@
    2.22  Source14:     setenv.c
    2.23  Source15:     vasprintf.c
    2.24  Source16:     vasprintf.h
    2.25 -Source17:     http://www.monkey.org/~provos/libdnsres-%{V_libdnsres}.tar.gz
    2.26 +Source17:     evbuffer.h
    2.27 +Source18:     http://www.monkey.org/~provos/libdnsres-%{V_libdnsres}.tar.gz
    2.28  Patch0:       honeyd.patch
    2.29  
    2.30  #   build information
    2.31 -Prefix:       %{l_prefix}
    2.32 -BuildRoot:    %{l_buildroot}
    2.33 -BuildPreReq:  OpenPKG, openpkg >= 20060823, make
    2.34 -PreReq:       OpenPKG, openpkg >= 20060823
    2.35 +BuildPreReq:  OpenPKG, openpkg >= 20100808, make
    2.36 +PreReq:       OpenPKG, openpkg >= 20100808
    2.37  BuildPreReq:  libdnet, libpcap, libevent, libedit, zlib, pcre
    2.38  PreReq:       libdnet, libpcap, libevent, libedit, zlib, pcre
    2.39  %if "%{with_fsl}" == "yes"
    2.40 @@ -77,8 +76,6 @@
    2.41  %if "%{with_gui}" == "yes"
    2.42  PreReq:       java, JAVA-JDK
    2.43  %endif
    2.44 -AutoReq:      no
    2.45 -AutoReqProv:  no
    2.46  
    2.47  %description
    2.48      Honeyd is a small daemon that creates virtual hosts on a network.
    2.49 @@ -107,24 +104,42 @@
    2.50  
    2.51  %prep
    2.52      %setup -q
    2.53 -    %setup -q -D -T -a 17
    2.54 +    %setup -q -D -T -a 18
    2.55      %patch -p0
    2.56 +    cp -f %{SOURCE setenv.c} .
    2.57 +    cp -f %{SOURCE setenv.h} .
    2.58 +    cp -f %{SOURCE vasprintf.c} .
    2.59 +    cp -f %{SOURCE vasprintf.h} .
    2.60 +    cp -f %{SOURCE evbuffer.h} .
    2.61 +    cp -f %{SOURCE cdefs.h} .
    2.62 +    %{l_shtool} mkdir -f -p -m 755 libdnsres-%{V_libdnsres}/sys
    2.63 +    cp -f %{SOURCE cdefs.h} libdnsres-%{V_libdnsres}/sys/
    2.64      %{l_shtool} subst \
    2.65          -e 's;AF_LOCAL;AF_UNIX;' \
    2.66          *.c
    2.67      %{l_shtool} subst \
    2.68 +        -e 's;\(for ac_header in stdarg.h errno.h fcntl.h paths.h stdlib.h string.h time.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h sys/ioccom.h sys/file.h net/bpf.h syslog.h unistd.h assert.h\);\1 sys/cdefs.h;' \
    2.69 +        -e 's;\(for ac_func in asprintf dup2 fgetln gettimeofday memmove memset strcasecmp strchr strdup strncasecmp strtoul strspn getaddrinfo getnameinfo freeaddrinfo setgroups sendmsg recvmsg setregid setruid\) \(kqueue\);\1 setenv \2;' \
    2.70 +        configure
    2.71 +    %{l_shtool} subst \
    2.72          -e 's;^\(honeyd_SOURCES *=[^\\]*\);\1 setenv.c vasprintf.c;' \
    2.73          -e 's;^\(honeyd_OBJECTS *=[^\\]*\);\1 setenv.o vasprintf.o ;' \
    2.74          Makefile.in
    2.75 -    cp -f %{SOURCE setenv.c} .
    2.76 -    cp -f %{SOURCE setenv.h} .
    2.77 -    cp -f %{SOURCE vasprintf.c} .
    2.78 -    cp -f %{SOURCE vasprintf.h} .
    2.79 -    cp -f %{SOURCE cdefs.h} .
    2.80      %{l_shtool} subst \
    2.81          -e 's;/var/run/honeyd.pid;%{l_prefix}/var/honeyd/honeyd.pid;' \
    2.82          honeyd.h
    2.83      %{l_shtool} subst \
    2.84 +        -e 's;\(encode_int\);loc_\1;g' \
    2.85 +        tagging.[ch]
    2.86 +    %{l_shtool} subst \
    2.87 +        -e '/#include <event.h>/a#include "evbuffer.h"' \
    2.88 +        honeydstats.c \
    2.89 +        untagging.c \
    2.90 +        ui.c
    2.91 +    %{l_shtool} subst \
    2.92 +        -e 's;flock(fd, [^)][^)]*);lockf(fd, F_LOCK, 0);g' \
    2.93 +        subsystems/smtp.c
    2.94 +    %{l_shtool} subst \
    2.95          -e 's/\(user_target=no\)/\1; pic_mode=no;/' \
    2.96          -e 's;test "*$\(hardcode_into_libs\)"* *\([!=]*\) *"*\([a-zA-Z_][a-zA-Z_]*\)"*;test ".$\1" \2 ".$\3";g' \
    2.97          -e 's;test "*$\(build_libtool_need_lc\)"* *\([!=]*\) *"*\([a-zA-Z_][a-zA-Z_]*\)"*;test ".$\1" \2 ".$\3";g' \
    2.98 @@ -137,19 +152,47 @@
    2.99              %{l_shtool} subst \
   2.100                  -e 's;\(\$(honeydctl_LDADD)\);\1 -lsocket -lnsl;g' \
   2.101                  Makefile.in
   2.102 +            %{l_shtool} subst \
   2.103 +                -e 's;-lsocket;-lsocket -lnsl -lresolv;g' \
   2.104 +                libdnsres-%{V_libdnsres}/configure
   2.105              ;;
   2.106      esac
   2.107 +    %{l_shtool} subst \
   2.108 +        -e 's;#if \((!defined(BSD))\) || \((BSD < [0-9][0-9]*)\);#if (!defined(__sun)) \&\& (!defined(__SVR4)) \&\& \1 \&\& \2;' \
   2.109 +        libdnsres-%{V_libdnsres}/dnsres.h \
   2.110 +        libdnsres-%{V_libdnsres}/resolv.h
   2.111 +    %{l_shtool} subst \
   2.112 +        -e 's;u_int\([0-9]*\)_t;uint\1_t;g' \
   2.113 +        libdnsres-%{V_libdnsres}/dnsres.h \
   2.114 +        libdnsres-%{V_libdnsres}/resolv.h \
   2.115 +        libdnsres-%{V_libdnsres}/res_random.c
   2.116 +    %{l_shtool} subst \
   2.117 +        -e 's;top_buildir;top_builddir;' \
   2.118 +        -e 's;\(am_simple_test_OBJECTS = simple_test\.\$(OBJEXT)\);\1 arc4random.$(OBJEXT);' \
   2.119 +        libdnsres-%{V_libdnsres}/Makefile.in
   2.120 +    %{l_shtool} subst \
   2.121 +        -e '/#include "config.h"/a#ifndef HAVE_ARC4RANDOM' \
   2.122 +        libdnsres-%{V_libdnsres}/arc4random.c
   2.123 +    echo '#endif' >>libdnsres-%{V_libdnsres}/arc4random.c
   2.124 +    echo '#ifndef MIN' >>keycount.h
   2.125 +    echo '#define MIN(a,b) (((a) < (b)) ? (a) : (b))' >>keycount.h
   2.126 +    echo '#endif' >>keycount.h
   2.127  
   2.128  %build
   2.129      ( cd libdnsres-%{V_libdnsres}
   2.130 +      loc_cppflags=
   2.131 +      case "%{l_platform -t}" in
   2.132 +          *-sunos* )
   2.133 +              loc_cppflags="-D_KERNEL"
   2.134 +              ;;
   2.135 +      esac
   2.136        CC="%{l_cc}" \
   2.137        CFLAGS="%{l_cflags -O}" \
   2.138 -      CPPFLAGS="%{l_cppflags}" \
   2.139 +      CPPFLAGS="%{l_cppflags} $loc_cppflags" \
   2.140        ./configure \
   2.141            --with-libevent=%{l_prefix} \
   2.142            --disable-shared
   2.143        %{l_make} %{l_mflags}
   2.144 -      ln .libs/libdnsres.a .
   2.145      ) || exit $?
   2.146      CC="%{l_cc}" \
   2.147      CFLAGS="%{l_cflags -O}" \
   2.148 @@ -163,11 +206,9 @@
   2.149          --with-libdnsres=`pwd`/libdnsres-%{V_libdnsres} \
   2.150          --with-libpcre=%{l_prefix} \
   2.151          --without-python
   2.152 -    %{l_make} %{l_mflags}
   2.153 +    %{l_make} %{l_mflags -O}
   2.154  
   2.155  %install
   2.156 -    rm -rf $RPM_BUILD_ROOT
   2.157 -
   2.158      #   create directories
   2.159      %{l_shtool} mkdir -f -p -m 755 \
   2.160          $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
   2.161 @@ -232,7 +273,6 @@
   2.162  %files -f files
   2.163  
   2.164  %clean
   2.165 -    rm -rf $RPM_BUILD_ROOT
   2.166  
   2.167  %pre
   2.168      #   before upgrade, save status and stop service

mercurial