Import package vendor original specs for necessary manipulations.

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

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

Import package vendor original specs for necessary manipulations.

honeyd/cdefs.h file | annotate | diff | comparison | revisions
honeyd/evbuffer.h file | annotate | diff | comparison | revisions
honeyd/fsl.honeyd file | annotate | diff | comparison | revisions
honeyd/honey file | annotate | diff | comparison | revisions
honeyd/honeyd.conf file | annotate | diff | comparison | revisions
honeyd/honeyd.patch file | annotate | diff | comparison | revisions
honeyd/honeyd.spec file | annotate | diff | comparison | revisions
honeyd/rc.honeyd file | annotate | diff | comparison | revisions
honeyd/setenv.c file | annotate | diff | comparison | revisions
honeyd/setenv.h file | annotate | diff | comparison | revisions
honeyd/svcs.sh file | annotate | diff | comparison | revisions
honeyd/vasprintf.c file | annotate | diff | comparison | revisions
honeyd/vasprintf.h file | annotate | diff | comparison | revisions
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/honeyd/cdefs.h	Tue Aug 28 18:35:30 2012 +0200
     1.3 @@ -0,0 +1,139 @@
     1.4 +/*
     1.5 +** cdefs.h: ISO C interface
     1.6 +** Most of this file was developed by Sendmail, Incorporated, so:
     1.7 +**
     1.8 +** Copyright (c) 2000-2002 Sendmail, Inc. and its suppliers.
     1.9 +**
    1.10 +** Permission to use, copy, modify, and distribute this software for
    1.11 +** any purpose with or without fee is hereby granted, provided that
    1.12 +** the above copyright notice and this permission notice appear in all
    1.13 +** copies.
    1.14 +**
    1.15 +** THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    1.16 +** WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    1.17 +** MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    1.18 +** IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    1.19 +** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    1.20 +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    1.21 +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    1.22 +** USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    1.23 +** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    1.24 +** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    1.25 +** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    1.26 +** SUCH DAMAGE.
    1.27 +**
    1.28 +*/
    1.29 +
    1.30 +/*
    1.31 +**  BSD and Linux already have <sys/cdefs.h> which defines a set of C
    1.32 +**  language portability macros that are a defacto standard in the open
    1.33 +**  source community. This file allows for building on platforms lacking
    1.34 +**  these definitions.
    1.35 +*/
    1.36 +#ifndef HOND_CDEFS_H
    1.37 +# define HOND_CDEFS_H
    1.38 +
    1.39 +# if defined(__cplusplus)
    1.40 +#  define    __BEGIN_DECLS    extern "C" {
    1.41 +#  define    __END_DECLS    };
    1.42 +# else /* defined(__cplusplus) */
    1.43 +#  define    __BEGIN_DECLS
    1.44 +#  define    __END_DECLS
    1.45 +# endif /* defined(__cplusplus) */
    1.46 +# if defined(__STDC__) || defined(__cplusplus)
    1.47 +#  ifndef __P
    1.48 +#   define    __P(protos)    protos
    1.49 +#  endif /* __P */
    1.50 +#  define    __CONCAT(x,y)    x ## y
    1.51 +#  define    __STRING(x)    #x
    1.52 +# else /* defined(__STDC__) || defined(__cplusplus) */
    1.53 +#  define    __P(protos)    ()
    1.54 +#  define    __CONCAT(x,y)    x/**/y
    1.55 +#  define    __STRING(x)    "x"
    1.56 +#  define    const
    1.57 +#  define    signed
    1.58 +#  define    volatile
    1.59 +# endif /* defined(__STDC__) || defined(__cplusplus) */
    1.60 +
    1.61 +/*
    1.62 +**  Define HOND_DEAD, a macro used to declare functions that do not return
    1.63 +**  to their caller.
    1.64 +*/
    1.65 +# ifndef HOND_DEAD
    1.66 +#  if __GNUC__ >= 2
    1.67 +#   if __GNUC__ == 2 && __GNUC_MINOR__ < 5
    1.68 +#    define HOND_DEAD(proto) volatile proto
    1.69 +#   else /* __GNUC__ == 2 && __GNUC_MINOR__ < 5 */
    1.70 +#    define HOND_DEAD(proto) proto __attribute__((__noreturn__))
    1.71 +#   endif /* __GNUC__ == 2 && __GNUC_MINOR__ < 5 */
    1.72 +#  else /* __GNUC__ >= 2 */
    1.73 +#   define HOND_DEAD(proto) proto
    1.74 +#  endif /* __GNUC__ >= 2 */
    1.75 +# endif /* HOND_DEAD */
    1.76 +
    1.77 +/*
    1.78 +**  Define HOND_UNUSED, a macro used to declare variables that may be unused.
    1.79 +*/
    1.80 +# ifndef HOND_UNUSED
    1.81 +#  if __GNUC__ >= 2
    1.82 +#   if __GNUC__ == 2 && __GNUC_MINOR__ < 7
    1.83 +#    define HOND_UNUSED(decl) decl
    1.84 +#   else /* __GNUC__ == 2 && __GNUC_MINOR__ < 7 */
    1.85 +#    define HOND_UNUSED(decl) decl __attribute__((__unused__))
    1.86 +#   endif /* __GNUC__ == 2 && __GNUC_MINOR__ < 7 */
    1.87 +#  else /* __GNUC__ >= 2 */
    1.88 +#   define HOND_UNUSED(decl) decl
    1.89 +#  endif /* __GNUC__ >= 2 */
    1.90 +# endif /* HOND_UNUSED */
    1.91 +
    1.92 +/*
    1.93 +**  The HOND_NONVOLATILE macro is used to declare variables that are not
    1.94 +**  volatile, but which must be declared volatile when compiling with
    1.95 +**  gcc -O -Wall in order to suppress bogus warning messages.
    1.96 +**
    1.97 +**  Variables that actually are volatile should be declared volatile
    1.98 +**  using the "volatile" keyword.  If a variable actually is volatile,
    1.99 +**  then HOND_NONVOLATILE should not be used.
   1.100 +**
   1.101 +**  To compile source code with gcc and see all non-bogus warnings use:
   1.102 +**
   1.103 +**      gcc -O -Wall -DHOND_OMIT_BOGUS_WARNINGS ...
   1.104 +**
   1.105 +**  Do not use -DHOND_OMIT_BOGUS_WARNINGS when compiling production
   1.106 +**  software, because there is a performance hit.
   1.107 +*/
   1.108 +# ifdef HOND_OMIT_BOGUS_WARNINGS
   1.109 +#  define HOND_NONVOLATILE volatile
   1.110 +# else /* HOND_OMIT_BOGUS_WARNINGS */
   1.111 +#  define HOND_NONVOLATILE
   1.112 +# endif /* HOND_OMIT_BOGUS_WARNINGS */
   1.113 +
   1.114 +/*
   1.115 +**  Turn on format string argument checking.
   1.116 +*/
   1.117 +# ifndef HOND_CONF_FORMAT_TEST
   1.118 +#  if __GNUC__ == 2 && __GNUC_MINOR__ >= 7
   1.119 +#   define HOND_CONF_FORMAT_TEST    1
   1.120 +#  else /* __GNUC__ == 2 && __GNUC_MINOR__ >= 7 */
   1.121 +#   define HOND_CONF_FORMAT_TEST    0
   1.122 +#  endif /* __GNUC__ == 2 && __GNUC_MINOR__ >= 7 */
   1.123 +# endif /* HOND_CONF_FORMAT_TEST */
   1.124 +
   1.125 +# ifndef PRINTFLIKE
   1.126 +#  if HOND_CONF_FORMAT_TEST
   1.127 +#   define PRINTFLIKE(x,y) __attribute__ ((__format__ (__printf__, x, y)))
   1.128 +#  else /* HOND_CONF_FORMAT_TEST */
   1.129 +#   define PRINTFLIKE(x,y)
   1.130 +#  endif /* HOND_CONF_FORMAT_TEST */
   1.131 +# endif /* ! PRINTFLIKE */
   1.132 +
   1.133 +# ifndef SCANFLIKE
   1.134 +#  if HOND_CONF_FORMAT_TEST
   1.135 +#   define SCANFLIKE(x,y) __attribute__ ((__format__ (__scanf__, x, y)))
   1.136 +#  else /* HOND_CONF_FORMAT_TEST */
   1.137 +#   define SCANFLIKE(x,y)
   1.138 +#  endif /* HOND_CONF_FORMAT_TEST */
   1.139 +# endif /* ! SCANFLIKE */
   1.140 +
   1.141 +#endif /* ! HOND_CDEFS_H */
   1.142 +
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/honeyd/evbuffer.h	Tue Aug 28 18:35:30 2012 +0200
     2.3 @@ -0,0 +1,11 @@
     2.4 +struct evbuffer {
     2.5 +    u_char *buffer;
     2.6 +    u_char *orig_buffer;
     2.7 +
     2.8 +    size_t misalign;
     2.9 +    size_t totallen;
    2.10 +    size_t off;
    2.11 +
    2.12 +    void (*cb)(struct evbuffer *, size_t, size_t, void *);
    2.13 +    void *cbarg;
    2.14 +};
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/honeyd/fsl.honeyd	Tue Aug 28 18:35:30 2012 +0200
     3.3 @@ -0,0 +1,16 @@
     3.4 +##
     3.5 +##  fsl.honeyd -- OSSP fsl configuration
     3.6 +##
     3.7 +
     3.8 +ident (honeyd)/.+ q{
     3.9 +    prefix(
    3.10 +        prefix="%b %d %H:%M:%S %N <%L> $1[%P]: "
    3.11 +    )
    3.12 +    -> {
    3.13 +        debug: file(
    3.14 +            path="@l_prefix@/var/honeyd/honeyd.log",
    3.15 +            perm=0644
    3.16 +        )
    3.17 +    }
    3.18 +};
    3.19 +
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/honeyd/honey	Tue Aug 28 18:35:30 2012 +0200
     4.3 @@ -0,0 +1,7 @@
     4.4 +#!/bin/sh
     4.5 +##
     4.6 +##  honey -- Java GUI launcher
     4.7 +##
     4.8 +
     4.9 +@l_prefix@/bin/java -Vsun-jdk -cp @l_prefix@/lib/honeyd/javagui HostFrame
    4.10 +
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/honeyd/honeyd.conf	Tue Aug 28 18:35:30 2012 +0200
     5.3 @@ -0,0 +1,62 @@
     5.4 +##
     5.5 +##  honeyd.conf
     5.6 +##
     5.7 +
     5.8 +#   Linux 2.4.x host definition
     5.9 +create linuxhost
    5.10 +set linuxhost personality  "Linux Kernel 2.4.0 - 2.4.18 (X86)"
    5.11 +add linuxhost tcp port 21  "@l_prefix@/libexec/honeyd/ftp.sh"
    5.12 +add linuxhost tcp port 25  "@l_prefix@/libexec/honeyd/smtp.sh"
    5.13 +add linuxhost tcp port 110 "@l_prefix@/libexec/honeyd/pop3.sh"
    5.14 +add linuxhost tcp port 22  "@l_prefix@/libexec/honeyd/svcs.sh ssh"
    5.15 +add linuxhost tcp port 80  "@l_prefix@/libexec/honeyd/svcs.sh http"
    5.16 +add linuxhost tcp port 53  open
    5.17 +add linuxhost udp port 53  open
    5.18 +add linuxhost tcp port 69  open
    5.19 +add linuxhost udp port 69  open
    5.20 +add linuxhost tcp port 554 open
    5.21 +add linuxhost udp port 554 open
    5.22 +add linuxhost tcp port 23  proxy $ipsrc:23
    5.23 +set linuxhost default tcp  action reset
    5.24 +set linuxhost default udp  action reset
    5.25 +set linuxhost uptime 2655300
    5.26 +set linuxhost uid @l_muid@ gid @l_mgid@
    5.27 +
    5.28 +#   AIX 4.X host definition
    5.29 +create unixhost
    5.30 +set unixhost personality  "AIX 4.0 - 4.2"
    5.31 +add unixhost tcp port 21  "@l_prefix@/libexec/honeyd/ftp.sh"
    5.32 +add unixhost tcp port 25  "@l_prefix@/libexec/honeyd/smtp.sh"
    5.33 +add unixhost tcp port 110 "@l_prefix@/libexec/honeyd/pop3.sh"
    5.34 +add unixhost tcp port 22  "@l_prefix@/libexec/honeyd/svcs.sh ssh"
    5.35 +add unixhost tcp port 80  "@l_prefix@/libexec/honeyd/svcs.sh http"
    5.36 +add unixhost tcp port 53  open
    5.37 +add unixhost udp port 53  open
    5.38 +add unixhost tcp port 111 open
    5.39 +add unixhost udp port 111 open
    5.40 +add unixhost tcp port 123 open
    5.41 +add unixhost udp port 123 open
    5.42 +add unixhost tcp port 23  proxy $ipsrc:23
    5.43 +set unixhost default tcp  action reset
    5.44 +set unixhost default udp  action reset
    5.45 +set unixhost uptime 3284460
    5.46 +set unixhost uid @l_muid@ gid @l_mgid@
    5.47 +
    5.48 +#   Windows NT 4.0 host definition
    5.49 +create winhost
    5.50 +set winhost personality  "Windows NT 4.0 Server SP5-SP6"
    5.51 +add winhost tcp port 21  "@l_prefix@/libexec/honeyd/ftp.sh"
    5.52 +add winhost tcp port 25  "@l_prefix@/libexec/honeyd/smtp.sh"
    5.53 +add winhost tcp port 110 "@l_prefix@/libexec/honeyd/pop3.sh"
    5.54 +add winhost tcp port 137 open
    5.55 +add winhost udp port 137 open
    5.56 +set winhost default tcp  action reset
    5.57 +set winhost default udp  action reset
    5.58 +set winhost uptime 663825
    5.59 +set winhost uid @l_muid@ gid @l_mgid@
    5.60 +
    5.61 +#   Bind hosts
    5.62 +bind 192.168.100.201 linuxhost
    5.63 +bind 192.168.100.202 unixhost
    5.64 +bind 192.168.100.203 winhost
    5.65 +
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/honeyd/honeyd.patch	Tue Aug 28 18:35:30 2012 +0200
     6.3 @@ -0,0 +1,213 @@
     6.4 +Index: command.c
     6.5 +--- command.c.orig	2006-08-19 09:10:40 +0200
     6.6 ++++ command.c	2006-08-24 12:14:21 +0200
     6.7 +@@ -72,6 +72,9 @@
     6.8 + #include "pyextend.h"
     6.9 + #include "honeyd_overload.h"
    6.10 + #include "util.h"
    6.11 ++#ifndef HAVE_SETENV
    6.12 ++#include "setenv.h"
    6.13 ++#endif
    6.14 + 
    6.15 + ssize_t atomicio(ssize_t (*)(), int, void *, size_t);
    6.16 + 
    6.17 +Index: compat/getopt.h
    6.18 +--- compat/getopt.h.orig	2006-08-19 09:10:40 +0200
    6.19 ++++ compat/getopt.h	2006-08-24 12:14:21 +0200
    6.20 +@@ -40,7 +40,11 @@
    6.21 + #ifndef _GETOPT_H_
    6.22 + #define _GETOPT_H_
    6.23 + 
    6.24 ++#ifdef HAVE_SYS_CDEFS_H
    6.25 + #include <sys/cdefs.h>
    6.26 ++#else
    6.27 ++#include "cdefs.h"
    6.28 ++#endif
    6.29 + 
    6.30 + /*
    6.31 +  * GNU-like getopt_long() and 4.4BSD getsubopt()/optreset extensions
    6.32 +Index: compat/sha1.h
    6.33 +--- compat/sha1.h.orig	2006-08-19 09:10:40 +0200
    6.34 ++++ compat/sha1.h	2006-08-24 12:14:21 +0200
    6.35 +@@ -15,7 +15,11 @@
    6.36 +     unsigned char buffer[64];
    6.37 + } SHA1_CTX;
    6.38 + 
    6.39 ++#ifdef HAVE_SYS_CDEFS_H
    6.40 + #include <sys/cdefs.h>
    6.41 ++#else
    6.42 ++#include "cdefs.h"
    6.43 ++#endif
    6.44 + 
    6.45 + __BEGIN_DECLS
    6.46 + void SHA1Transform(u_int32_t [5], const unsigned char [64])
    6.47 +Index: config.h.in
    6.48 +--- config.h.in.orig	2006-01-17 18:11:44 +0100
    6.49 ++++ config.h.in	2006-08-24 12:14:21 +0200
    6.50 +@@ -222,6 +222,9 @@
    6.51 + /* Define to 1 if you have the `strtoul' function. */
    6.52 + #undef HAVE_STRTOUL
    6.53 + 
    6.54 ++/* Define to 1 if you have the `setenv' function. */
    6.55 ++#undef HAVE_SETENV
    6.56 ++
    6.57 + /* Define if your system defines struct sockaddr_storage */
    6.58 + #undef HAVE_STRUCT_SOCKADDR_STORAGE
    6.59 + 
    6.60 +@@ -255,6 +258,9 @@
    6.61 + /* Define to 1 if you have the <sys/types.h> header file. */
    6.62 + #undef HAVE_SYS_TYPES_H
    6.63 + 
    6.64 ++/* Define to 1 if you have the <sys/cdefs.h> header file. */
    6.65 ++#undef HAVE_SYS_CDEFS_H
    6.66 ++
    6.67 + /* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
    6.68 + #undef HAVE_SYS_WAIT_H
    6.69 + 
    6.70 +Index: configure
    6.71 +--- configure.orig	2006-08-19 09:11:11 +0200
    6.72 ++++ configure	2006-08-24 12:14:21 +0200
    6.73 +@@ -22317,7 +22317,7 @@
    6.74 + 
    6.75 + 
    6.76 + 
    6.77 +-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
    6.78 ++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
    6.79 + do
    6.80 + as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
    6.81 + if eval "test \"\${$as_ac_Header+set}\" = set"; then
    6.82 +@@ -23483,7 +23483,7 @@
    6.83 + 
    6.84 + 
    6.85 + 
    6.86 +-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
    6.87 ++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
    6.88 + do
    6.89 + as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
    6.90 + echo "$as_me:$LINENO: checking for $ac_func" >&5
    6.91 +Index: dhcpclient.c
    6.92 +--- dhcpclient.c.orig	2006-08-19 09:10:41 +0200
    6.93 ++++ dhcpclient.c	2006-08-24 12:14:21 +0200
    6.94 +@@ -94,6 +94,13 @@
    6.95 + 
    6.96 + #define NTRIES 10
    6.97 + 
    6.98 ++#ifndef MIN
    6.99 ++# define MIN(a,b)	(((a) < (b)) ? (a) : (b))
   6.100 ++#endif /* MIN */
   6.101 ++#ifndef MAX
   6.102 ++# define MAX(a,b)	(((a) > (b)) ? (a) : (b))
   6.103 ++#endif /* MAX */
   6.104 ++
   6.105 + static int  _pack_request(struct dhcpclient_req *, void *, size_t *);
   6.106 + static int  _pack_release(struct dhcpclient_req *, void *, size_t *);
   6.107 + static int  _bcast(struct template *,
   6.108 +Index: honeyd.c
   6.109 +--- honeyd.c.orig	2006-08-19 09:14:36 +0200
   6.110 ++++ honeyd.c	2006-08-24 12:14:21 +0200
   6.111 +@@ -101,6 +101,9 @@
   6.112 + #include "histogram.h"
   6.113 + #include "update.h"
   6.114 + #include "util.h"
   6.115 ++#ifndef HAVE_SETENV
   6.116 ++#include "setenv.h"
   6.117 ++#endif
   6.118 + 
   6.119 + #ifdef HAVE_PYTHON
   6.120 + #include <Python.h>
   6.121 +Index: honeyd_overload.c
   6.122 +--- honeyd_overload.c.orig	2006-08-19 09:10:41 +0200
   6.123 ++++ honeyd_overload.c	2006-08-24 12:14:21 +0200
   6.124 +@@ -295,7 +295,7 @@
   6.125 + 	struct fd *nfd;
   6.126 + 	int pair[2];
   6.127 + 
   6.128 +-	if (socketpair(AF_LOCAL, type, 0, pair) == -1) {
   6.129 ++	if (socketpair(AF_UNIX, type, 0, pair) == -1) {
   6.130 + 		warn("%s: socketpair", __func__);
   6.131 + 		return (NULL);
   6.132 + 	}
   6.133 +@@ -625,7 +625,7 @@
   6.134 + 	}
   6.135 + 
   6.136 + 	/* Get another socketpair */
   6.137 +-	if (socketpair(AF_LOCAL, SOCK_STREAM, 0, pair) == -1) {
   6.138 ++	if (socketpair(AF_UNIX, SOCK_STREAM, 0, pair) == -1) {
   6.139 + 		DPRINTF((stderr, "%s: socketpair failed", __func__));
   6.140 + 		errno = ETIMEDOUT; /* XXX */
   6.141 + 		return (-1);
   6.142 +@@ -732,6 +732,7 @@
   6.143 + }
   6.144 + #endif /* !__FreeBSD__ */
   6.145 + 
   6.146 ++#ifndef sun
   6.147 + ssize_t
   6.148 + recvfrom(int sock, void *buf, size_t len, int flags, struct sockaddr *from,
   6.149 +     socklen_t *fromlen)
   6.150 +@@ -759,6 +760,7 @@
   6.151 +  out:
   6.152 + 	return (ret);
   6.153 + }
   6.154 ++#endif /* !sun */
   6.155 + 
   6.156 + ssize_t
   6.157 + sendto(int sock, const void *buf, size_t len, int flags,
   6.158 +@@ -795,6 +797,7 @@
   6.159 + 	return (ret);
   6.160 + }
   6.161 + 
   6.162 ++#ifndef sun
   6.163 + int
   6.164 + getsockname(int sock, struct sockaddr *to, socklen_t *tolen)
   6.165 + {
   6.166 +@@ -832,6 +835,7 @@
   6.167 + 
   6.168 + 	return (0);
   6.169 + }
   6.170 ++#endif /* !sun */
   6.171 + 
   6.172 + ssize_t
   6.173 + recvmsg(int sock, struct msghdr *msg, int flags)
   6.174 +@@ -1120,6 +1124,7 @@
   6.175 + 	return (ret);
   6.176 + }
   6.177 + 
   6.178 ++#ifndef sun
   6.179 + int
   6.180 + accept(int sock, struct sockaddr *addr, socklen_t *addrlen)
   6.181 + {
   6.182 +@@ -1169,6 +1174,7 @@
   6.183 + 
   6.184 + 	return (fd);
   6.185 + }
   6.186 ++#endif /* !sun */
   6.187 + 
   6.188 + #if 0
   6.189 + 
   6.190 +Index: personality.c
   6.191 +--- personality.c.orig	2006-08-19 09:10:40 +0200
   6.192 ++++ personality.c	2006-08-24 12:14:21 +0200
   6.193 +@@ -32,6 +32,9 @@
   6.194 + 
   6.195 + #include <sys/param.h>
   6.196 + #include <sys/types.h>
   6.197 ++#ifndef UINT_MAX
   6.198 ++#define UINT_MAX    4294967295U
   6.199 ++#endif
   6.200 + 
   6.201 + #include "config.h"
   6.202 + 
   6.203 +Index: pf_osfp.c
   6.204 +--- pf_osfp.c.orig	2006-08-19 09:10:40 +0200
   6.205 ++++ pf_osfp.c	2006-08-24 12:14:21 +0200
   6.206 +@@ -50,6 +50,10 @@
   6.207 + #  define DPFPRINTF(format, x...)	((void)0)
   6.208 + # endif /* PFDEBUG */
   6.209 + 
   6.210 ++#ifndef MAX
   6.211 ++# define MAX(a,b)  (((a) > (b)) ? (a) : (b))
   6.212 ++#endif
   6.213 ++
   6.214 + SLIST_HEAD(pf_osfp_list, pf_os_fingerprint) pf_osfp_list;
   6.215 + pool_t pf_osfp_entry_pl;
   6.216 + pool_t pf_osfp_pl;
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/honeyd/honeyd.spec	Tue Aug 28 18:35:30 2012 +0200
     7.3 @@ -0,0 +1,265 @@
     7.4 +##
     7.5 +##  honeyd.spec -- OpenPKG RPM Package Specification
     7.6 +##  Copyright (c) 2000-2008 OpenPKG Foundation e.V. <http://openpkg.net/>
     7.7 +##
     7.8 +##  Permission to use, copy, modify, and distribute this software for
     7.9 +##  any purpose with or without fee is hereby granted, provided that
    7.10 +##  the above copyright notice and this permission notice appear in all
    7.11 +##  copies.
    7.12 +##
    7.13 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    7.14 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    7.15 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    7.16 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    7.17 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    7.18 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    7.19 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    7.20 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    7.21 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    7.22 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    7.23 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    7.24 +##  SUCH DAMAGE.
    7.25 +##
    7.26 +
    7.27 +#   package version
    7.28 +%define       V_honeyd    1.5b
    7.29 +%define       V_libdnsres 0.1a
    7.30 +
    7.31 +#   package information
    7.32 +Name:         honeyd
    7.33 +Summary:      Creates a Virtual Host on Network
    7.34 +URL:          http://www.honeyd.org/
    7.35 +Vendor:       Niels Provos
    7.36 +Packager:     OpenPKG Foundation e.V.
    7.37 +Distribution: OpenPKG Community
    7.38 +Class:        EVAL
    7.39 +Group:        Security
    7.40 +License:      BSD
    7.41 +Version:      %{V_honeyd}
    7.42 +Release:      20080101
    7.43 +
    7.44 +#   package options
    7.45 +%option       with_fsl  yes
    7.46 +%option       with_gui  no
    7.47 +
    7.48 +#   list of sources
    7.49 +Source0:      http://www.citi.umich.edu/u/provos/honeyd/honeyd-%{V_honeyd}.tar.gz
    7.50 +Source1:      http://www.citi.umich.edu/u/provos/honeyd/contrib/mael/ftp.sh
    7.51 +Source2:      http://www.citi.umich.edu/u/provos/honeyd/contrib/mael/pop3.sh
    7.52 +Source3:      http://www.citi.umich.edu/u/provos/honeyd/contrib/mael/smtp.sh
    7.53 +Source4:      http://www.citi.umich.edu/u/provos/papers/honeyd-eabstract.pdf
    7.54 +Source5:      http://www.citi.umich.edu/u/provos/papers/honeyd-eabstract.ps
    7.55 +Source6:      http://www.citi.umich.edu/u/provos/honeyd/ch01-results/1/honeydGUI.tar.gz
    7.56 +Source7:      honey
    7.57 +Source8:      svcs.sh
    7.58 +Source9:      rc.honeyd
    7.59 +Source10:     fsl.honeyd
    7.60 +Source11:     honeyd.conf
    7.61 +Source12:     cdefs.h
    7.62 +Source13:     setenv.h
    7.63 +Source14:     setenv.c
    7.64 +Source15:     vasprintf.c
    7.65 +Source16:     vasprintf.h
    7.66 +Source17:     http://www.monkey.org/~provos/libdnsres-%{V_libdnsres}.tar.gz
    7.67 +Patch0:       honeyd.patch
    7.68 +
    7.69 +#   build information
    7.70 +Prefix:       %{l_prefix}
    7.71 +BuildRoot:    %{l_buildroot}
    7.72 +BuildPreReq:  OpenPKG, openpkg >= 20060823, make
    7.73 +PreReq:       OpenPKG, openpkg >= 20060823
    7.74 +BuildPreReq:  libdnet, libpcap, libevent, libedit, zlib, pcre
    7.75 +PreReq:       libdnet, libpcap, libevent, libedit, zlib, pcre
    7.76 +%if "%{with_fsl}" == "yes"
    7.77 +BuildPreReq:  fsl
    7.78 +PreReq:       fsl
    7.79 +%endif
    7.80 +%if "%{with_gui}" == "yes"
    7.81 +PreReq:       java, JAVA-JDK
    7.82 +%endif
    7.83 +AutoReq:      no
    7.84 +AutoReqProv:  no
    7.85 +
    7.86 +%description
    7.87 +    Honeyd is a small daemon that creates virtual hosts on a network.
    7.88 +    The hosts can be configured to run arbitrary services, and their
    7.89 +    TCP personality can be adapted so that they appear to be running
    7.90 +    certain versions of operating systems. Honeyd enables a single host
    7.91 +    to claim multiple addresses on a LAN for network simulation. It is
    7.92 +    possible to ping the virtual machines, or to traceroute them. Any
    7.93 +    type of service on the virtual machine can be simulated according to
    7.94 +    a simple configuration file. Instead of simulating a service, it is
    7.95 +    also possible to proxy it to another machine. The package arpd will
    7.96 +    most certainly be useful as well, although it is not a technical
    7.97 +    requirement for this package.
    7.98 +
    7.99 +%track
   7.100 +    prog honeyd:honeyd = {
   7.101 +        version   = %{V_honeyd}
   7.102 +        url       = http://www.citi.umich.edu/u/provos/honeyd/
   7.103 +        regex     = honeyd-(__VER__)\.tar\.gz
   7.104 +    }
   7.105 +    prog honeyd:libdnsres = {
   7.106 +        version   = %{V_libdnsres}
   7.107 +        url       = http://www.monkey.org/~provos/libdnsres/
   7.108 +        regex     = libdnsres-(__VER__)\.tar\.gz
   7.109 +    }
   7.110 +
   7.111 +%prep
   7.112 +    %setup -q
   7.113 +    %setup -q -D -T -a 17
   7.114 +    %patch -p0
   7.115 +    %{l_shtool} subst \
   7.116 +        -e 's;AF_LOCAL;AF_UNIX;' \
   7.117 +        *.c
   7.118 +    %{l_shtool} subst \
   7.119 +        -e 's;^\(honeyd_SOURCES *=[^\\]*\);\1 setenv.c vasprintf.c;' \
   7.120 +        -e 's;^\(honeyd_OBJECTS *=[^\\]*\);\1 setenv.o vasprintf.o ;' \
   7.121 +        Makefile.in
   7.122 +    cp -f %{SOURCE setenv.c} .
   7.123 +    cp -f %{SOURCE setenv.h} .
   7.124 +    cp -f %{SOURCE vasprintf.c} .
   7.125 +    cp -f %{SOURCE vasprintf.h} .
   7.126 +    cp -f %{SOURCE cdefs.h} .
   7.127 +    %{l_shtool} subst \
   7.128 +        -e 's;/var/run/honeyd.pid;%{l_prefix}/var/honeyd/honeyd.pid;' \
   7.129 +        honeyd.h
   7.130 +    %{l_shtool} subst \
   7.131 +        -e 's/\(user_target=no\)/\1; pic_mode=no;/' \
   7.132 +        -e 's;test "*$\(hardcode_into_libs\)"* *\([!=]*\) *"*\([a-zA-Z_][a-zA-Z_]*\)"*;test ".$\1" \2 ".$\3";g' \
   7.133 +        -e 's;test "*$\(build_libtool_need_lc\)"* *\([!=]*\) *"*\([a-zA-Z_][a-zA-Z_]*\)"*;test ".$\1" \2 ".$\3";g' \
   7.134 +        ltmain.sh
   7.135 +    case "%{l_platform -t}" in
   7.136 +        *-sunos* )
   7.137 +            %{l_shtool} subst \
   7.138 +                -e 's;-levent;-levent -lsocket -lnsl;g' \
   7.139 +                configure
   7.140 +            %{l_shtool} subst \
   7.141 +                -e 's;\(\$(honeydctl_LDADD)\);\1 -lsocket -lnsl;g' \
   7.142 +                Makefile.in
   7.143 +            ;;
   7.144 +    esac
   7.145 +
   7.146 +%build
   7.147 +    ( cd libdnsres-%{V_libdnsres}
   7.148 +      CC="%{l_cc}" \
   7.149 +      CFLAGS="%{l_cflags -O}" \
   7.150 +      CPPFLAGS="%{l_cppflags}" \
   7.151 +      ./configure \
   7.152 +          --with-libevent=%{l_prefix} \
   7.153 +          --disable-shared
   7.154 +      %{l_make} %{l_mflags}
   7.155 +      ln .libs/libdnsres.a .
   7.156 +    ) || exit $?
   7.157 +    CC="%{l_cc}" \
   7.158 +    CFLAGS="%{l_cflags -O}" \
   7.159 +    CPPFLAGS="%{l_cppflags} -DREPLACE_GETOPT" \
   7.160 +    LDFLAGS="%{l_fsl_ldflags}" \
   7.161 +    LIBS="%{l_fsl_libs}" \
   7.162 +    ./configure \
   7.163 +        --prefix=%{l_prefix} \
   7.164 +        --with-libevent=%{l_prefix} \
   7.165 +        --with-libdnet=%{l_prefix} \
   7.166 +        --with-libdnsres=`pwd`/libdnsres-%{V_libdnsres} \
   7.167 +        --with-libpcre=%{l_prefix} \
   7.168 +        --without-python
   7.169 +    %{l_make} %{l_mflags}
   7.170 +
   7.171 +%install
   7.172 +    rm -rf $RPM_BUILD_ROOT
   7.173 +
   7.174 +    #   create directories
   7.175 +    %{l_shtool} mkdir -f -p -m 755 \
   7.176 +        $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
   7.177 +        $RPM_BUILD_ROOT%{l_prefix}/etc/honeyd \
   7.178 +        $RPM_BUILD_ROOT%{l_prefix}/lib/honeyd \
   7.179 +        $RPM_BUILD_ROOT%{l_prefix}/var/honeyd \
   7.180 +        $RPM_BUILD_ROOT%{l_prefix}/share/honeyd \
   7.181 +        $RPM_BUILD_ROOT%{l_prefix}/libexec/honeyd
   7.182 +
   7.183 +    #   install files
   7.184 +    %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
   7.185 +    %{l_shtool} install -c -m 750 %{l_value -s -a} \
   7.186 +        -e 's;^log=/\(.*/\)*\(.*\)-.*\.log;log=%{l_prefix}/var/honeyd/\2.log;g' \
   7.187 +        -e 's;^\(host=\).*;\1`%{l_shtool} echo -e %h`;g' \
   7.188 +        -e 's;^\(domain=\).*;\1`%{l_shtool} echo -e %d | cut -c2-`;g' \
   7.189 +        -e 's; gawk ; awk ;g' \
   7.190 +        %{SOURCE ftp.sh} \
   7.191 +        %{SOURCE pop3.sh} \
   7.192 +        %{SOURCE smtp.sh} \
   7.193 +        %{SOURCE svcs.sh} \
   7.194 +        $RPM_BUILD_ROOT%{l_prefix}/libexec/honeyd/
   7.195 +    %{l_shtool} install -c -m 644 %{l_value -s -a} \
   7.196 +        %{SOURCE honeyd.conf} \
   7.197 +        $RPM_BUILD_ROOT%{l_prefix}/etc/honeyd/
   7.198 +    %{l_shtool} install -c -m 755 %{l_value -s -a} \
   7.199 +        %{SOURCE rc.honeyd} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   7.200 +    %{l_shtool} install -c -m 644 \
   7.201 +        %{SOURCE honeyd-eabstract.ps} \
   7.202 +        $RPM_BUILD_ROOT%{l_prefix}/share/honeyd/honeyd.ps
   7.203 +    %{l_shtool} install -c -m 644 \
   7.204 +        %{SOURCE honeyd-eabstract.pdf} \
   7.205 +        $RPM_BUILD_ROOT%{l_prefix}/share/honeyd/honeyd.pdf
   7.206 +
   7.207 +    #   optionally install the Java GUI
   7.208 +%if "%{with_gui}" == "yes"
   7.209 +    %{l_tar} zxf %{SOURCE honeydGUI.tar.gz}
   7.210 +    mv -f honeydGUI/exec $RPM_BUILD_ROOT%{l_prefix}/lib/honeyd/javagui
   7.211 +    %{l_shtool} install -c -m 755 %{l_value -s -a} \
   7.212 +        %{SOURCE honey} \
   7.213 +        $RPM_BUILD_ROOT%{l_prefix}/bin/
   7.214 +%endif
   7.215 +
   7.216 +    #   install OSSP fsl configuration
   7.217 +    %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
   7.218 +    %{l_shtool} install -c -m 644 %{l_value -s -a} \
   7.219 +        %{SOURCE fsl.honeyd} \
   7.220 +        $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
   7.221 +
   7.222 +    #   remove unwanted files
   7.223 +    rm -rf $RPM_BUILD_ROOT%{l_prefix}/include
   7.224 +    rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/honeyd
   7.225 +    rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/honeyd/README
   7.226 +    rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/honeyd/config.sample
   7.227 +
   7.228 +    #   determine file list
   7.229 +    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
   7.230 +        %{l_files_std} \
   7.231 +        '%config %attr(0750,%{l_susr},%{l_mgrp}) %{l_prefix}/var/honeyd' \
   7.232 +        '%config %{l_prefix}/etc/fsl/fsl.honeyd' \
   7.233 +        '%config %attr(0750,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/honeyd/honeyd.conf'
   7.234 +
   7.235 +%files -f files
   7.236 +
   7.237 +%clean
   7.238 +    rm -rf $RPM_BUILD_ROOT
   7.239 +
   7.240 +%pre
   7.241 +    #   before upgrade, save status and stop service
   7.242 +    [ $1 -eq 2 ] || exit 0
   7.243 +    eval `%{l_rc} honeyd status 2>/dev/null | tee %{l_tmpfile}`
   7.244 +    %{l_rc} honeyd stop 2>/dev/null
   7.245 +    exit 0
   7.246 +
   7.247 +%post
   7.248 +    if [ $1 -eq 1 ]; then
   7.249 +        #   display final hints on initial installation
   7.250 +        ( echo "Before starting Honey daemon, please set the configuration variable"
   7.251 +          echo "\"honeyd_if\" in $RPM_INSTALL_PREFIX/etc/rc.conf to the name of the"
   7.252 +          echo "used network interface."
   7.253 +        ) | %{l_rpmtool} msg -b -t notice
   7.254 +    fi
   7.255 +    if [ $1 -eq 2 ]; then
   7.256 +        #   after upgrade, restore status
   7.257 +        eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile}
   7.258 +        [ ".$honeyd_active" = .yes ] && %{l_rc} honeyd start
   7.259 +    fi
   7.260 +    exit 0
   7.261 +
   7.262 +%preun
   7.263 +    #   before erase, stop service and remove log files
   7.264 +    [ $1 -eq 0 ] || exit 0
   7.265 +    %{l_rc} honeyd stop 2>/dev/null
   7.266 +    rm -f $RPM_INSTALL_PREFIX/var/honeyd/*.log* >/dev/null 2>&1 || true
   7.267 +    exit 0
   7.268 +
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/honeyd/rc.honeyd	Tue Aug 28 18:35:30 2012 +0200
     8.3 @@ -0,0 +1,77 @@
     8.4 +#!@l_prefix@/bin/openpkg rc
     8.5 +##
     8.6 +##  rc.honeyd -- Run-Commands
     8.7 +##
     8.8 +
     8.9 +%config
    8.10 +    honeyd_enable="$openpkg_rc_def"
    8.11 +    honeyd_log_prolog="true"
    8.12 +    honeyd_log_epilog="true"
    8.13 +    honeyd_log_numfiles="10"
    8.14 +    honeyd_log_minsize="1M"
    8.15 +    honeyd_log_complevel="9"
    8.16 +    honeyd_ip_network="192.168.100.0/24"
    8.17 +    honeyd_if=""
    8.18 +
    8.19 +%common
    8.20 +    honeyd_pidfile="@l_prefix@/var/honeyd/honeyd.pid"
    8.21 +    honeyd_cfgfile="@l_prefix@/etc/honeyd/honeyd.conf"
    8.22 +    honeyd_prnfile="@l_prefix@/share/honeyd/nmap.prints"
    8.23 +    honeyd_xpbfile="@l_prefix@/share/honeyd/xprobe2.conf"
    8.24 +    honeyd_assfile="@l_prefix@/share/honeyd/nmap.assoc"
    8.25 +    honeyd_signal () {
    8.26 +        [ -f $honeyd_pidfile ] && kill -$1 `cat $honeyd_pidfile`
    8.27 +    }
    8.28 +
    8.29 +%status -u @l_susr@ -o
    8.30 +    honeyd_usable="no"
    8.31 +    honeyd_active="no"
    8.32 +    rcService honeyd enable yes && \
    8.33 +        honeyd_chroot && honeyd_usable="yes"
    8.34 +    rcService honeyd enable yes && \
    8.35 +        honeyd_signal 0 && honeyd_active="yes"
    8.36 +    echo "honeyd_enable=\"$honeyd_enable\""
    8.37 +    echo "honeyd_usable=\"$honeyd_usable\""
    8.38 +    echo "honeyd_active=\"$honeyd_active\""
    8.39 +
    8.40 +%start -u @l_susr@
    8.41 +    rcService honeyd enable yes || exit 0
    8.42 +    rcService honeyd active yes && exit 0
    8.43 +    if [ ".$honeyd_if" != . ]; then
    8.44 +        arpd_interface="-i $honeyd_if"
    8.45 +    fi
    8.46 +    @l_prefix@/bin/honeyd \
    8.47 +        -p $honeyd_prnfile \
    8.48 +        -x $honeyd_xpbfile \
    8.49 +        -a $honeyd_assfile \
    8.50 +        -f $honeyd_cfgfile \
    8.51 +        $honeyd_interface \
    8.52 +        $honeyd_ip_network \
    8.53 +        >/dev/null 2>&1
    8.54 +
    8.55 +%stop -u @l_susr@
    8.56 +    rcService honeyd enable yes || exit 0
    8.57 +    rcService honeyd active no && exit 0
    8.58 +    honeyd_signal TERM
    8.59 +
    8.60 +%restart -u @l_susr@
    8.61 +    rcService honeyd enable yes || exit 0
    8.62 +    rcService honeyd active no && exit 0
    8.63 +    rc honeyd stop
    8.64 +    sleep 2
    8.65 +    rc honeyd start
    8.66 +
    8.67 +%reload -u @l_susr@
    8.68 +    rcService honeyd enable yes || exit 0
    8.69 +    rcService honeyd active no && exit 0
    8.70 +    honeyd_signal HUP
    8.71 +
    8.72 +%daily -u @l_susr@
    8.73 +    rcService honeyd enable yes || exit 0
    8.74 +    shtool rotate -f \
    8.75 +        -n ${honeyd_log_numfiles} -s ${honeyd_log_minsize} -d \
    8.76 +        -z ${honeyd_log_complevel} -o @l_susr@ -g @l_mgrp@ -m 644 \
    8.77 +        -P "${honeyd_log_prolog}" \
    8.78 +        -E "${honeyd_log_epilog}; rc honeyd restart" \
    8.79 +        @l_prefix@/var/honeyd/honeyd.log
    8.80 +
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/honeyd/setenv.c	Tue Aug 28 18:35:30 2012 +0200
     9.3 @@ -0,0 +1,26 @@
     9.4 +
     9.5 +#ifndef HAVE_SETENV
     9.6 +#ifdef HAVE_CONFIG_H
     9.7 +#include "config.h"
     9.8 +#endif
     9.9 +#include <sys/types.h>
    9.10 +#include <stdlib.h>
    9.11 +#include <string.h>
    9.12 +
    9.13 +int setenv(const char *kszName, const char *kszValue, int nOverwrite)
    9.14 +{
    9.15 +    char *szPair = NULL;
    9.16 +
    9.17 +    if (nOverwrite == 0 && getenv(kszName) != 0)
    9.18 +        return 0;
    9.19 +    szPair = malloc(strlen(kszName) + 1 + strlen(kszValue) + 1);
    9.20 +    if (szPair == NULL)
    9.21 +        return -1;
    9.22 +    strcpy(szPair, kszName);
    9.23 +    strcat(szPair, "=");
    9.24 +    strcat(szPair, kszValue);
    9.25 +    putenv(szPair);
    9.26 +    return 0;
    9.27 +}
    9.28 +#endif /* !HAVE_SETENV */
    9.29 +
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/honeyd/setenv.h	Tue Aug 28 18:35:30 2012 +0200
    10.3 @@ -0,0 +1,4 @@
    10.4 +#ifndef LOC_SETENV_H
    10.5 +# define LOC_SETENV_H
    10.6 +int setenv(const char *, const char *, int);
    10.7 +#endif /* not LOC_SETENV_H */
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/honeyd/svcs.sh	Tue Aug 28 18:35:30 2012 +0200
    11.3 @@ -0,0 +1,37 @@
    11.4 +#! /bin/sh
    11.5 +##
    11.6 +##  honeyd.service -- small honeyd(8) service faking script
    11.7 +##  Copyright (c) 2003 The OpenPKG Project <http://www.openpkg.org/>
    11.8 +##
    11.9 +
   11.10 +#   honeyd(8) provides:
   11.11 +#   $HONEYD_PERSONALITY
   11.12 +#   $HONEYD_IP_SRC, $HONEYD_SRC_PORT
   11.13 +#   $HONEYD_IP_DST, $HONEYD_DST_PORT
   11.14 +
   11.15 +service="$1"
   11.16 +shift
   11.17 +
   11.18 +case $service in
   11.19 +    http )
   11.20 +        line="true"
   11.21 +        while $line; do
   11.22 +            read line
   11.23 +        done
   11.24 +        echo "HTTP/1.1 404 Not Found"
   11.25 +        echo "Date: `date`"
   11.26 +        echo "Server: Apache"
   11.27 +        echo "Connection: close"
   11.28 +        echo "Content-Type: text/plain; charset=iso-8859-1"
   11.29 +        echo ""
   11.30 +        echo "Error: 404 Not Found"
   11.31 +        exit 0
   11.32 +        ;;
   11.33 +    ssh )
   11.34 +        echo "SSH-1.5-2.40"
   11.35 +        read line
   11.36 +        echo "Protocol mismatch."
   11.37 +        exit 0
   11.38 +        ;;
   11.39 +esac
   11.40 +
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/honeyd/vasprintf.c	Tue Aug 28 18:35:30 2012 +0200
    12.3 @@ -0,0 +1,133 @@
    12.4 +/* Like vsprintf but provides a pointer to malloc'd storage, which must
    12.5 +   be freed by the caller.
    12.6 +   Copyright (C) 1994, 2003 Free Software Foundation, Inc.
    12.7 +
    12.8 +This file is part of the libiberty library.
    12.9 +Libiberty is free software; you can redistribute it and/or
   12.10 +modify it under the terms of the GNU Library General Public
   12.11 +License as published by the Free Software Foundation; either
   12.12 +version 2 of the License, or (at your option) any later version.
   12.13 +
   12.14 +Libiberty is distributed in the hope that it will be useful,
   12.15 +but WITHOUT ANY WARRANTY; without even the implied warranty of
   12.16 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   12.17 +Library General Public License for more details.
   12.18 +
   12.19 +You should have received a copy of the GNU Library General Public
   12.20 +License along with libiberty; see the file COPYING.LIB.  If
   12.21 +not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   12.22 +Boston, MA 02111-1307, USA.  */
   12.23 +
   12.24 +#include <stdarg.h>
   12.25 +#include <stdio.h>
   12.26 +#include <stdlib.h>
   12.27 +#include <string.h>
   12.28 +#include "vasprintf.h"
   12.29 +
   12.30 +/*
   12.31 +
   12.32 +@deftypefn Extension int vasprintf (char **@var{resptr}, const char *@var{format}, va_list @var{args})
   12.33 +
   12.34 +Like @code{vsprintf}, but instead of passing a pointer to a buffer,
   12.35 +you pass a pointer to a pointer.  This function will compute the size
   12.36 +of the buffer needed, allocate memory with @code{malloc}, and store a
   12.37 +pointer to the allocated memory in @code{*@var{resptr}}.  The value
   12.38 +returned is the same as @code{vsprintf} would return.  If memory could
   12.39 +not be allocated, minus one is returned and @code{NULL} is stored in
   12.40 +@code{*@var{resptr}}.
   12.41 +
   12.42 +@end deftypefn
   12.43 +
   12.44 +*/
   12.45 +
   12.46 +static int int_vasprintf(char **, const char *, va_list);
   12.47 +
   12.48 +static int
   12.49 +int_vasprintf (result, format, args)
   12.50 +     char **result;
   12.51 +     const char *format;
   12.52 +     va_list args;
   12.53 +{
   12.54 +  const char *p = format;
   12.55 +  /* Add one to make sure that it is never zero, which might cause malloc
   12.56 +     to return NULL.  */
   12.57 +  int total_width = strlen (format) + 1;
   12.58 +  va_list ap;
   12.59 +
   12.60 +  memcpy ((void *) &ap, (const void *) &args, sizeof (va_list));
   12.61 +
   12.62 +  while (*p != '\0')
   12.63 +    {
   12.64 +      if (*p++ == '%')
   12.65 +	{
   12.66 +	  while (strchr ("-+ #0", *p))
   12.67 +	    ++p;
   12.68 +	  if (*p == '*')
   12.69 +	    {
   12.70 +	      ++p;
   12.71 +	      total_width += abs (va_arg (ap, int));
   12.72 +	    }
   12.73 +	  else
   12.74 +	    total_width += strtoul (p, (char **) &p, 10);
   12.75 +	  if (*p == '.')
   12.76 +	    {
   12.77 +	      ++p;
   12.78 +	      if (*p == '*')
   12.79 +		{
   12.80 +		  ++p;
   12.81 +		  total_width += abs (va_arg (ap, int));
   12.82 +		}
   12.83 +	      else
   12.84 +	      total_width += strtoul (p, (char **) &p, 10);
   12.85 +	    }
   12.86 +	  while (strchr ("hlL", *p))
   12.87 +	    ++p;
   12.88 +	  /* Should be big enough for any format specifier except %s and floats.  */
   12.89 +	  total_width += 30;
   12.90 +	  switch (*p)
   12.91 +	    {
   12.92 +	    case 'd':
   12.93 +	    case 'i':
   12.94 +	    case 'o':
   12.95 +	    case 'u':
   12.96 +	    case 'x':
   12.97 +	    case 'X':
   12.98 +	    case 'c':
   12.99 +	      (void) va_arg (ap, int);
  12.100 +	      break;
  12.101 +	    case 'f':
  12.102 +	    case 'e':
  12.103 +	    case 'E':
  12.104 +	    case 'g':
  12.105 +	    case 'G':
  12.106 +	      (void) va_arg (ap, double);
  12.107 +	      /* Since an ieee double can have an exponent of 307, we'll
  12.108 +		 make the buffer wide enough to cover the gross case. */
  12.109 +	      total_width += 307;
  12.110 +	      break;
  12.111 +	    case 's':
  12.112 +	      total_width += strlen (va_arg (ap, char *));
  12.113 +	      break;
  12.114 +	    case 'p':
  12.115 +	    case 'n':
  12.116 +	      (void) va_arg (ap, char *);
  12.117 +	      break;
  12.118 +	    }
  12.119 +	  p++;
  12.120 +	}
  12.121 +    }
  12.122 +  *result = (char *) malloc (total_width);
  12.123 +  if (*result != NULL)
  12.124 +    return vsprintf (*result, format, args);
  12.125 +  else
  12.126 +    return -1;
  12.127 +}
  12.128 +
  12.129 +int
  12.130 +vasprintf (result, format, args)
  12.131 +     char **result;
  12.132 +     const char *format;
  12.133 +     va_list args;
  12.134 +{
  12.135 +  return int_vasprintf (result, format, args);
  12.136 +}
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/honeyd/vasprintf.h	Tue Aug 28 18:35:30 2012 +0200
    13.3 @@ -0,0 +1,21 @@
    13.4 +/* Like vsprintf but provides a pointer to malloc'd storage, which must
    13.5 +   be freed by the caller.
    13.6 +   Copyright (C) 1994, 2003 Free Software Foundation, Inc.
    13.7 +
    13.8 +This file is part of the libiberty library.
    13.9 +Libiberty is free software; you can redistribute it and/or
   13.10 +modify it under the terms of the GNU Library General Public
   13.11 +License as published by the Free Software Foundation; either
   13.12 +version 2 of the License, or (at your option) any later version.
   13.13 +
   13.14 +Libiberty is distributed in the hope that it will be useful,
   13.15 +but WITHOUT ANY WARRANTY; without even the implied warranty of
   13.16 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   13.17 +Library General Public License for more details.
   13.18 +
   13.19 +You should have received a copy of the GNU Library General Public
   13.20 +License along with libiberty; see the file COPYING.LIB.  If
   13.21 +not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   13.22 +Boston, MA 02111-1307, USA.  */
   13.23 +
   13.24 +int vasprintf(char **, const char *, va_list);

mercurial