OpenPKG CVS Repository http://cvs.openpkg.org/ ____________________________________________________________________________
Server: cvs.openpkg.org Name: Michael Schloh Root: /e/openpkg/cvs Email: [EMAIL PROTECTED] Module: openpkg-src Date: 07-Jan-2005 14:07:31 Branch: HEAD Handle: 2005010713073000 Added files: openpkg-src/honeyd vasprintf.c vasprintf.h Modified files: openpkg-src/honeyd honeyd.patch honeyd.spec Log: patch again to work on platforms without cdefs, include vasprintf(3) sources from libiberty project for building on several platforms missing it, and correct build configuration for honeydctl target on Solaris Summary: Revision Changes Path 1.15 +32 -0 openpkg-src/honeyd/honeyd.patch 1.55 +17 -3 openpkg-src/honeyd/honeyd.spec 1.1 +133 -0 openpkg-src/honeyd/vasprintf.c 1.1 +21 -0 openpkg-src/honeyd/vasprintf.h ____________________________________________________________________________ patch -p0 <<'@@ .' Index: openpkg-src/honeyd/honeyd.patch ============================================================================ $ cvs diff -u -r1.14 -r1.15 honeyd.patch --- openpkg-src/honeyd/honeyd.patch 6 Jan 2005 09:50:14 -0000 1.14 +++ openpkg-src/honeyd/honeyd.patch 7 Jan 2005 13:07:30 -0000 1.15 @@ -38,6 +38,21 @@ /* * GNU-like getopt_long() and 4.4BSD getsubopt()/optreset extensions +Index: compat/sha1.h +--- compat/sha1.h.orig 2004-12-31 20:13:36.000000000 +0100 ++++ compat/sha1.h 2005-01-07 13:53:01.066282520 +0100 +@@ -15,7 +15,11 @@ + unsigned char buffer[64]; + } SHA1_CTX; + ++#ifdef HAVE_SYS_CDEFS_H + #include <sys/cdefs.h> ++#else ++#include "cdefs.h" ++#endif + + __BEGIN_DECLS + void SHA1Transform(u_int32_t [5], const unsigned char [64]) Index: config.h.in --- config.h.in.orig 2004-12-06 04:17:14 +0100 +++ config.h.in 2005-01-06 10:37:07 +0100 @@ -204,3 +219,20 @@ dist-hook: ./distribute.py $(distdir)/ +Index: dhcpclient.c +--- dhcpclient.c.orig 2005-01-07 13:06:46.552453044 +0100 ++++ dhcpclient.c 2005-01-07 13:06:48.391812793 +0100 +@@ -94,6 +94,13 @@ + + #define NTRIES 10 + ++#ifndef MIN ++# define MIN(a,b) (((a) < (b)) ? (a) : (b)) ++#endif /* MIN */ ++#ifndef MAX ++# define MAX(a,b) (((a) > (b)) ? (a) : (b)) ++#endif /* MAX */ ++ + static int _pack_request(struct dhcpclient_req *, void *, size_t *); + static int _pack_release(struct dhcpclient_req *, void *, size_t *); + static int _bcast(struct template *, @@ . patch -p0 <<'@@ .' Index: openpkg-src/honeyd/honeyd.spec ============================================================================ $ cvs diff -u -r1.54 -r1.55 honeyd.spec --- openpkg-src/honeyd/honeyd.spec 6 Jan 2005 09:50:14 -0000 1.54 +++ openpkg-src/honeyd/honeyd.spec 7 Jan 2005 13:07:30 -0000 1.55 @@ -34,7 +34,7 @@ Group: Security License: BSD Version: 1.0 -Release: 20050106 +Release: 20050107 # package options %option with_fsl yes @@ -56,6 +56,8 @@ Source12: cdefs.h Source13: setenv.h Source14: setenv.c +Source15: vasprintf.c +Source16: vasprintf.h Patch0: honeyd.patch # build information @@ -100,11 +102,13 @@ -e 's;AF_LOCAL;AF_UNIX;' \ *.c %{l_shtool} subst \ - -e 's;^\(honeyd_SOURCES *=[^\\]*\);\1 setenv.c ;' \ - -e 's;^\(honeyd_OBJECTS *=[^\\]*\);\1 setenv.o ;' \ + -e 's;^\(honeyd_SOURCES *=[^\\]*\);\1 setenv.c vasprintf.c;' \ + -e 's;^\(honeyd_OBJECTS *=[^\\]*\);\1 setenv.o vasprintf.o ;' \ Makefile.in cp -f %{SOURCE setenv.c} . cp -f %{SOURCE setenv.h} . + cp -f %{SOURCE vasprintf.c} . + cp -f %{SOURCE vasprintf.h} . cp -f %{SOURCE cdefs.h} . %{l_shtool} subst \ -e 's;/var/run/honeyd.pid;%{l_prefix}/var/honeyd/honeyd.pid;' \ @@ -114,6 +118,16 @@ -e 's;test "*$\(hardcode_into_libs\)"* *\([!=]*\) *"*\([a-zA-Z_][a-zA-Z_]*\)"*;test ".$\1" \2 ".$\3";g' \ -e 's;test "*$\(build_libtool_need_lc\)"* *\([!=]*\) *"*\([a-zA-Z_][a-zA-Z_]*\)"*;test ".$\1" \2 ".$\3";g' \ ltmain.sh + case "%{l_platform -t}" in + *-sunos* ) + %{l_shtool} subst \ + -e 's;-levent;-levent -lsocket -lnsl;g' \ + configure + %{l_shtool} subst \ + -e 's;\(\$(honeydctl_LDADD)\);\1 -lsocket -lnsl;g' \ + Makefile.in + ;; + esac %build CC="%{l_cc}" \ @@ . patch -p0 <<'@@ .' Index: openpkg-src/honeyd/vasprintf.c ============================================================================ $ cvs diff -u -r0 -r1.1 vasprintf.c --- /dev/null 2005-01-07 14:07:30 +0100 +++ vasprintf.c 2005-01-07 14:07:31 +0100 @@ -0,0 +1,133 @@ +/* Like vsprintf but provides a pointer to malloc'd storage, which must + be freed by the caller. + Copyright (C) 1994, 2003 Free Software Foundation, Inc. + +This file is part of the libiberty library. +Libiberty is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +Libiberty is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with libiberty; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "vasprintf.h" + +/* + [EMAIL PROTECTED] Extension int vasprintf (char [EMAIL PROTECTED], const char [EMAIL PROTECTED], va_list @var{args}) + +Like @code{vsprintf}, but instead of passing a pointer to a buffer, +you pass a pointer to a pointer. This function will compute the size +of the buffer needed, allocate memory with @code{malloc}, and store a +pointer to the allocated memory in @[EMAIL PROTECTED] The value +returned is the same as @code{vsprintf} would return. If memory could +not be allocated, minus one is returned and @code{NULL} is stored in [EMAIL PROTECTED]@var{resptr}}. + [EMAIL PROTECTED] deftypefn + +*/ + +static int int_vasprintf(char **, const char *, va_list); + +static int +int_vasprintf (result, format, args) + char **result; + const char *format; + va_list args; +{ + const char *p = format; + /* Add one to make sure that it is never zero, which might cause malloc + to return NULL. */ + int total_width = strlen (format) + 1; + va_list ap; + + memcpy ((void *) &ap, (const void *) &args, sizeof (va_list)); + + while (*p != '\0') + { + if (*p++ == '%') + { + while (strchr ("-+ #0", *p)) + ++p; + if (*p == '*') + { + ++p; + total_width += abs (va_arg (ap, int)); + } + else + total_width += strtoul (p, (char **) &p, 10); + if (*p == '.') + { + ++p; + if (*p == '*') + { + ++p; + total_width += abs (va_arg (ap, int)); + } + else + total_width += strtoul (p, (char **) &p, 10); + } + while (strchr ("hlL", *p)) + ++p; + /* Should be big enough for any format specifier except %s and floats. */ + total_width += 30; + switch (*p) + { + case 'd': + case 'i': + case 'o': + case 'u': + case 'x': + case 'X': + case 'c': + (void) va_arg (ap, int); + break; + case 'f': + case 'e': + case 'E': + case 'g': + case 'G': + (void) va_arg (ap, double); + /* Since an ieee double can have an exponent of 307, we'll + make the buffer wide enough to cover the gross case. */ + total_width += 307; + break; + case 's': + total_width += strlen (va_arg (ap, char *)); + break; + case 'p': + case 'n': + (void) va_arg (ap, char *); + break; + } + p++; + } + } + *result = (char *) malloc (total_width); + if (*result != NULL) + return vsprintf (*result, format, args); + else + return -1; +} + +int +vasprintf (result, format, args) + char **result; + const char *format; + va_list args; +{ + return int_vasprintf (result, format, args); +} @@ . patch -p0 <<'@@ .' Index: openpkg-src/honeyd/vasprintf.h ============================================================================ $ cvs diff -u -r0 -r1.1 vasprintf.h --- /dev/null 2005-01-07 14:07:30 +0100 +++ vasprintf.h 2005-01-07 14:07:31 +0100 @@ -0,0 +1,21 @@ +/* Like vsprintf but provides a pointer to malloc'd storage, which must + be freed by the caller. + Copyright (C) 1994, 2003 Free Software Foundation, Inc. + +This file is part of the libiberty library. +Libiberty is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +Libiberty is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with libiberty; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +int vasprintf(char **, const char *, va_list); @@ . ______________________________________________________________________ The OpenPKG Project www.openpkg.org CVS Repository Commit List openpkg-cvs@openpkg.org