diff -u nepenthes-0.2.2/config.guess nepenthes-0.2.2/config.guess --- nepenthes-0.2.2/config.guess +++ nepenthes-0.2.2/config.guess @@ -1,10 +1,10 @@ #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 # Free Software Foundation, Inc. -timestamp='2008-01-23' +timestamp='2009-06-10' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -170,7 +170,7 @@ arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep __ELF__ >/dev/null + | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? @@ -324,6 +324,9 @@ case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; + s390x:SunOS:*:*) + echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; @@ -331,7 +334,20 @@ echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) - echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + eval $set_cc_for_build + SUN_ARCH="i386" + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH="x86_64" + fi + fi + echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize @@ -640,7 +656,7 @@ # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | - grep __LP64__ >/dev/null + grep -q __LP64__ then HP_ARCH="hppa2.0w" else @@ -796,7 +812,7 @@ x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; - EM64T | authenticamd) + EM64T | authenticamd | genuineintel) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) @@ -806,6 +822,9 @@ [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; + 8664:Windows_NT:*) + echo x86_64-pc-mks + exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we @@ -866,40 +885,17 @@ m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; - mips:Linux:*:*) + mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU - #undef mips - #undef mipsel + #undef ${UNAME_MACHINE} + #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mipsel + CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips - #else - CPU= - #endif - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^CPU/{ - s: ::g - p - }'`" - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } - ;; - mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips64 - #undef mips64el - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mips64el - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips64 + CPU=${UNAME_MACHINE} #else CPU= #endif @@ -931,10 +927,13 @@ EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac - objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; + padre:Linux:*:*) + echo sparc-unknown-linux-gnu + exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in @@ -982,17 +981,6 @@ elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; - a.out-i386-linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit ;; - coff-i386) - echo "${UNAME_MACHINE}-pc-linux-gnucoff" - exit ;; - "") - # Either a pre-BFD a.out linker (linux-gnuoldld) or - # one that does not give us useful --help. - echo "${UNAME_MACHINE}-pc-linux-gnuoldld" - exit ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build @@ -1058,7 +1046,7 @@ i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) @@ -1102,8 +1090,11 @@ pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i386. - echo i386-pc-msdosdjgpp + # the processor, so we play safe by assuming i586. + # Note: whatever this is, it MUST be the same as what config.sub + # prints for the "djgpp" host, or else GDB configury will decide that + # this is a cross-build. + echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 @@ -1141,6 +1132,16 @@ 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; + NCR*:*:4.2:* | MPRAS*:*:4.2:*) + OS_REL='.3' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; @@ -1153,7 +1154,7 @@ rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) @@ -1216,6 +1217,9 @@ BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + echo i586-pc-haiku + exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; @@ -1324,6 +1328,9 @@ i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; + i*86:AROS:*:*) + echo ${UNAME_MACHINE}-pc-aros + exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 diff -u nepenthes-0.2.2/config.sub nepenthes-0.2.2/config.sub --- nepenthes-0.2.2/config.sub +++ nepenthes-0.2.2/config.sub @@ -1,10 +1,10 @@ #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 # Free Software Foundation, Inc. -timestamp='2008-01-16' +timestamp='2009-06-11' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -122,6 +122,7 @@ case $maybe_os in nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ + kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` @@ -152,6 +153,9 @@ os= basic_machine=$1 ;; + -bluegene*) + os=-cnk + ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 @@ -249,13 +253,16 @@ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ + | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | mcore | mep \ + | maxq | mb | microblaze | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ - | mips64vr | mips64vrel \ + | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ + | mips64r5900 | mips64r5900el \ + | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ @@ -268,6 +275,7 @@ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ + | moxie \ | mt \ | msp430 \ | nios | nios2 \ @@ -277,7 +285,7 @@ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | score \ - | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ @@ -286,7 +294,7 @@ | v850 | v850e \ | we32k \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ - | z8k) + | z8k | z80) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) @@ -329,14 +337,17 @@ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ + | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ - | mips64vr-* | mips64vrel-* \ + | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ + | mips64r5900-* | mips64r5900el-* \ + | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ @@ -358,20 +369,20 @@ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ - | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ - | z8k-*) + | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) @@ -439,6 +450,10 @@ basic_machine=m68k-apollo os=-bsd ;; + aros) + basic_machine=i386-pc + os=-aros + ;; aux) basic_machine=m68k-apple os=-aux @@ -455,10 +470,18 @@ basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; + bluegene*) + basic_machine=powerpc-ibm + os=-cnk + ;; c90) basic_machine=c90-cray os=-unicos ;; + cegcc) + basic_machine=arm-unknown + os=-cegcc + ;; convex-c1) basic_machine=c1-convex os=-bsd @@ -526,6 +549,10 @@ basic_machine=m88k-motorola os=-sysv3 ;; + dicos) + basic_machine=i686-pc + os=-dicos + ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp @@ -1128,6 +1155,10 @@ basic_machine=z8k-unknown os=-sim ;; + z80-*-coff) + basic_machine=z80-unknown + os=-sim + ;; none) basic_machine=none-none os=-none @@ -1166,7 +1197,7 @@ we32k) basic_machine=we32k-att ;; - sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) + sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) @@ -1236,10 +1267,11 @@ # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -kopensolaris* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* \ + | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ @@ -1248,7 +1280,7 @@ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* \ + | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ @@ -1388,6 +1420,9 @@ -zvmoe) os=-zvmoe ;; + -dicos*) + os=-dicos + ;; -none) ;; *) @@ -1585,7 +1620,7 @@ -sunos*) vendor=sun ;; - -aix*) + -cnk*|-aix*) vendor=ibm ;; -beos*) diff -u nepenthes-0.2.2/debian/changelog nepenthes-0.2.2/debian/changelog --- nepenthes-0.2.2/debian/changelog +++ nepenthes-0.2.2/debian/changelog @@ -1,3 +1,25 @@ +nepenthes (0.2.2-4ubuntu1) lucid; urgency=low + + * Merge from Debian testing (LP: #486015), remaining changes: + - 06_warn_unused_result.dpatch: Patch several source files to take + results from various function call in order to fix FTBFS. + * New patch 07_includes_for_eglibc_2.10.dpatch to fix FTBFS due to + missing headers. + * Build with -fno-strict-aliasing to avoid build errors. + + -- Ilya Barygin Thu, 10 Dec 2009 21:26:49 +0300 + +nepenthes (0.2.2-4) unstable; urgency=low + + * Added missing headers in order to be compiled with gcc 4.4 + (closes:#505383). + * Updated Standards-Version 3.8.0 + * Fixed debian/copyright + * Switched to libcap2-dev since libcap-dev is not longer maintained + (closes: #492636). + + -- Luciano Bello Mon, 16 Feb 2009 22:16:56 -0200 + nepenthes (0.2.2-3ubuntu1) intrepid; urgency=low * Sync with Debian unstable (LP: #240188), additional changes required: diff -u nepenthes-0.2.2/debian/copyright nepenthes-0.2.2/debian/copyright --- nepenthes-0.2.2/debian/copyright +++ nepenthes-0.2.2/debian/copyright @@ -8,18 +8,19 @@ - Nepenthes Copyright (C) 2005 Markus Koetter, Maximillian Dornseif, Paul Baecher License: - This package is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 dated June, 1991. - - This package 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 General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this package; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA On Debian systems, the complete text of the GNU General diff -u nepenthes-0.2.2/debian/rules nepenthes-0.2.2/debian/rules --- nepenthes-0.2.2/debian/rules +++ nepenthes-0.2.2/debian/rules @@ -3,6 +3,7 @@ DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) CFLAGS = -Wall -g +CXXFLAGS += -fno-strict-aliasing ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) CFLAGS += -O0 diff -u nepenthes-0.2.2/debian/control nepenthes-0.2.2/debian/control --- nepenthes-0.2.2/debian/control +++ nepenthes-0.2.2/debian/control @@ -1,10 +1,10 @@ Source: nepenthes Section: net Priority: optional -Maintainer: Ubuntu MOTU Developers +Maintainer: Ubuntu Developers XSBC-Original-Maintainer: Luciano Bello -Build-Depends: debhelper, libcurl3-dev, libmagic-dev, libpcre3-dev, libadns1-dev, bison, flex, libpcap0.8-dev, libcap-dev, dpatch -Standards-Version: 3.7.3 +Build-Depends: debhelper, libcurl3-dev, libmagic-dev, libpcre3-dev, libadns1-dev, bison, flex, libpcap0.8-dev, libcap2-dev, dpatch +Standards-Version: 3.8.0 Package: nepenthes Architecture: any diff -u nepenthes-0.2.2/debian/patches/00list nepenthes-0.2.2/debian/patches/00list --- nepenthes-0.2.2/debian/patches/00list +++ nepenthes-0.2.2/debian/patches/00list @@ -5 +5,3 @@ -05_warn_unused_result.dpatch +05_includes_for_gcc_4.4.dpatch +06_warn_unused_result.dpatch +07_includes_for_eglibc_2.10.dpatch reverted: --- nepenthes-0.2.2/debian/patches/05_warn_unused_result.dpatch +++ nepenthes-0.2.2.orig/debian/patches/05_warn_unused_result.dpatch @@ -1,470 +0,0 @@ -#! /bin/sh /usr/share/dpatch/dpatch-run -## 05_warn_unused_result.patch.dpatch by Iain Lane -## -## All lines beginning with `## DP:' are a description of the patch. -## DP: This package FTBFS with warn_unused_result and Werror without these changes. - -@DPATCH@ -diff -urNad nepenthes-0.2.2~/modules/download-creceive/CReceiveDialogue.cpp nepenthes-0.2.2/modules/download-creceive/CReceiveDialogue.cpp ---- nepenthes-0.2.2~/modules/download-creceive/CReceiveDialogue.cpp 2007-02-06 15:16:52.000000000 +0000 -+++ nepenthes-0.2.2/modules/download-creceive/CReceiveDialogue.cpp 2008-07-16 21:43:25.000000000 +0100 -@@ -72,6 +72,7 @@ - */ - CReceiveDialogue::CReceiveDialogue(Socket *socket)//, Download *down) - { -+ int res; - m_Socket = socket; - m_DialogueName = "CReceiveDialogue"; - m_DialogueDescription = "eXample Dialogue"; -@@ -80,7 +81,7 @@ - char *url; - uint32_t host = socket->getRemoteHost(); - uint16_t port = socket->getRemotePort(); -- asprintf(&url,"creceive://%s:%i",inet_ntoa(*(in_addr *)&host),port); -+ res = asprintf(&url,"creceive://%s:%i",inet_ntoa(*(in_addr *)&host),port); - m_Download = new Download(socket->getLocalHost(),url,socket->getRemoteHost(),url); - free(url); - } -diff -urNad nepenthes-0.2.2~/modules/download-curl/download-curl.cpp nepenthes-0.2.2/modules/download-curl/download-curl.cpp ---- nepenthes-0.2.2~/modules/download-curl/download-curl.cpp 2007-01-31 01:21:15.000000000 +0000 -+++ nepenthes-0.2.2/modules/download-curl/download-curl.cpp 2008-07-16 21:43:26.000000000 +0100 -@@ -224,8 +224,9 @@ - }else - if (down->getDownloadUrl()->getProtocol() == "ftp") - { -+ int res; - char *url; -- asprintf(&url,"ftp://%s:%i/%s", -+ res = asprintf(&url,"ftp://%s:%i/%s", - down->getDownloadUrl()->getHost().c_str(), - down->getDownloadUrl()->getPort(), - down->getDownloadUrl()->getPath().c_str()); -diff -urNad nepenthes-0.2.2~/modules/download-ftp/CTRLDialogue.cpp nepenthes-0.2.2/modules/download-ftp/CTRLDialogue.cpp ---- nepenthes-0.2.2~/modules/download-ftp/CTRLDialogue.cpp 2008-02-14 11:19:56.000000000 +0000 -+++ nepenthes-0.2.2/modules/download-ftp/CTRLDialogue.cpp 2008-07-16 21:43:26.000000000 +0100 -@@ -322,7 +322,8 @@ - void CTRLDialogue::sendUser() - { - char *msg; -- asprintf(&msg,"USER %s\r\n",m_Download->getDownloadUrl()->getUser().c_str()); -+ int res; -+ res = asprintf(&msg,"USER %s\r\n",m_Download->getDownloadUrl()->getUser().c_str()); - logDebug("FTPSEND: '%s'\n",msg); - m_Socket->doRespond(msg,strlen(msg)); - free(msg); -@@ -343,7 +344,8 @@ - void CTRLDialogue::sendPass() - { - char *nmsg; -- asprintf(&nmsg,"PASS %s\r\n",m_Download->getDownloadUrl()->getPass().c_str()); -+ int res; -+ res = asprintf(&nmsg,"PASS %s\r\n",m_Download->getDownloadUrl()->getPass().c_str()); - logDebug("FTPSEND: '%s'\n",nmsg); - m_Socket->doRespond(nmsg,strlen(nmsg)); - free(nmsg); -@@ -393,6 +395,7 @@ - uint32_t ip; - uint16_t minport; - uint16_t maxport; -+ int res; - - if ( g_FTPDownloadHandler->getRetrAddress() == 0 ) - { // no NAT settings -@@ -455,7 +458,7 @@ - char *nmsg; - - -- asprintf(&nmsg,"PORT %d,%d,%d,%d,%d,%d\r\n", -+ res = asprintf(&nmsg,"PORT %d,%d,%d,%d,%d,%d\r\n", - #if BYTE_ORDER == BIG_ENDIAN - (int32_t)(ip >> 24) & 0xff, - (int32_t)(ip >> 16) & 0xff, -@@ -493,7 +496,8 @@ - { - - char *nmsg; -- asprintf(&nmsg,"RETR %s\r\n",m_Download->getDownloadUrl()->getFile().c_str()); -+ int res; -+ res = asprintf(&nmsg,"RETR %s\r\n",m_Download->getDownloadUrl()->getFile().c_str()); - logDebug("FTPSEND: '%s'\n",nmsg); - m_Socket->doRespond(nmsg,strlen(nmsg)); - free(nmsg); -@@ -536,7 +540,8 @@ - void CTRLDialogue::sendCWD() - { - char *nmsg; -- asprintf(&nmsg,"CWD %s\r\n",m_Download->getDownloadUrl()->getDir().c_str()); -+ int res; -+ res = asprintf(&nmsg,"CWD %s\r\n",m_Download->getDownloadUrl()->getDir().c_str()); - logDebug("FTPSEND: '%s'\n",nmsg); - m_Socket->doRespond(nmsg,strlen(nmsg)); - free(nmsg); -diff -urNad nepenthes-0.2.2~/modules/download-http/HTTPDialogue.cpp nepenthes-0.2.2/modules/download-http/HTTPDialogue.cpp ---- nepenthes-0.2.2~/modules/download-http/HTTPDialogue.cpp 2008-07-16 21:36:38.000000000 +0100 -+++ nepenthes-0.2.2/modules/download-http/HTTPDialogue.cpp 2008-07-16 21:43:26.000000000 +0100 -@@ -254,7 +254,8 @@ - logPF(); - - char *request; -- asprintf(&request, -+ int res; -+ res = asprintf(&request, - "GET /%s HTTP/1.0\r\n" - "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n" - "Accept: */*\r\n" -diff -urNad nepenthes-0.2.2~/modules/module-honeytrap/PCAPSocket.cpp nepenthes-0.2.2/modules/module-honeytrap/PCAPSocket.cpp ---- nepenthes-0.2.2~/modules/module-honeytrap/PCAPSocket.cpp 2008-07-16 21:36:38.000000000 +0100 -+++ nepenthes-0.2.2/modules/module-honeytrap/PCAPSocket.cpp 2008-07-16 21:43:26.000000000 +0100 -@@ -182,7 +182,8 @@ - string lhost = inet_ntoa(*(in_addr *)&m_LocalHost); - - char *bpffilter; -- asprintf(&bpffilter, -+ int res; -+ res = asprintf(&bpffilter, - "(src host %s and src port %i and dst host %s and dst port %i)" - " or " - "(src host %s and src port %i and dst host %s and dst port %i)", -@@ -228,7 +229,7 @@ - - char *pcap_file_path; - -- asprintf(&pcap_file_path,"%s/%i_%s-%i_%s-%i.pcap", -+ res = asprintf(&pcap_file_path,"%s/%i_%s-%i_%s-%i.pcap", - g_ModuleHoneytrap->getPcapPath().c_str(), - (int)time(NULL), - rhost.c_str(),getRemotePort(), -diff -urNad nepenthes-0.2.2~/modules/module-peiros/PeirosParser.cpp nepenthes-0.2.2/modules/module-peiros/PeirosParser.cpp ---- nepenthes-0.2.2~/modules/module-peiros/PeirosParser.cpp 2008-07-16 21:36:38.000000000 +0100 -+++ nepenthes-0.2.2/modules/module-peiros/PeirosParser.cpp 2008-07-16 21:43:25.000000000 +0100 -@@ -240,8 +240,9 @@ - if(!request->appendedData.empty()) - { - char * lengthHeader; -+ int res; - -- asprintf(&lengthHeader, "Content-length: %u\r\n", (int)request->appendedData.size()); -+ res = asprintf(&lengthHeader, "Content-length: %u\r\n", (int)request->appendedData.size()); - result += lengthHeader; - free(lengthHeader); - } -diff -urNad nepenthes-0.2.2~/modules/shellcode-generic/sch_generic_connect_trans.cpp nepenthes-0.2.2/modules/shellcode-generic/sch_generic_connect_trans.cpp ---- nepenthes-0.2.2~/modules/shellcode-generic/sch_generic_connect_trans.cpp 2006-05-04 11:25:40.000000000 +0100 -+++ nepenthes-0.2.2/modules/shellcode-generic/sch_generic_connect_trans.cpp 2008-07-16 21:44:17.000000000 +0100 -@@ -179,7 +179,8 @@ - - - char *url; -- asprintf(&url,"csend://%s:%d/%i",inet_ntoa(*(in_addr *)&host), port, (*it)->m_Offset); -+ int res; -+ res = asprintf(&url,"csend://%s:%d/%i",inet_ntoa(*(in_addr *)&host), port, (*it)->m_Offset); - g_Nepenthes->getDownloadMgr()->downloadUrl((*msg)->getLocalHost(),url, (*msg)->getRemoteHost(), url,0); - free(url); - -diff -urNad nepenthes-0.2.2~/modules/shellcode-generic/sch_generic_link_bind_trans.cpp nepenthes-0.2.2/modules/shellcode-generic/sch_generic_link_bind_trans.cpp ---- nepenthes-0.2.2~/modules/shellcode-generic/sch_generic_link_bind_trans.cpp 2008-07-16 21:36:38.000000000 +0100 -+++ nepenthes-0.2.2/modules/shellcode-generic/sch_generic_link_bind_trans.cpp 2008-07-16 21:49:36.000000000 +0100 -@@ -166,7 +166,8 @@ - unsigned char *base64Key = g_Nepenthes->getUtilities()->b64encode_alloc(authKey,4); - - uint32_t remoteHost = (*msg)->getRemoteHost(); -- asprintf(&url,"blink://%s:%i/%s",inet_ntoa(*(in_addr *)&remoteHost),port,base64Key); -+ int res; -+ res = asprintf(&url,"blink://%s:%i/%s",inet_ntoa(*(in_addr *)&remoteHost),port,base64Key); - g_Nepenthes->getDownloadMgr()->downloadUrl((*msg)->getLocalHost(),url,(*msg)->getRemoteHost(),url,0); - free(url); - free(base64Key); -diff -urNad nepenthes-0.2.2~/modules/shellcode-generic/sch_generic_link_trans.cpp nepenthes-0.2.2/modules/shellcode-generic/sch_generic_link_trans.cpp ---- nepenthes-0.2.2~/modules/shellcode-generic/sch_generic_link_trans.cpp 2008-07-16 21:36:38.000000000 +0100 -+++ nepenthes-0.2.2/modules/shellcode-generic/sch_generic_link_trans.cpp 2008-07-16 21:43:26.000000000 +0100 -@@ -161,8 +161,9 @@ - - char *url; - unsigned char *base64Key = g_Nepenthes->getUtilities()->b64encode_alloc(authKey,4); -+ int res; - -- asprintf(&url,"link://%s:%i/%s",inet_ntoa(*(in_addr *)&address),port,base64Key); -+ res = asprintf(&url,"link://%s:%i/%s",inet_ntoa(*(in_addr *)&address),port,base64Key); - g_Nepenthes->getDownloadMgr()->downloadUrl((*msg)->getLocalHost(),url,(*msg)->getRemoteHost(),url,0); - free(url); - free(base64Key); -diff -urNad nepenthes-0.2.2~/modules/shellcode-generic/sch_generic_stuttgart.cpp nepenthes-0.2.2/modules/shellcode-generic/sch_generic_stuttgart.cpp ---- nepenthes-0.2.2~/modules/shellcode-generic/sch_generic_stuttgart.cpp 2008-07-16 21:36:38.000000000 +0100 -+++ nepenthes-0.2.2/modules/shellcode-generic/sch_generic_stuttgart.cpp 2008-07-16 21:44:44.000000000 +0100 -@@ -156,8 +156,9 @@ - - char *url; - unsigned char *base64Key = g_Nepenthes->getUtilities()->b64encode_alloc(authKey,4); -+ int res; - -- asprintf(&url,"link://%s:%i/%s",inet_ntoa(*(in_addr *)&address),port,base64Key); -+ res = asprintf(&url,"link://%s:%i/%s",inet_ntoa(*(in_addr *)&address),port,base64Key); - g_Nepenthes->getDownloadMgr()->downloadUrl((*msg)->getLocalHost(),url,(*msg)->getRemoteHost(),url,0); - free(url); - free(base64Key); -diff -urNad nepenthes-0.2.2~/modules/shellcode-generic/sch_generic_wuerzburg.cpp nepenthes-0.2.2/modules/shellcode-generic/sch_generic_wuerzburg.cpp ---- nepenthes-0.2.2~/modules/shellcode-generic/sch_generic_wuerzburg.cpp 2008-07-16 21:36:38.000000000 +0100 -+++ nepenthes-0.2.2/modules/shellcode-generic/sch_generic_wuerzburg.cpp 2008-07-16 21:43:26.000000000 +0100 -@@ -151,8 +151,9 @@ - inet_ntoa(*(in_addr *)&address), port); - - char *url; -+ int res; - -- asprintf(&url,"csend://%s:%d",inet_ntoa(*(in_addr *)&address), port); -+ res = asprintf(&url,"csend://%s:%d",inet_ntoa(*(in_addr *)&address), port); - g_Nepenthes->getDownloadMgr()->downloadUrl((*msg)->getLocalHost(),url, (*msg)->getRemoteHost(), url,0); - free(url); - -diff -urNad nepenthes-0.2.2~/modules/shellcode-signatures/sch_namespace_bindfiletransfer.cpp nepenthes-0.2.2/modules/shellcode-signatures/sch_namespace_bindfiletransfer.cpp ---- nepenthes-0.2.2~/modules/shellcode-signatures/sch_namespace_bindfiletransfer.cpp 2006-04-08 19:40:17.000000000 +0100 -+++ nepenthes-0.2.2/modules/shellcode-signatures/sch_namespace_bindfiletransfer.cpp 2008-07-16 21:50:22.000000000 +0100 -@@ -133,8 +133,9 @@ - - char *url; - unsigned char *base64Key = g_Nepenthes->getUtilities()->b64encode_alloc(authKey,4); -+ int res; - -- asprintf(&url,"blink://%s:%i/%s",inet_ntoa(*(in_addr *)&host),port,base64Key); -+ res = asprintf(&url,"blink://%s:%i/%s",inet_ntoa(*(in_addr *)&host),port,base64Key); - g_Nepenthes->getDownloadMgr()->downloadUrl((*msg)->getLocalHost(),url,(*msg)->getRemoteHost(),url,0); - free(url); - free(base64Key); -@@ -143,7 +144,8 @@ - logInfo("%s -> %s:%u \n",m_ShellcodeHandlerName.c_str(), inet_ntoa(*(in_addr *)&host), port); - - char *url; -- asprintf(&url,"creceive://%s:%d/%i",inet_ntoa(*(in_addr *)&host), port, 0); -+ int res; -+ res = asprintf(&url,"creceive://%s:%d/%i",inet_ntoa(*(in_addr *)&host), port, 0); - g_Nepenthes->getDownloadMgr()->downloadUrl((*msg)->getLocalHost(),url, (*msg)->getRemoteHost(), url,0); - free(url); - -diff -urNad nepenthes-0.2.2~/modules/shellcode-signatures/sch_namespace_connectbackfiletransfer.cpp nepenthes-0.2.2/modules/shellcode-signatures/sch_namespace_connectbackfiletransfer.cpp ---- nepenthes-0.2.2~/modules/shellcode-signatures/sch_namespace_connectbackfiletransfer.cpp 2006-04-08 19:40:18.000000000 +0100 -+++ nepenthes-0.2.2/modules/shellcode-signatures/sch_namespace_connectbackfiletransfer.cpp 2008-07-16 21:47:42.000000000 +0100 -@@ -145,8 +145,9 @@ - - char *url; - unsigned char *base64Key = g_Nepenthes->getUtilities()->b64encode_alloc(authKey,4); -- -- asprintf(&url,"link://%s:%i/%s",inet_ntoa(*(in_addr *)&host),port,base64Key); -+ int res; -+ -+ res = asprintf(&url,"link://%s:%i/%s",inet_ntoa(*(in_addr *)&host),port,base64Key); - g_Nepenthes->getDownloadMgr()->downloadUrl((*msg)->getLocalHost(),url,(*msg)->getRemoteHost(),url,0); - free(url); - free(base64Key); -@@ -155,7 +156,9 @@ - logInfo("%s -> %s:%u \n",m_ShellcodeHandlerName.c_str(), inet_ntoa(*(in_addr *)&host), port); - - char *url; -- asprintf(&url,"csend://%s:%d/%i",inet_ntoa(*(in_addr *)&host), port, 0); -+ int res; -+ -+ res = asprintf(&url,"csend://%s:%d/%i",inet_ntoa(*(in_addr *)&host), port, 0); - g_Nepenthes->getDownloadMgr()->downloadUrl((*msg)->getLocalHost(),url, (*msg)->getRemoteHost(), url,0); - free(url); - -diff -urNad nepenthes-0.2.2~/modules/submit-gotek/submit-gotek.cpp nepenthes-0.2.2/modules/submit-gotek/submit-gotek.cpp ---- nepenthes-0.2.2~/modules/submit-gotek/submit-gotek.cpp 2008-07-16 21:36:38.000000000 +0100 -+++ nepenthes-0.2.2/modules/submit-gotek/submit-gotek.cpp 2008-07-16 21:48:10.000000000 +0100 -@@ -274,8 +274,9 @@ - { - { // TODO substitute with clean std::string solution - char * temp; -+ int res; - -- asprintf(&temp, "sample-%u-%03u", (unsigned int) time(NULL), rand() % 1000); -+ res = asprintf(&temp, "sample-%u-%03u", (unsigned int) time(NULL), rand() % 1000); - fileName += temp; - free(temp); - } -diff -urNad nepenthes-0.2.2~/modules/submit-postgres/PGDownloadContext.cpp nepenthes-0.2.2/modules/submit-postgres/PGDownloadContext.cpp ---- nepenthes-0.2.2~/modules/submit-postgres/PGDownloadContext.cpp 2008-07-16 21:36:38.000000000 +0100 -+++ nepenthes-0.2.2/modules/submit-postgres/PGDownloadContext.cpp 2008-07-16 21:53:22.000000000 +0100 -@@ -117,7 +117,8 @@ - unsigned char *data = (unsigned char *)malloc(s.st_size); - memset(data,0,s.st_size); - FILE *f = fopen(path,"r"); -- fread(data,1,s.st_size,f); -+ size_t nbytes; -+ nbytes = fread(data,1,s.st_size,f); - fclose(f); - - Bencoding_Context *c = Bencoding_createContext(); -@@ -296,8 +297,9 @@ - benc.append(m_FileContent); - benc += "e"; - -+ size_t nbytes; - -- fwrite(benc.data(),1,benc.size(),f); -+ nbytes = fwrite(benc.data(),1,benc.size(),f); - - fclose(f); - logDebug("Wrote bencoded spoolfile %s (%i bytes)\n",m_FilePath.c_str(),benc.size()); -diff -urNad nepenthes-0.2.2~/modules/vuln-ssh/SSHSocket.cpp nepenthes-0.2.2/modules/vuln-ssh/SSHSocket.cpp ---- nepenthes-0.2.2~/modules/vuln-ssh/SSHSocket.cpp 2006-05-04 11:25:42.000000000 +0100 -+++ nepenthes-0.2.2/modules/vuln-ssh/SSHSocket.cpp 2008-07-16 21:48:30.000000000 +0100 -@@ -272,7 +272,8 @@ - ssh_message_channel_request_reply_success(message); - - char *welcome; -- asprintf(&welcome,"Last login: Mon Jan 12 22:03:55 2005 from 212.54.21.23\n\r%s@nepenthes:~$ ",m_User.c_str()); -+ int res; -+ res = asprintf(&welcome,"Last login: Mon Jan 12 22:03:55 2005 from 212.54.21.23\n\r%s@nepenthes:~$ ",m_User.c_str()); - channel_write(m_Channel,(void *)welcome,strlen(welcome)); - free(welcome); - -diff -urNad nepenthes-0.2.2~/modules/x-6/x-6.cpp nepenthes-0.2.2/modules/x-6/x-6.cpp ---- nepenthes-0.2.2~/modules/x-6/x-6.cpp 2008-07-16 21:36:38.000000000 +0100 -+++ nepenthes-0.2.2/modules/x-6/x-6.cpp 2008-07-16 21:51:18.000000000 +0100 -@@ -304,7 +304,8 @@ - printf("NUM %i\n",(int)i); - logSpam( "domain %s has ip %s \n",result->getDNS().c_str(),inet_ntoa(*(in_addr *)&*it)); - char *reply; -- asprintf(&reply,"domain %s has A %s (context %08x)\n",result->getDNS().c_str(), inet_ntoa(*(in_addr *)&*it), (uint32_t)((intptr_t)result->getObject())); -+ int res; -+ res = asprintf(&reply,"domain %s has A %s (context %08x)\n",result->getDNS().c_str(), inet_ntoa(*(in_addr *)&*it), (uint32_t)((intptr_t)result->getObject())); - m_Socket->doRespond(reply,strlen(reply)); - free(reply); - -@@ -341,7 +342,8 @@ - { - logSpam("domain %s has no A, resolve error\n",result->getDNS().c_str()); - char *reply; -- asprintf(&reply,"domain '%s' could not resolve A\n", result->getDNS().c_str()); -+ int res; -+ res = asprintf(&reply,"domain '%s' could not resolve A\n", result->getDNS().c_str()); - m_Socket->doRespond(reply,strlen(reply)); - free(reply); - } else -@@ -349,7 +351,8 @@ - { - logSpam("domain %s has no TXT, resolve error\n",result->getDNS().c_str()); - char *reply; -- asprintf(&reply,"domain '%s' could not resolve TXT\n", result->getDNS().c_str()); -+ int res; -+ res = asprintf(&reply,"domain '%s' could not resolve TXT\n", result->getDNS().c_str()); - m_Socket->doRespond(reply,strlen(reply)); - free(reply); - } -diff -urNad nepenthes-0.2.2~/nepenthes-core/src/Config.cpp nepenthes-0.2.2/nepenthes-core/src/Config.cpp ---- nepenthes-0.2.2~/nepenthes-core/src/Config.cpp 2008-07-16 20:17:20.000000000 +0100 -+++ nepenthes-0.2.2/nepenthes-core/src/Config.cpp 2008-07-16 21:36:38.000000000 +0100 -@@ -142,6 +142,7 @@ - - void Config::load(const char *filename) - { -+ - #ifdef WIN32 - struct _stat file; - #else -@@ -159,7 +160,7 @@ - - data = (unsigned char *)malloc(file.st_size); - FILE *f = fopen(filename,"rb"); -- fread(data,1,file.st_size,f); -+ size_t nbytes = fread(data,1,file.st_size,f); - fclose(f); - - #else -diff -urNad nepenthes-0.2.2~/nepenthes-core/src/DownloadManager.cpp nepenthes-0.2.2/nepenthes-core/src/DownloadManager.cpp ---- nepenthes-0.2.2~/nepenthes-core/src/DownloadManager.cpp 2008-07-16 20:17:20.000000000 +0100 -+++ nepenthes-0.2.2/nepenthes-core/src/DownloadManager.cpp 2008-07-16 21:36:38.000000000 +0100 -@@ -333,6 +333,7 @@ - - if ( bReplaceHost ) - { -+ int res; - string sUrl = down->getDownloadUrl()->getProtocol(); - sUrl += "://"; - -@@ -342,7 +343,7 @@ - logInfo("Replaced Address, new URL is %s \n",sUrl.c_str()); - - char *port; -- asprintf(&port,":%i/",down->getDownloadUrl()->getPort()); -+ res = asprintf(&port,":%i/",down->getDownloadUrl()->getPort()); - sUrl += port; - free(port); - -diff -urNad nepenthes-0.2.2~/nepenthes-core/src/LogManager.cpp nepenthes-0.2.2/nepenthes-core/src/LogManager.cpp ---- nepenthes-0.2.2~/nepenthes-core/src/LogManager.cpp 2008-07-16 21:36:38.000000000 +0100 -+++ nepenthes-0.2.2/nepenthes-core/src/LogManager.cpp 2008-07-16 21:36:38.000000000 +0100 -@@ -170,6 +170,7 @@ - void LogManager::logf(uint32_t mask, const char *format, ...) - { - va_list ap; -+ int res; - - - va_start(ap, format); -@@ -186,7 +187,7 @@ - va_end(ap); - #else - char *message; -- vasprintf(&message, format, ap); -+ res = vasprintf(&message, format, ap); - va_end(ap); - - log(mask, message); -diff -urNad nepenthes-0.2.2~/nepenthes-core/src/Nepenthes.cpp nepenthes-0.2.2/nepenthes-core/src/Nepenthes.cpp ---- nepenthes-0.2.2~/nepenthes-core/src/Nepenthes.cpp 2008-07-16 21:36:38.000000000 +0100 -+++ nepenthes-0.2.2/nepenthes-core/src/Nepenthes.cpp 2008-07-16 21:36:38.000000000 +0100 -@@ -516,8 +516,9 @@ - - if (opt.m_daemonize == true) - { -+ int res; - logInfo("running as daemon\n"); -- daemon(1,0); -+ res = daemon(1,0); - logInfo("daemon process id is %i\n",getpid()); - } - -@@ -817,7 +818,8 @@ - return -1; - } else - { -- fread(buffer,1,filesize,f); -+ size_t nbytes; -+ nbytes = fread(buffer,1,filesize,f); - fclose(f); - - uint32_t i; -diff -urNad nepenthes-0.2.2~/nepenthes-core/src/RingFileLogger.cpp nepenthes-0.2.2/nepenthes-core/src/RingFileLogger.cpp ---- nepenthes-0.2.2~/nepenthes-core/src/RingFileLogger.cpp 2008-07-16 21:36:38.000000000 +0100 -+++ nepenthes-0.2.2/nepenthes-core/src/RingFileLogger.cpp 2008-07-16 21:36:38.000000000 +0100 -@@ -79,6 +79,8 @@ - - void RingFileLogger::setLogFileFormat(char *fmt) - { -+ int res; -+ - if (m_FileFormat != NULL) - { - free(m_FileFormat); -@@ -90,7 +92,7 @@ - { - free(m_FirstFile); - } -- asprintf(&m_FirstFile, m_FileFormat, 0); -+ res = asprintf(&m_FirstFile, m_FileFormat, 0); - } - - void RingFileLogger::setMaxFiles(uint8_t count) -diff -urNad nepenthes-0.2.2~/nepenthes-core/src/Utilities.cpp nepenthes-0.2.2/nepenthes-core/src/Utilities.cpp ---- nepenthes-0.2.2~/nepenthes-core/src/Utilities.cpp 2008-07-16 21:36:38.000000000 +0100 -+++ nepenthes-0.2.2/nepenthes-core/src/Utilities.cpp 2008-07-16 21:36:38.000000000 +0100 -@@ -370,7 +370,8 @@ - - if( (f = fopen(md5.c_str(), "wb")) ) - { -- fwrite((const void *)data, len, 1, f); -+ size_t nbytes; -+ nbytes = fwrite((const void *)data, len, 1, f); - fclose(f); - - g_Nepenthes->getLogMgr()->logf(mask,"Stored Hexdump %s (0x%08x , 0x%08x).\n", md5.c_str(), (uint32_t)((intptr_t)data), len); only in patch2: unchanged: --- nepenthes-0.2.2.orig/debian/patches/06_warn_unused_result.dpatch +++ nepenthes-0.2.2/debian/patches/06_warn_unused_result.dpatch @@ -0,0 +1,470 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 05_warn_unused_result.patch.dpatch by Iain Lane +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: This package FTBFS with warn_unused_result and Werror without these changes. + +@DPATCH@ +diff -urNad nepenthes-0.2.2~/modules/download-creceive/CReceiveDialogue.cpp nepenthes-0.2.2/modules/download-creceive/CReceiveDialogue.cpp +--- nepenthes-0.2.2~/modules/download-creceive/CReceiveDialogue.cpp 2007-02-06 15:16:52.000000000 +0000 ++++ nepenthes-0.2.2/modules/download-creceive/CReceiveDialogue.cpp 2008-07-16 21:43:25.000000000 +0100 +@@ -72,6 +72,7 @@ + */ + CReceiveDialogue::CReceiveDialogue(Socket *socket)//, Download *down) + { ++ int res; + m_Socket = socket; + m_DialogueName = "CReceiveDialogue"; + m_DialogueDescription = "eXample Dialogue"; +@@ -80,7 +81,7 @@ + char *url; + uint32_t host = socket->getRemoteHost(); + uint16_t port = socket->getRemotePort(); +- asprintf(&url,"creceive://%s:%i",inet_ntoa(*(in_addr *)&host),port); ++ res = asprintf(&url,"creceive://%s:%i",inet_ntoa(*(in_addr *)&host),port); + m_Download = new Download(socket->getLocalHost(),url,socket->getRemoteHost(),url); + free(url); + } +diff -urNad nepenthes-0.2.2~/modules/download-curl/download-curl.cpp nepenthes-0.2.2/modules/download-curl/download-curl.cpp +--- nepenthes-0.2.2~/modules/download-curl/download-curl.cpp 2007-01-31 01:21:15.000000000 +0000 ++++ nepenthes-0.2.2/modules/download-curl/download-curl.cpp 2008-07-16 21:43:26.000000000 +0100 +@@ -224,8 +224,9 @@ + }else + if (down->getDownloadUrl()->getProtocol() == "ftp") + { ++ int res; + char *url; +- asprintf(&url,"ftp://%s:%i/%s", ++ res = asprintf(&url,"ftp://%s:%i/%s", + down->getDownloadUrl()->getHost().c_str(), + down->getDownloadUrl()->getPort(), + down->getDownloadUrl()->getPath().c_str()); +diff -urNad nepenthes-0.2.2~/modules/download-ftp/CTRLDialogue.cpp nepenthes-0.2.2/modules/download-ftp/CTRLDialogue.cpp +--- nepenthes-0.2.2~/modules/download-ftp/CTRLDialogue.cpp 2008-02-14 11:19:56.000000000 +0000 ++++ nepenthes-0.2.2/modules/download-ftp/CTRLDialogue.cpp 2008-07-16 21:43:26.000000000 +0100 +@@ -322,7 +322,8 @@ + void CTRLDialogue::sendUser() + { + char *msg; +- asprintf(&msg,"USER %s\r\n",m_Download->getDownloadUrl()->getUser().c_str()); ++ int res; ++ res = asprintf(&msg,"USER %s\r\n",m_Download->getDownloadUrl()->getUser().c_str()); + logDebug("FTPSEND: '%s'\n",msg); + m_Socket->doRespond(msg,strlen(msg)); + free(msg); +@@ -343,7 +344,8 @@ + void CTRLDialogue::sendPass() + { + char *nmsg; +- asprintf(&nmsg,"PASS %s\r\n",m_Download->getDownloadUrl()->getPass().c_str()); ++ int res; ++ res = asprintf(&nmsg,"PASS %s\r\n",m_Download->getDownloadUrl()->getPass().c_str()); + logDebug("FTPSEND: '%s'\n",nmsg); + m_Socket->doRespond(nmsg,strlen(nmsg)); + free(nmsg); +@@ -393,6 +395,7 @@ + uint32_t ip; + uint16_t minport; + uint16_t maxport; ++ int res; + + if ( g_FTPDownloadHandler->getRetrAddress() == 0 ) + { // no NAT settings +@@ -455,7 +458,7 @@ + char *nmsg; + + +- asprintf(&nmsg,"PORT %d,%d,%d,%d,%d,%d\r\n", ++ res = asprintf(&nmsg,"PORT %d,%d,%d,%d,%d,%d\r\n", + #if BYTE_ORDER == BIG_ENDIAN + (int32_t)(ip >> 24) & 0xff, + (int32_t)(ip >> 16) & 0xff, +@@ -493,7 +496,8 @@ + { + + char *nmsg; +- asprintf(&nmsg,"RETR %s\r\n",m_Download->getDownloadUrl()->getFile().c_str()); ++ int res; ++ res = asprintf(&nmsg,"RETR %s\r\n",m_Download->getDownloadUrl()->getFile().c_str()); + logDebug("FTPSEND: '%s'\n",nmsg); + m_Socket->doRespond(nmsg,strlen(nmsg)); + free(nmsg); +@@ -536,7 +540,8 @@ + void CTRLDialogue::sendCWD() + { + char *nmsg; +- asprintf(&nmsg,"CWD %s\r\n",m_Download->getDownloadUrl()->getDir().c_str()); ++ int res; ++ res = asprintf(&nmsg,"CWD %s\r\n",m_Download->getDownloadUrl()->getDir().c_str()); + logDebug("FTPSEND: '%s'\n",nmsg); + m_Socket->doRespond(nmsg,strlen(nmsg)); + free(nmsg); +diff -urNad nepenthes-0.2.2~/modules/download-http/HTTPDialogue.cpp nepenthes-0.2.2/modules/download-http/HTTPDialogue.cpp +--- nepenthes-0.2.2~/modules/download-http/HTTPDialogue.cpp 2008-07-16 21:36:38.000000000 +0100 ++++ nepenthes-0.2.2/modules/download-http/HTTPDialogue.cpp 2008-07-16 21:43:26.000000000 +0100 +@@ -254,7 +254,8 @@ + logPF(); + + char *request; +- asprintf(&request, ++ int res; ++ res = asprintf(&request, + "GET /%s HTTP/1.0\r\n" + "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n" + "Accept: */*\r\n" +diff -urNad nepenthes-0.2.2~/modules/module-honeytrap/PCAPSocket.cpp nepenthes-0.2.2/modules/module-honeytrap/PCAPSocket.cpp +--- nepenthes-0.2.2~/modules/module-honeytrap/PCAPSocket.cpp 2008-07-16 21:36:38.000000000 +0100 ++++ nepenthes-0.2.2/modules/module-honeytrap/PCAPSocket.cpp 2008-07-16 21:43:26.000000000 +0100 +@@ -182,7 +182,8 @@ + string lhost = inet_ntoa(*(in_addr *)&m_LocalHost); + + char *bpffilter; +- asprintf(&bpffilter, ++ int res; ++ res = asprintf(&bpffilter, + "(src host %s and src port %i and dst host %s and dst port %i)" + " or " + "(src host %s and src port %i and dst host %s and dst port %i)", +@@ -228,7 +229,7 @@ + + char *pcap_file_path; + +- asprintf(&pcap_file_path,"%s/%i_%s-%i_%s-%i.pcap", ++ res = asprintf(&pcap_file_path,"%s/%i_%s-%i_%s-%i.pcap", + g_ModuleHoneytrap->getPcapPath().c_str(), + (int)time(NULL), + rhost.c_str(),getRemotePort(), +diff -urNad nepenthes-0.2.2~/modules/module-peiros/PeirosParser.cpp nepenthes-0.2.2/modules/module-peiros/PeirosParser.cpp +--- nepenthes-0.2.2~/modules/module-peiros/PeirosParser.cpp 2008-07-16 21:36:38.000000000 +0100 ++++ nepenthes-0.2.2/modules/module-peiros/PeirosParser.cpp 2008-07-16 21:43:25.000000000 +0100 +@@ -240,8 +240,9 @@ + if(!request->appendedData.empty()) + { + char * lengthHeader; ++ int res; + +- asprintf(&lengthHeader, "Content-length: %u\r\n", (int)request->appendedData.size()); ++ res = asprintf(&lengthHeader, "Content-length: %u\r\n", (int)request->appendedData.size()); + result += lengthHeader; + free(lengthHeader); + } +diff -urNad nepenthes-0.2.2~/modules/shellcode-generic/sch_generic_connect_trans.cpp nepenthes-0.2.2/modules/shellcode-generic/sch_generic_connect_trans.cpp +--- nepenthes-0.2.2~/modules/shellcode-generic/sch_generic_connect_trans.cpp 2006-05-04 11:25:40.000000000 +0100 ++++ nepenthes-0.2.2/modules/shellcode-generic/sch_generic_connect_trans.cpp 2008-07-16 21:44:17.000000000 +0100 +@@ -179,7 +179,8 @@ + + + char *url; +- asprintf(&url,"csend://%s:%d/%i",inet_ntoa(*(in_addr *)&host), port, (*it)->m_Offset); ++ int res; ++ res = asprintf(&url,"csend://%s:%d/%i",inet_ntoa(*(in_addr *)&host), port, (*it)->m_Offset); + g_Nepenthes->getDownloadMgr()->downloadUrl((*msg)->getLocalHost(),url, (*msg)->getRemoteHost(), url,0); + free(url); + +diff -urNad nepenthes-0.2.2~/modules/shellcode-generic/sch_generic_link_bind_trans.cpp nepenthes-0.2.2/modules/shellcode-generic/sch_generic_link_bind_trans.cpp +--- nepenthes-0.2.2~/modules/shellcode-generic/sch_generic_link_bind_trans.cpp 2008-07-16 21:36:38.000000000 +0100 ++++ nepenthes-0.2.2/modules/shellcode-generic/sch_generic_link_bind_trans.cpp 2008-07-16 21:49:36.000000000 +0100 +@@ -166,7 +166,8 @@ + unsigned char *base64Key = g_Nepenthes->getUtilities()->b64encode_alloc(authKey,4); + + uint32_t remoteHost = (*msg)->getRemoteHost(); +- asprintf(&url,"blink://%s:%i/%s",inet_ntoa(*(in_addr *)&remoteHost),port,base64Key); ++ int res; ++ res = asprintf(&url,"blink://%s:%i/%s",inet_ntoa(*(in_addr *)&remoteHost),port,base64Key); + g_Nepenthes->getDownloadMgr()->downloadUrl((*msg)->getLocalHost(),url,(*msg)->getRemoteHost(),url,0); + free(url); + free(base64Key); +diff -urNad nepenthes-0.2.2~/modules/shellcode-generic/sch_generic_link_trans.cpp nepenthes-0.2.2/modules/shellcode-generic/sch_generic_link_trans.cpp +--- nepenthes-0.2.2~/modules/shellcode-generic/sch_generic_link_trans.cpp 2008-07-16 21:36:38.000000000 +0100 ++++ nepenthes-0.2.2/modules/shellcode-generic/sch_generic_link_trans.cpp 2008-07-16 21:43:26.000000000 +0100 +@@ -161,8 +161,9 @@ + + char *url; + unsigned char *base64Key = g_Nepenthes->getUtilities()->b64encode_alloc(authKey,4); ++ int res; + +- asprintf(&url,"link://%s:%i/%s",inet_ntoa(*(in_addr *)&address),port,base64Key); ++ res = asprintf(&url,"link://%s:%i/%s",inet_ntoa(*(in_addr *)&address),port,base64Key); + g_Nepenthes->getDownloadMgr()->downloadUrl((*msg)->getLocalHost(),url,(*msg)->getRemoteHost(),url,0); + free(url); + free(base64Key); +diff -urNad nepenthes-0.2.2~/modules/shellcode-generic/sch_generic_stuttgart.cpp nepenthes-0.2.2/modules/shellcode-generic/sch_generic_stuttgart.cpp +--- nepenthes-0.2.2~/modules/shellcode-generic/sch_generic_stuttgart.cpp 2008-07-16 21:36:38.000000000 +0100 ++++ nepenthes-0.2.2/modules/shellcode-generic/sch_generic_stuttgart.cpp 2008-07-16 21:44:44.000000000 +0100 +@@ -156,8 +156,9 @@ + + char *url; + unsigned char *base64Key = g_Nepenthes->getUtilities()->b64encode_alloc(authKey,4); ++ int res; + +- asprintf(&url,"link://%s:%i/%s",inet_ntoa(*(in_addr *)&address),port,base64Key); ++ res = asprintf(&url,"link://%s:%i/%s",inet_ntoa(*(in_addr *)&address),port,base64Key); + g_Nepenthes->getDownloadMgr()->downloadUrl((*msg)->getLocalHost(),url,(*msg)->getRemoteHost(),url,0); + free(url); + free(base64Key); +diff -urNad nepenthes-0.2.2~/modules/shellcode-generic/sch_generic_wuerzburg.cpp nepenthes-0.2.2/modules/shellcode-generic/sch_generic_wuerzburg.cpp +--- nepenthes-0.2.2~/modules/shellcode-generic/sch_generic_wuerzburg.cpp 2008-07-16 21:36:38.000000000 +0100 ++++ nepenthes-0.2.2/modules/shellcode-generic/sch_generic_wuerzburg.cpp 2008-07-16 21:43:26.000000000 +0100 +@@ -151,8 +151,9 @@ + inet_ntoa(*(in_addr *)&address), port); + + char *url; ++ int res; + +- asprintf(&url,"csend://%s:%d",inet_ntoa(*(in_addr *)&address), port); ++ res = asprintf(&url,"csend://%s:%d",inet_ntoa(*(in_addr *)&address), port); + g_Nepenthes->getDownloadMgr()->downloadUrl((*msg)->getLocalHost(),url, (*msg)->getRemoteHost(), url,0); + free(url); + +diff -urNad nepenthes-0.2.2~/modules/shellcode-signatures/sch_namespace_bindfiletransfer.cpp nepenthes-0.2.2/modules/shellcode-signatures/sch_namespace_bindfiletransfer.cpp +--- nepenthes-0.2.2~/modules/shellcode-signatures/sch_namespace_bindfiletransfer.cpp 2006-04-08 19:40:17.000000000 +0100 ++++ nepenthes-0.2.2/modules/shellcode-signatures/sch_namespace_bindfiletransfer.cpp 2008-07-16 21:50:22.000000000 +0100 +@@ -133,8 +133,9 @@ + + char *url; + unsigned char *base64Key = g_Nepenthes->getUtilities()->b64encode_alloc(authKey,4); ++ int res; + +- asprintf(&url,"blink://%s:%i/%s",inet_ntoa(*(in_addr *)&host),port,base64Key); ++ res = asprintf(&url,"blink://%s:%i/%s",inet_ntoa(*(in_addr *)&host),port,base64Key); + g_Nepenthes->getDownloadMgr()->downloadUrl((*msg)->getLocalHost(),url,(*msg)->getRemoteHost(),url,0); + free(url); + free(base64Key); +@@ -143,7 +144,8 @@ + logInfo("%s -> %s:%u \n",m_ShellcodeHandlerName.c_str(), inet_ntoa(*(in_addr *)&host), port); + + char *url; +- asprintf(&url,"creceive://%s:%d/%i",inet_ntoa(*(in_addr *)&host), port, 0); ++ int res; ++ res = asprintf(&url,"creceive://%s:%d/%i",inet_ntoa(*(in_addr *)&host), port, 0); + g_Nepenthes->getDownloadMgr()->downloadUrl((*msg)->getLocalHost(),url, (*msg)->getRemoteHost(), url,0); + free(url); + +diff -urNad nepenthes-0.2.2~/modules/shellcode-signatures/sch_namespace_connectbackfiletransfer.cpp nepenthes-0.2.2/modules/shellcode-signatures/sch_namespace_connectbackfiletransfer.cpp +--- nepenthes-0.2.2~/modules/shellcode-signatures/sch_namespace_connectbackfiletransfer.cpp 2006-04-08 19:40:18.000000000 +0100 ++++ nepenthes-0.2.2/modules/shellcode-signatures/sch_namespace_connectbackfiletransfer.cpp 2008-07-16 21:47:42.000000000 +0100 +@@ -145,8 +145,9 @@ + + char *url; + unsigned char *base64Key = g_Nepenthes->getUtilities()->b64encode_alloc(authKey,4); +- +- asprintf(&url,"link://%s:%i/%s",inet_ntoa(*(in_addr *)&host),port,base64Key); ++ int res; ++ ++ res = asprintf(&url,"link://%s:%i/%s",inet_ntoa(*(in_addr *)&host),port,base64Key); + g_Nepenthes->getDownloadMgr()->downloadUrl((*msg)->getLocalHost(),url,(*msg)->getRemoteHost(),url,0); + free(url); + free(base64Key); +@@ -155,7 +156,9 @@ + logInfo("%s -> %s:%u \n",m_ShellcodeHandlerName.c_str(), inet_ntoa(*(in_addr *)&host), port); + + char *url; +- asprintf(&url,"csend://%s:%d/%i",inet_ntoa(*(in_addr *)&host), port, 0); ++ int res; ++ ++ res = asprintf(&url,"csend://%s:%d/%i",inet_ntoa(*(in_addr *)&host), port, 0); + g_Nepenthes->getDownloadMgr()->downloadUrl((*msg)->getLocalHost(),url, (*msg)->getRemoteHost(), url,0); + free(url); + +diff -urNad nepenthes-0.2.2~/modules/submit-gotek/submit-gotek.cpp nepenthes-0.2.2/modules/submit-gotek/submit-gotek.cpp +--- nepenthes-0.2.2~/modules/submit-gotek/submit-gotek.cpp 2008-07-16 21:36:38.000000000 +0100 ++++ nepenthes-0.2.2/modules/submit-gotek/submit-gotek.cpp 2008-07-16 21:48:10.000000000 +0100 +@@ -274,8 +274,9 @@ + { + { // TODO substitute with clean std::string solution + char * temp; ++ int res; + +- asprintf(&temp, "sample-%u-%03u", (unsigned int) time(NULL), rand() % 1000); ++ res = asprintf(&temp, "sample-%u-%03u", (unsigned int) time(NULL), rand() % 1000); + fileName += temp; + free(temp); + } +diff -urNad nepenthes-0.2.2~/modules/submit-postgres/PGDownloadContext.cpp nepenthes-0.2.2/modules/submit-postgres/PGDownloadContext.cpp +--- nepenthes-0.2.2~/modules/submit-postgres/PGDownloadContext.cpp 2008-07-16 21:36:38.000000000 +0100 ++++ nepenthes-0.2.2/modules/submit-postgres/PGDownloadContext.cpp 2008-07-16 21:53:22.000000000 +0100 +@@ -117,7 +117,8 @@ + unsigned char *data = (unsigned char *)malloc(s.st_size); + memset(data,0,s.st_size); + FILE *f = fopen(path,"r"); +- fread(data,1,s.st_size,f); ++ size_t nbytes; ++ nbytes = fread(data,1,s.st_size,f); + fclose(f); + + Bencoding_Context *c = Bencoding_createContext(); +@@ -296,8 +297,9 @@ + benc.append(m_FileContent); + benc += "e"; + ++ size_t nbytes; + +- fwrite(benc.data(),1,benc.size(),f); ++ nbytes = fwrite(benc.data(),1,benc.size(),f); + + fclose(f); + logDebug("Wrote bencoded spoolfile %s (%i bytes)\n",m_FilePath.c_str(),benc.size()); +diff -urNad nepenthes-0.2.2~/modules/vuln-ssh/SSHSocket.cpp nepenthes-0.2.2/modules/vuln-ssh/SSHSocket.cpp +--- nepenthes-0.2.2~/modules/vuln-ssh/SSHSocket.cpp 2006-05-04 11:25:42.000000000 +0100 ++++ nepenthes-0.2.2/modules/vuln-ssh/SSHSocket.cpp 2008-07-16 21:48:30.000000000 +0100 +@@ -272,7 +272,8 @@ + ssh_message_channel_request_reply_success(message); + + char *welcome; +- asprintf(&welcome,"Last login: Mon Jan 12 22:03:55 2005 from 212.54.21.23\n\r%s@nepenthes:~$ ",m_User.c_str()); ++ int res; ++ res = asprintf(&welcome,"Last login: Mon Jan 12 22:03:55 2005 from 212.54.21.23\n\r%s@nepenthes:~$ ",m_User.c_str()); + channel_write(m_Channel,(void *)welcome,strlen(welcome)); + free(welcome); + +diff -urNad nepenthes-0.2.2~/modules/x-6/x-6.cpp nepenthes-0.2.2/modules/x-6/x-6.cpp +--- nepenthes-0.2.2~/modules/x-6/x-6.cpp 2008-07-16 21:36:38.000000000 +0100 ++++ nepenthes-0.2.2/modules/x-6/x-6.cpp 2008-07-16 21:51:18.000000000 +0100 +@@ -304,7 +304,8 @@ + printf("NUM %i\n",(int)i); + logSpam( "domain %s has ip %s \n",result->getDNS().c_str(),inet_ntoa(*(in_addr *)&*it)); + char *reply; +- asprintf(&reply,"domain %s has A %s (context %08x)\n",result->getDNS().c_str(), inet_ntoa(*(in_addr *)&*it), (uint32_t)((intptr_t)result->getObject())); ++ int res; ++ res = asprintf(&reply,"domain %s has A %s (context %08x)\n",result->getDNS().c_str(), inet_ntoa(*(in_addr *)&*it), (uint32_t)((intptr_t)result->getObject())); + m_Socket->doRespond(reply,strlen(reply)); + free(reply); + +@@ -341,7 +342,8 @@ + { + logSpam("domain %s has no A, resolve error\n",result->getDNS().c_str()); + char *reply; +- asprintf(&reply,"domain '%s' could not resolve A\n", result->getDNS().c_str()); ++ int res; ++ res = asprintf(&reply,"domain '%s' could not resolve A\n", result->getDNS().c_str()); + m_Socket->doRespond(reply,strlen(reply)); + free(reply); + } else +@@ -349,7 +351,8 @@ + { + logSpam("domain %s has no TXT, resolve error\n",result->getDNS().c_str()); + char *reply; +- asprintf(&reply,"domain '%s' could not resolve TXT\n", result->getDNS().c_str()); ++ int res; ++ res = asprintf(&reply,"domain '%s' could not resolve TXT\n", result->getDNS().c_str()); + m_Socket->doRespond(reply,strlen(reply)); + free(reply); + } +diff -urNad nepenthes-0.2.2~/nepenthes-core/src/Config.cpp nepenthes-0.2.2/nepenthes-core/src/Config.cpp +--- nepenthes-0.2.2~/nepenthes-core/src/Config.cpp 2008-07-16 20:17:20.000000000 +0100 ++++ nepenthes-0.2.2/nepenthes-core/src/Config.cpp 2008-07-16 21:36:38.000000000 +0100 +@@ -142,6 +142,7 @@ + + void Config::load(const char *filename) + { ++ + #ifdef WIN32 + struct _stat file; + #else +@@ -159,7 +160,7 @@ + + data = (unsigned char *)malloc(file.st_size); + FILE *f = fopen(filename,"rb"); +- fread(data,1,file.st_size,f); ++ size_t nbytes = fread(data,1,file.st_size,f); + fclose(f); + + #else +diff -urNad nepenthes-0.2.2~/nepenthes-core/src/DownloadManager.cpp nepenthes-0.2.2/nepenthes-core/src/DownloadManager.cpp +--- nepenthes-0.2.2~/nepenthes-core/src/DownloadManager.cpp 2008-07-16 20:17:20.000000000 +0100 ++++ nepenthes-0.2.2/nepenthes-core/src/DownloadManager.cpp 2008-07-16 21:36:38.000000000 +0100 +@@ -333,6 +333,7 @@ + + if ( bReplaceHost ) + { ++ int res; + string sUrl = down->getDownloadUrl()->getProtocol(); + sUrl += "://"; + +@@ -342,7 +343,7 @@ + logInfo("Replaced Address, new URL is %s \n",sUrl.c_str()); + + char *port; +- asprintf(&port,":%i/",down->getDownloadUrl()->getPort()); ++ res = asprintf(&port,":%i/",down->getDownloadUrl()->getPort()); + sUrl += port; + free(port); + +diff -urNad nepenthes-0.2.2~/nepenthes-core/src/LogManager.cpp nepenthes-0.2.2/nepenthes-core/src/LogManager.cpp +--- nepenthes-0.2.2~/nepenthes-core/src/LogManager.cpp 2008-07-16 21:36:38.000000000 +0100 ++++ nepenthes-0.2.2/nepenthes-core/src/LogManager.cpp 2008-07-16 21:36:38.000000000 +0100 +@@ -170,6 +170,7 @@ + void LogManager::logf(uint32_t mask, const char *format, ...) + { + va_list ap; ++ int res; + + + va_start(ap, format); +@@ -186,7 +187,7 @@ + va_end(ap); + #else + char *message; +- vasprintf(&message, format, ap); ++ res = vasprintf(&message, format, ap); + va_end(ap); + + log(mask, message); +diff -urNad nepenthes-0.2.2~/nepenthes-core/src/Nepenthes.cpp nepenthes-0.2.2/nepenthes-core/src/Nepenthes.cpp +--- nepenthes-0.2.2~/nepenthes-core/src/Nepenthes.cpp 2008-07-16 21:36:38.000000000 +0100 ++++ nepenthes-0.2.2/nepenthes-core/src/Nepenthes.cpp 2008-07-16 21:36:38.000000000 +0100 +@@ -516,8 +516,9 @@ + + if (opt.m_daemonize == true) + { ++ int res; + logInfo("running as daemon\n"); +- daemon(1,0); ++ res = daemon(1,0); + logInfo("daemon process id is %i\n",getpid()); + } + +@@ -817,7 +818,8 @@ + return -1; + } else + { +- fread(buffer,1,filesize,f); ++ size_t nbytes; ++ nbytes = fread(buffer,1,filesize,f); + fclose(f); + + uint32_t i; +diff -urNad nepenthes-0.2.2~/nepenthes-core/src/RingFileLogger.cpp nepenthes-0.2.2/nepenthes-core/src/RingFileLogger.cpp +--- nepenthes-0.2.2~/nepenthes-core/src/RingFileLogger.cpp 2008-07-16 21:36:38.000000000 +0100 ++++ nepenthes-0.2.2/nepenthes-core/src/RingFileLogger.cpp 2008-07-16 21:36:38.000000000 +0100 +@@ -79,6 +79,8 @@ + + void RingFileLogger::setLogFileFormat(char *fmt) + { ++ int res; ++ + if (m_FileFormat != NULL) + { + free(m_FileFormat); +@@ -90,7 +92,7 @@ + { + free(m_FirstFile); + } +- asprintf(&m_FirstFile, m_FileFormat, 0); ++ res = asprintf(&m_FirstFile, m_FileFormat, 0); + } + + void RingFileLogger::setMaxFiles(uint8_t count) +diff -urNad nepenthes-0.2.2~/nepenthes-core/src/Utilities.cpp nepenthes-0.2.2/nepenthes-core/src/Utilities.cpp +--- nepenthes-0.2.2~/nepenthes-core/src/Utilities.cpp 2008-07-16 21:36:38.000000000 +0100 ++++ nepenthes-0.2.2/nepenthes-core/src/Utilities.cpp 2008-07-16 21:36:38.000000000 +0100 +@@ -370,7 +370,8 @@ + + if( (f = fopen(md5.c_str(), "wb")) ) + { +- fwrite((const void *)data, len, 1, f); ++ size_t nbytes; ++ nbytes = fwrite((const void *)data, len, 1, f); + fclose(f); + + g_Nepenthes->getLogMgr()->logf(mask,"Stored Hexdump %s (0x%08x , 0x%08x).\n", md5.c_str(), (uint32_t)((intptr_t)data), len); only in patch2: unchanged: --- nepenthes-0.2.2.orig/debian/patches/05_includes_for_gcc_4.4.dpatch +++ nepenthes-0.2.2/debian/patches/05_includes_for_gcc_4.4.dpatch @@ -0,0 +1,917 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 05_includes_for_gcc_4.4.dpatch by Luciano Bello +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: No description. + +@DPATCH@ +diff -urNad nepenthes-0.2.2~/modules/download-creceive/CReceiveDialogue.cpp nepenthes-0.2.2/modules/download-creceive/CReceiveDialogue.cpp +--- nepenthes-0.2.2~/modules/download-creceive/CReceiveDialogue.cpp 2007-02-06 12:16:52.000000000 -0300 ++++ nepenthes-0.2.2/modules/download-creceive/CReceiveDialogue.cpp 2009-02-18 21:05:22.000000000 -0200 +@@ -53,6 +53,8 @@ + + #include "SubmitManager.hpp" + ++#include ++ + #ifdef STDTAGS + #undef STDTAGS + #endif +diff -urNad nepenthes-0.2.2~/modules/download-http/HTTPDialogue.cpp nepenthes-0.2.2/modules/download-http/HTTPDialogue.cpp +--- nepenthes-0.2.2~/modules/download-http/HTTPDialogue.cpp 2009-02-18 21:05:21.000000000 -0200 ++++ nepenthes-0.2.2/modules/download-http/HTTPDialogue.cpp 2009-02-18 21:05:22.000000000 -0200 +@@ -29,6 +29,7 @@ + + #include "HTTPDialogue.hpp" + ++#include + #include + #include + +diff -urNad nepenthes-0.2.2~/modules/shellcode-generic/sch_generic_connect_trans.cpp nepenthes-0.2.2/modules/shellcode-generic/sch_generic_connect_trans.cpp +--- nepenthes-0.2.2~/modules/shellcode-generic/sch_generic_connect_trans.cpp 2006-05-04 07:25:40.000000000 -0300 ++++ nepenthes-0.2.2/modules/shellcode-generic/sch_generic_connect_trans.cpp 2009-02-18 21:05:22.000000000 -0200 +@@ -31,6 +31,7 @@ + #include + #include + #include ++#include + + #include "LogManager.hpp" + #include "Message.hpp" +diff -urNad nepenthes-0.2.2~/modules/shellcode-generic/sch_generic_connect_trans.cpp.orig nepenthes-0.2.2/modules/shellcode-generic/sch_generic_connect_trans.cpp.orig +--- nepenthes-0.2.2~/modules/shellcode-generic/sch_generic_connect_trans.cpp.orig 1969-12-31 21:00:00.000000000 -0300 ++++ nepenthes-0.2.2/modules/shellcode-generic/sch_generic_connect_trans.cpp.orig 2009-02-18 21:05:22.000000000 -0200 +@@ -0,0 +1,193 @@ ++/******************************************************************************** ++ * Nepenthes ++ * - finest collection - ++ * ++ * ++ * ++ * Copyright (C) 2005 Paul Baecher & Markus Koetter ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version 2 ++ * of the License, or (at your option) any later version. ++ * ++ * This program 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 General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ++ * ++ * ++ * contact nepenthesdev@users.sourceforge.net ++ * ++ *******************************************************************************/ ++ ++ /* $Id: sch_generic_connect_trans.cpp 550 2006-05-04 10:25:35Z common $ */ ++ ++#include ++#include ++#include ++#include ++ ++#include "LogManager.hpp" ++#include "Message.hpp" ++#include "sch_generic_connect_trans.hpp" ++#include "Socket.hpp" ++#include "Nepenthes.hpp" ++#include "Utilities.hpp" ++#include "DialogueFactoryManager.hpp" ++#include "SocketManager.hpp" ++#include "DialogueFactory.hpp" ++#include "DownloadManager.hpp" ++ ++#include "Config.hpp" ++#include "shellcode-generic.hpp" ++ ++ ++ ++#ifdef STDTAGS ++#undef STDTAGS ++#endif ++#define STDTAGS l_sc | l_hlr ++ ++using namespace nepenthes; ++ ++GenericConnectTrans::GenericConnectTrans(ShellcodeManager *shellcodemanager) ++{ ++ m_ShellcodeManager = shellcodemanager; ++ m_ShellcodeHandlerName = "GenericConnectTrans"; ++ m_ShellcodeHandlerDescription = "various csends"; ++ ++} ++ ++GenericConnectTrans::~GenericConnectTrans() ++{ ++ ++} ++ ++bool GenericConnectTrans::Init() ++{ ++ logPF(); ++ ++ StringList sList; ++ try ++ { ++ sList = *g_GenericShellcodeHandler->getConfig()->getValStringList("shellcode-generic.generic_connect_trans"); ++ } catch ( ... ) ++ { ++ logCrit("Error setting needed vars, check your config\n"); ++ return false; ++ } ++ ++ uint32_t i = 0; ++ while (i < sList.size()) ++ { ++ const char *name = sList[i]; ++ i++; ++ ++ const char *pattern = sList[i]; ++ i++; ++ ++ uint16_t offset = atoi(sList[i]); ++ i++; ++ ++// logInfo("pcre is %s \n",pattern); ++ const char * pcreEerror; ++ int32_t pcreErrorPos; ++ pcre *mypcre=NULL; ++ if((mypcre = pcre_compile(pattern, PCRE_DOTALL, &pcreEerror, (int *)&pcreErrorPos, 0)) == NULL) ++ { ++ logCrit("GenericConnectTrans could not compile pattern \n\t\"%s\"\n\t Error:\"%s\" at Position %u", ++ pattern, pcreEerror, pcreErrorPos); ++ return false; ++ }else ++ { ++ logDebug("Adding %s \n",name); ++ PcreContext *ctx = new PcreContext; ++ ctx->m_Name = name; ++ ctx->m_Pcre = mypcre; ++ ctx->m_Offset = offset; ++ m_Pcres.push_back(ctx); ++ } ++ } ++ return true; ++} ++ ++bool GenericConnectTrans::Exit() ++{ ++ logPF(); ++ while(m_Pcres.size() > 0) ++ { ++ pcre_free(m_Pcres.front()->m_Pcre); ++ delete m_Pcres.front(); ++ m_Pcres.pop_front(); ++ } ++ return true; ++} ++ ++sch_result GenericConnectTrans::handleShellcode(Message **msg) ++{ ++ logPF(); ++ logSpam("Shellcode is %i bytes long \n",(*msg)->getSize()); ++ char *shellcode = (*msg)->getMsg(); ++ uint32_t len = (*msg)->getSize(); ++ ++ int32_t output[10 * 3]; ++ ++ ++ list ::iterator it; ++ uint32_t i; ++ for ( it=m_Pcres.begin(), i=0; it != m_Pcres.end();it++,i++ ) ++ { ++ int32_t result=0; ++ const char *match; ++ if ( (result = pcre_exec((*it)->m_Pcre, 0, (char *) shellcode, len, 0, 0, (int*)output, sizeof(output)/sizeof(int32_t))) > 0 ) ++ { ++ uint32_t host = 0, codesizeLen; ++ uint16_t port=0; ++ ++ codesizeLen = pcre_get_substring((char *) shellcode, (int *)output, (int)result, 1, &match); ++ if( codesizeLen == 2 ) ++ { ++ port = (uint32_t)*((uint16_t *)match); ++ port = ntohs(port); ++ }else ++ if( codesizeLen == 4 ) ++ { ++ host = (uint32_t)*((uint32_t *)match); ++ } ++ ++ pcre_free_substring(match); ++ ++ codesizeLen = pcre_get_substring((char *) shellcode, (int *)output, (int)result, 2, &match); ++ if( codesizeLen == 2 ) ++ { ++ port = (uint32_t)*((uint16_t *)match); ++ port = ntohs(port); ++ }else ++ if( codesizeLen == 4 ) ++ { ++ host = (uint32_t)*((uint32_t *)match); ++ } ++ pcre_free_substring(match); ++ ++ ++ logInfo("Detected connectbacktransfer shellcode %s, %s:%u \n",(*it)->m_Name.c_str(), inet_ntoa(*(in_addr *)&host), port); ++ ++ ++ char *url; ++ asprintf(&url,"csend://%s:%d/%i",inet_ntoa(*(in_addr *)&host), port, (*it)->m_Offset); ++ g_Nepenthes->getDownloadMgr()->downloadUrl((*msg)->getLocalHost(),url, (*msg)->getRemoteHost(), url,0); ++ free(url); ++ ++ return SCH_DONE; ++ ++ } ++ } ++ return SCH_NOTHING; ++} ++ ++ +diff -urNad nepenthes-0.2.2~/modules/shellcode-generic/sch_generic_createprocess.cpp nepenthes-0.2.2/modules/shellcode-generic/sch_generic_createprocess.cpp +--- nepenthes-0.2.2~/modules/shellcode-generic/sch_generic_createprocess.cpp 2009-02-18 21:05:21.000000000 -0200 ++++ nepenthes-0.2.2/modules/shellcode-generic/sch_generic_createprocess.cpp 2009-02-18 21:05:22.000000000 -0200 +@@ -38,6 +38,7 @@ + + /* $Id: sch_generic_createprocess.cpp 550 2006-05-04 10:25:35Z common $ */ + ++#include + #include + + #include "sch_generic_createprocess.hpp" +diff -urNad nepenthes-0.2.2~/modules/shellcode-generic/sch_generic_link_bind_trans.cpp nepenthes-0.2.2/modules/shellcode-generic/sch_generic_link_bind_trans.cpp +--- nepenthes-0.2.2~/modules/shellcode-generic/sch_generic_link_bind_trans.cpp 2009-02-18 21:05:21.000000000 -0200 ++++ nepenthes-0.2.2/modules/shellcode-generic/sch_generic_link_bind_trans.cpp 2009-02-18 21:05:22.000000000 -0200 +@@ -27,6 +27,7 @@ + + /* $Id: sch_generic_link_bind_trans.cpp 2271 2006-01-14 20:31:52Z common $ */ + ++#include + #include + + #include +diff -urNad nepenthes-0.2.2~/modules/shellcode-generic/sch_generic_link_trans.cpp nepenthes-0.2.2/modules/shellcode-generic/sch_generic_link_trans.cpp +--- nepenthes-0.2.2~/modules/shellcode-generic/sch_generic_link_trans.cpp 2009-02-18 21:05:21.000000000 -0200 ++++ nepenthes-0.2.2/modules/shellcode-generic/sch_generic_link_trans.cpp 2009-02-18 21:05:22.000000000 -0200 +@@ -27,6 +27,7 @@ + + /* $Id: sch_generic_link_trans.cpp 2271 2006-01-14 20:31:52Z common $ */ + ++#include + #include + + #include +diff -urNad nepenthes-0.2.2~/modules/shellcode-generic/sch_generic_stuttgart.cpp nepenthes-0.2.2/modules/shellcode-generic/sch_generic_stuttgart.cpp +--- nepenthes-0.2.2~/modules/shellcode-generic/sch_generic_stuttgart.cpp 2009-02-18 21:05:21.000000000 -0200 ++++ nepenthes-0.2.2/modules/shellcode-generic/sch_generic_stuttgart.cpp 2009-02-18 21:05:22.000000000 -0200 +@@ -27,6 +27,7 @@ + + /* $Id: sch_generic_link_trans.cpp 1664 2005-07-15 03:33:39Z common $ */ + ++#include + #include + + #include +diff -urNad nepenthes-0.2.2~/modules/shellcode-generic/sch_generic_url.cpp nepenthes-0.2.2/modules/shellcode-generic/sch_generic_url.cpp +--- nepenthes-0.2.2~/modules/shellcode-generic/sch_generic_url.cpp 2007-02-06 12:16:52.000000000 -0300 ++++ nepenthes-0.2.2/modules/shellcode-generic/sch_generic_url.cpp 2009-02-18 21:05:22.000000000 -0200 +@@ -40,6 +40,8 @@ + + + ++#include ++ + #include "sch_generic_url.hpp" + #include "LogManager.hpp" + #include "Message.hpp" +diff -urNad nepenthes-0.2.2~/modules/shellcode-generic/sch_generic_wuerzburg.cpp nepenthes-0.2.2/modules/shellcode-generic/sch_generic_wuerzburg.cpp +--- nepenthes-0.2.2~/modules/shellcode-generic/sch_generic_wuerzburg.cpp 2009-02-18 21:05:21.000000000 -0200 ++++ nepenthes-0.2.2/modules/shellcode-generic/sch_generic_wuerzburg.cpp 2009-02-18 21:05:22.000000000 -0200 +@@ -27,6 +27,7 @@ + + /* $Id: sch_generic_wuerzburg.cpp 2271 2006-01-14 20:31:52Z common $ */ + ++#include + #include + + #include +diff -urNad nepenthes-0.2.2~/modules/shellcode-generic/sch_generic_xor.cpp nepenthes-0.2.2/modules/shellcode-generic/sch_generic_xor.cpp +--- nepenthes-0.2.2~/modules/shellcode-generic/sch_generic_xor.cpp 2006-05-04 07:25:40.000000000 -0300 ++++ nepenthes-0.2.2/modules/shellcode-generic/sch_generic_xor.cpp 2009-02-18 21:05:22.000000000 -0200 +@@ -42,6 +42,8 @@ + + #include "sch_generic_xor.hpp" + ++#include ++ + #include "Nepenthes.hpp" + #include "Message.hpp" + #include "Message.cpp" +diff -urNad nepenthes-0.2.2~/modules/shellcode-signatures/sch_namespace_bindfiletransfer.cpp nepenthes-0.2.2/modules/shellcode-signatures/sch_namespace_bindfiletransfer.cpp +--- nepenthes-0.2.2~/modules/shellcode-signatures/sch_namespace_bindfiletransfer.cpp 2006-04-08 15:40:17.000000000 -0300 ++++ nepenthes-0.2.2/modules/shellcode-signatures/sch_namespace_bindfiletransfer.cpp 2009-02-18 21:05:22.000000000 -0200 +@@ -27,6 +27,8 @@ + + /* $Id: sch_namespace_bindfiletransfer.cpp 499 2006-04-08 18:40:14Z common $ */ + ++#include ++ + #include + #include + #include +diff -urNad nepenthes-0.2.2~/modules/shellcode-signatures/sch_namespace_connectbackfiletransfer.cpp nepenthes-0.2.2/modules/shellcode-signatures/sch_namespace_connectbackfiletransfer.cpp +--- nepenthes-0.2.2~/modules/shellcode-signatures/sch_namespace_connectbackfiletransfer.cpp 2006-04-08 15:40:18.000000000 -0300 ++++ nepenthes-0.2.2/modules/shellcode-signatures/sch_namespace_connectbackfiletransfer.cpp 2009-02-18 21:05:22.000000000 -0200 +@@ -27,6 +27,8 @@ + + /* $Id: sch_namespace_connectbackfiletransfer.cpp 499 2006-04-08 18:40:14Z common $ */ + ++#include ++ + #include + #include + #include +diff -urNad nepenthes-0.2.2~/modules/shellemu-winnt/VFS.cpp nepenthes-0.2.2/modules/shellemu-winnt/VFS.cpp +--- nepenthes-0.2.2~/modules/shellemu-winnt/VFS.cpp 2009-02-18 21:05:21.000000000 -0200 ++++ nepenthes-0.2.2/modules/shellemu-winnt/VFS.cpp 2009-02-18 21:05:22.000000000 -0200 +@@ -22,6 +22,7 @@ + + + #include ++#include + #include + + #include "VFS.hpp" +diff -urNad nepenthes-0.2.2~/modules/shellemu-winnt/VFSCommand.hpp nepenthes-0.2.2/modules/shellemu-winnt/VFSCommand.hpp +--- nepenthes-0.2.2~/modules/shellemu-winnt/VFSCommand.hpp 2006-02-20 13:46:12.000000000 -0300 ++++ nepenthes-0.2.2/modules/shellemu-winnt/VFSCommand.hpp 2009-02-18 21:05:22.000000000 -0200 +@@ -30,6 +30,7 @@ + #ifndef HAVE_VFSCOMMANDECHO + #define HAVE_VFSCOMMANDECHO + ++#include + #include + #include + #include +diff -urNad nepenthes-0.2.2~/modules/shellemu-winnt/VFSCommandRCP.cpp nepenthes-0.2.2/modules/shellemu-winnt/VFSCommandRCP.cpp +--- nepenthes-0.2.2~/modules/shellemu-winnt/VFSCommandRCP.cpp 2009-02-18 21:05:21.000000000 -0200 ++++ nepenthes-0.2.2/modules/shellemu-winnt/VFSCommandRCP.cpp 2009-02-18 21:05:22.000000000 -0200 +@@ -27,6 +27,7 @@ + + /* $Id: VFSCommandRCP.cpp 550 2006-05-04 10:25:35Z common $ */ + ++#include + #include + + #include "VFSCommandRCP.hpp" +diff -urNad nepenthes-0.2.2~/modules/submit-file/submit-file.cpp nepenthes-0.2.2/modules/submit-file/submit-file.cpp +--- nepenthes-0.2.2~/modules/submit-file/submit-file.cpp 2006-05-04 07:25:40.000000000 -0300 ++++ nepenthes-0.2.2/modules/submit-file/submit-file.cpp 2009-02-18 21:05:22.000000000 -0200 +@@ -30,6 +30,7 @@ + #include + #include + #include ++#include + + #include "submit-file.hpp" + #include "Download.hpp" +diff -urNad nepenthes-0.2.2~/nepenthes-core/src/DownloadManager.cpp nepenthes-0.2.2/nepenthes-core/src/DownloadManager.cpp +--- nepenthes-0.2.2~/nepenthes-core/src/DownloadManager.cpp 2009-02-18 20:35:48.000000000 -0200 ++++ nepenthes-0.2.2/nepenthes-core/src/DownloadManager.cpp 2009-02-18 21:05:22.000000000 -0200 +@@ -41,6 +41,7 @@ + + #include "SubmitEvent.hpp" + #include "EventManager.hpp" ++#include + + using namespace std; + using namespace nepenthes; +diff -urNad nepenthes-0.2.2~/nepenthes-core/src/DownloadManager.cpp.orig nepenthes-0.2.2/nepenthes-core/src/DownloadManager.cpp.orig +--- nepenthes-0.2.2~/nepenthes-core/src/DownloadManager.cpp.orig 1969-12-31 21:00:00.000000000 -0300 ++++ nepenthes-0.2.2/nepenthes-core/src/DownloadManager.cpp.orig 2009-02-18 21:05:22.000000000 -0200 +@@ -0,0 +1,472 @@ ++/******************************************************************************** ++ * Nepenthes ++ * - finest collection - ++ * ++ * ++ * ++ * Copyright (C) 2005 Paul Baecher & Markus Koetter ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version 2 ++ * of the License, or (at your option) any later version. ++ * ++ * This program 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 General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ++ * ++ * ++ * contact nepenthesdev@users.sourceforge.net ++ * ++ *******************************************************************************/ ++ ++/* $Id: DownloadManager.cpp 1548 2008-02-14 11:18:18Z common $ */ ++ ++#include ++#include ++ ++#include "DownloadManager.hpp" ++#include "DownloadHandler.hpp" ++#include "Nepenthes.hpp" ++#include "Download.hpp" ++#include "DownloadUrl.hpp" ++ ++#include "LogManager.hpp" ++#include "Config.hpp" ++ ++#include "SubmitEvent.hpp" ++#include "EventManager.hpp" ++ ++using namespace std; ++using namespace nepenthes; ++ ++#ifdef STDTAGS ++#undef STDTAGS ++#endif ++#define STDTAGS l_dl | l_mgr ++ ++#ifdef WIN32 ++#define uint32_t uint32_t ++#endif ++ ++ ++/** ++ * cosntructor ++ * ++ * @param nepenthes the nepenthes pointer ++ */ ++DownloadManager::DownloadManager(Nepenthes *nepenthes) ++{ ++ m_Nepenthes = nepenthes; ++} ++ ++/** ++ * destructor ++ */ ++DownloadManager::~DownloadManager() ++{ ++ logPF(); ++ while(m_DownloadHandlers.size() > 0) ++ { ++ m_DownloadHandlers.pop_front(); ++ } ++} ++ ++/** ++ * bool Manager::Init() ++ * ++ * reads specific config vals, returns true if everything was fine ++ * ++ * @return true on success, else false ++ */ ++bool DownloadManager::Init() ++{ ++ logPF(); ++ m_ReplaceLocalIps = false; ++ try ++ { ++ if ( m_Nepenthes->getConfig()->getValInt("nepenthes.downloadmanager.replace_local_ips")==1 ) ++ m_ReplaceLocalIps = true; ++ } catch ( ... ) { ++ logCrit("Could not find %s in config file\n","moduledir, moduleconfigdir"); ++ return false; ++ } ++ return true; ++} ++ ++/** ++ * bool Manager::Exit() ++ * ++ * unload all DownloadHandlers ++ * ++ * @return return true on success, else false ++ */ ++bool DownloadManager::Exit() ++{ ++ return true; ++} ++ ++/* ++ * these cool makros are taken from the clamav mailing list ++ * ++ */ ++#if BYTE_ORDER == BIG_ENDIAN ++ #define SWAP_ORDER(x) (x) ++#else ++ #define SWAP_ORDER(x) ( \ ++ ((x & 0xff) << 24) | \ ++ ((x & 0xff00) << 8) | \ ++ ((x & 0xff0000) >> 8 ) | \ ++ ((x & 0xff000000) >> 24 )) ++#endif ++ ++#define PACKADDR(a, b, c, d) SWAP_ORDER((((uint32_t)(a) << 24) | ((b) << 16) | ((c) << 8) | (d))) ++#define MAKEMASK(bits) SWAP_ORDER(((uint32_t)(0xffffffff << (32-bits)))) ++ ++ip_range_t DownloadManager::m_irLocalRanges[] = ++{ ++// taken from http://www.rfc-editor.org/rfc/rfc3330.txt ++// ip address netmask comment ++ { PACKADDR( 0 , 0 , 0 , 0 ), MAKEMASK( 8 ) }, // "This" Network [RFC1700, page 4] ++ { PACKADDR( 10 , 0 , 0 , 0 ), MAKEMASK( 8 ) }, // Private-Use Networks [RFC1918] ++ { PACKADDR( 14 , 0 , 0 , 0 ), MAKEMASK( 8 ) }, // Public-Data Networks [RFC1700, page 181] ++// { PACKADDR( 24 , 0 , 0 , 0 ), MAKEMASK( 8 ) }, // Cable Television Networks ++ { PACKADDR( 39 , 0 , 0 , 0 ), MAKEMASK( 8 ) }, // Reserved but subject to allocation[RFC1797] ++ { PACKADDR( 127 , 0 , 0 , 0 ), MAKEMASK( 8 ) }, // Loopback [RFC1700, page 5] ++ { PACKADDR( 128 , 0 , 0 , 0 ), MAKEMASK( 16 ) }, // Reserved but subject to allocation ++ { PACKADDR( 169 , 254 , 0 , 0 ), MAKEMASK( 16 ) }, // Link Local -- ++ { PACKADDR( 172 , 16 , 0 , 0 ), MAKEMASK( 12 ) }, // Private-Use Networks [RFC1918] ++ { PACKADDR( 191 , 255 , 0 , 0 ), MAKEMASK( 16 ) }, // Reserved but subject to allocation ++ { PACKADDR( 192 , 0 , 0 , 0 ), MAKEMASK( 24 ) }, // Reserved but subject to allocation ++ { PACKADDR( 192 , 0 , 2 , 0 ), MAKEMASK( 24 ) }, // Test-Net ++ { PACKADDR( 192 , 88 , 99 , 0 ), MAKEMASK( 24 ) }, // 6to4 Relay Anycast [RFC3068] ++ { PACKADDR( 192 , 168 , 0 , 0 ), MAKEMASK( 16 ) }, // Private-Use Networks [RFC1918] ++ { PACKADDR( 198 , 18 , 0 , 0 ), MAKEMASK( 15 ) }, // Network Interconnect Device Benchmark Testing [RFC2544] ++ { PACKADDR( 223 , 255 , 255 , 0 ), MAKEMASK( 24 ) }, // Reserved but subject to allocation ++ { PACKADDR( 224 , 0 , 0 , 0 ), MAKEMASK( 4 ) }, // Multicast [RFC3171] ++ { PACKADDR( 240 , 0 , 0 , 0 ), MAKEMASK( 4 ) }, // Reserved for Future Use [RFC1700, page 4] ++ ++ ++/* old and discusable ++ { PACKADDR( 0 , 0 , 0 , 0 ), MAKEMASK( 8 )}, // 0.000.000.000 / 255.000.000.000 ++ { PACKADDR( 1 , 0 , 0 , 0 ), MAKEMASK( 8 )}, // 1.000.000.000 / 255.000.000.000 ++ { PACKADDR( 2 , 0 , 0 , 0 ), MAKEMASK( 8 )}, // 2.000.000.000 / 255.000.000.000 ++ { PACKADDR( 5 , 0 , 0 , 0 ), MAKEMASK( 8 )}, // 5.000.000.000 / 255.000.000.000 ++ { PACKADDR( 7 , 0 , 0 , 0 ), MAKEMASK( 8 )}, // 7.000.000.000 / 255.000.000.000 ++ { PACKADDR( 10 , 0 , 0 , 0 ), MAKEMASK( 8 )}, // 10.000.000.000 / 255.000.000.000 ++ { PACKADDR( 23 , 0 , 0 , 0 ), MAKEMASK( 8 )}, // 23.000.000.000 / 255.000.000.000 ++ { PACKADDR( 27 , 0 , 0 , 0 ), MAKEMASK( 8 )}, // 27.000.000.000 / 255.000.000.000 ++ { PACKADDR( 31 , 0 , 0 , 0 ), MAKEMASK( 8 )}, // 31.000.000.000 / 255.000.000.000 ++ { PACKADDR( 36 , 0 , 0 , 0 ), MAKEMASK( 8 )}, // 36.000.000.000 / 255.000.000.000 ++ { PACKADDR( 37 , 0 , 0 , 0 ), MAKEMASK( 8 )}, // 37.000.000.000 / 255.000.000.000 ++ { PACKADDR( 39 , 0 , 0 , 0 ), MAKEMASK( 8 )}, // 39.000.000.000 / 255.000.000.000 ++ { PACKADDR( 41 , 0 , 0 , 0 ), MAKEMASK( 8 )}, // 41.000.000.000 / 255.000.000.000 ++ { PACKADDR( 42 , 0 , 0 , 0 ), MAKEMASK( 8 )}, // 42.000.000.000 / 255.000.000.000 ++ { PACKADDR( 49 , 0 , 0 , 0 ), MAKEMASK( 8 )}, // 49.000.000.000 / 255.000.000.000 ++ { PACKADDR( 50 , 0 , 0 , 0 ), MAKEMASK( 8 )}, // 50.000.000.000 / 255.000.000.000 ++ { PACKADDR( 73 , 0 , 0 , 0 ), MAKEMASK( 8 )}, // 73.000.000.000 / 255.000.000.000 ++ { PACKADDR( 74 , 0 , 0 , 0 ), MAKEMASK( 8 )}, // 74.000.000.000 / 255.000.000.000 ++ { PACKADDR( 75 , 0 , 0 , 0 ), MAKEMASK( 8 )}, // 75.000.000.000 / 255.000.000.000 ++ { PACKADDR( 76 , 0 , 0 , 0 ), MAKEMASK( 8 )}, // 76.000.000.000 / 255.000.000.000 ++ { PACKADDR( 77 , 0 , 0 , 0 ), MAKEMASK( 8 )}, // 77.000.000.000 / 255.000.000.000 ++ { PACKADDR( 78 , 0 , 0 , 0 ), MAKEMASK( 8 )}, // 78.000.000.000 / 255.000.000.000 ++ { PACKADDR( 79 , 0 , 0 , 0 ), MAKEMASK( 8 )}, // 79.000.000.000 / 255.000.000.000 ++ { PACKADDR( 89 , 0 , 0 , 0 ), MAKEMASK( 8 )}, // 89.000.000.000 / 255.000.000.000 ++ { PACKADDR( 90 , 0 , 0 , 0 ), MAKEMASK( 8 )}, // 90.000.000.000 / 255.000.000.000 ++ { PACKADDR( 91 , 0 , 0 , 0 ), MAKEMASK( 8 )}, // 91.000.000.000 / 255.000.000.000 ++ { PACKADDR( 92 , 0 , 0 , 0 ), MAKEMASK( 8 )}, // 92.000.000.000 / 255.000.000.000 ++ { PACKADDR( 93 , 0 , 0 , 0 ), MAKEMASK( 8 )}, // 93.000.000.000 / 255.000.000.000 ++ { PACKADDR( 94 , 0 , 0 , 0 ), MAKEMASK( 8 )}, // 94.000.000.000 / 255.000.000.000 ++ { PACKADDR( 95 , 0 , 0 , 0 ), MAKEMASK( 8 )}, // 95.000.000.000 / 255.000.000.000 ++ { PACKADDR( 96 , 0 , 0 , 0 ), MAKEMASK( 8 )}, // 96.000.000.000 / 255.000.000.000 ++ { PACKADDR( 97 , 0 , 0 , 0 ), MAKEMASK( 8 )}, // 97.000.000.000 / 255.000.000.000 ++ { PACKADDR( 98 , 0 , 0 , 0 ), MAKEMASK( 8 )}, // 98.000.000.000 / 255.000.000.000 ++ { PACKADDR( 99 , 0 , 0 , 0 ), MAKEMASK( 8 )}, // 99.000.000.000 / 255.000.000.000 ++ { PACKADDR( 100, 0 , 0 , 0 ), MAKEMASK( 8 )}, // 100.000.000.000 / 255.000.000.000 ++ { PACKADDR( 101, 0 , 0 , 0 ), MAKEMASK( 8 )}, // 101.000.000.000 / 255.000.000.000 ++ { PACKADDR( 102, 0 , 0 , 0 ), MAKEMASK( 8 )}, // 102.000.000.000 / 255.000.000.000 ++ { PACKADDR( 103, 0 , 0 , 0 ), MAKEMASK( 8 )}, // 103.000.000.000 / 255.000.000.000 ++ { PACKADDR( 104, 0 , 0 , 0 ), MAKEMASK( 8 )}, // 104.000.000.000 / 255.000.000.000 ++ { PACKADDR( 105, 0 , 0 , 0 ), MAKEMASK( 8 )}, // 105.000.000.000 / 255.000.000.000 ++ { PACKADDR( 106, 0 , 0 , 0 ), MAKEMASK( 8 )}, // 106.000.000.000 / 255.000.000.000 ++ { PACKADDR( 107, 0 , 0 , 0 ), MAKEMASK( 8 )}, // 107.000.000.000 / 255.000.000.000 ++ { PACKADDR( 108, 0 , 0 , 0 ), MAKEMASK( 8 )}, // 108.000.000.000 / 255.000.000.000 ++ { PACKADDR( 109, 0 , 0 , 0 ), MAKEMASK( 8 )}, // 109.000.000.000 / 255.000.000.000 ++ { PACKADDR( 110, 0 , 0 , 0 ), MAKEMASK( 8 )}, // 110.000.000.000 / 255.000.000.000 ++ { PACKADDR( 111, 0 , 0 , 0 ), MAKEMASK( 8 )}, // 111.000.000.000 / 255.000.000.000 ++ { PACKADDR( 112, 0 , 0 , 0 ), MAKEMASK( 8 )}, // 112.000.000.000 / 255.000.000.000 ++ { PACKADDR( 113, 0 , 0 , 0 ), MAKEMASK( 8 )}, // 113.000.000.000 / 255.000.000.000 ++ { PACKADDR( 114, 0 , 0 , 0 ), MAKEMASK( 8 )}, // 114.000.000.000 / 255.000.000.000 ++ { PACKADDR( 115, 0 , 0 , 0 ), MAKEMASK( 8 )}, // 115.000.000.000 / 255.000.000.000 ++ { PACKADDR( 116, 0 , 0 , 0 ), MAKEMASK( 8 )}, // 116.000.000.000 / 255.000.000.000 ++ { PACKADDR( 117, 0 , 0 , 0 ), MAKEMASK( 8 )}, // 117.000.000.000 / 255.000.000.000 ++ { PACKADDR( 118, 0 , 0 , 0 ), MAKEMASK( 8 )}, // 118.000.000.000 / 255.000.000.000 ++ { PACKADDR( 119, 0 , 0 , 0 ), MAKEMASK( 8 )}, // 119.000.000.000 / 255.000.000.000 ++ { PACKADDR( 120, 0 , 0 , 0 ), MAKEMASK( 8 )}, // 120.000.000.000 / 255.000.000.000 ++ { PACKADDR( 121, 0 , 0 , 0 ), MAKEMASK( 8 )}, // 121.000.000.000 / 255.000.000.000 ++ { PACKADDR( 122, 0 , 0 , 0 ), MAKEMASK( 8 )}, // 122.000.000.000 / 255.000.000.000 ++ { PACKADDR( 123, 0 , 0 , 0 ), MAKEMASK( 8 )}, // 123.000.000.000 / 255.000.000.000 ++ { PACKADDR( 127, 0 , 0 , 0 ), MAKEMASK( 8 )}, // 127.000.000.000 / 255.000.000.000 ++ { PACKADDR( 169, 254, 0 , 0 ), MAKEMASK( 16 )}, // 169.254.000.000 / 255.255.000.000 ++ { PACKADDR( 172, 16 , 0 , 0 ), MAKEMASK( 12 )}, // 172.016.000.000 / 255.015.000.000 ++ { PACKADDR( 173, 0 , 0 , 0 ), MAKEMASK( 8 )}, // 173.000.000.000 / 255.000.000.000 ++ { PACKADDR( 174, 0 , 0 , 0 ), MAKEMASK( 8 )}, // 174.000.000.000 / 255.000.000.000 ++ { PACKADDR( 175, 0 , 0 , 0 ), MAKEMASK( 8 )}, // 175.000.000.000 / 255.000.000.000 ++ { PACKADDR( 176, 0 , 0 , 0 ), MAKEMASK( 8 )}, // 176.000.000.000 / 255.000.000.000 ++ { PACKADDR( 177, 0 , 0 , 0 ), MAKEMASK( 8 )}, // 177.000.000.000 / 255.000.000.000 ++ { PACKADDR( 178, 0 , 0 , 0 ), MAKEMASK( 8 )}, // 178.000.000.000 / 255.000.000.000 ++ { PACKADDR( 179, 0 , 0 , 0 ), MAKEMASK( 8 )}, // 179.000.000.000 / 255.000.000.000 ++ { PACKADDR( 180, 0 , 0 , 0 ), MAKEMASK( 8 )}, // 180.000.000.000 / 255.000.000.000 ++ { PACKADDR( 181, 0 , 0 , 0 ), MAKEMASK( 8 )}, // 181.000.000.000 / 255.000.000.000 ++ { PACKADDR( 182, 0 , 0 , 0 ), MAKEMASK( 8 )}, // 182.000.000.000 / 255.000.000.000 ++ { PACKADDR( 183, 0 , 0 , 0 ), MAKEMASK( 8 )}, // 183.000.000.000 / 255.000.000.000 ++ { PACKADDR( 184, 0 , 0 , 0 ), MAKEMASK( 8 )}, // 184.000.000.000 / 255.000.000.000 ++ { PACKADDR( 185, 0 , 0 , 0 ), MAKEMASK( 8 )}, // 185.000.000.000 / 255.000.000.000 ++ { PACKADDR( 186, 0 , 0 , 0 ), MAKEMASK( 8 )}, // 186.000.000.000 / 255.000.000.000 ++ { PACKADDR( 187, 0 , 0 , 0 ), MAKEMASK( 8 )}, // 187.000.000.000 / 255.000.000.000 ++ { PACKADDR( 189, 0 , 0 , 0 ), MAKEMASK( 8 )}, // 189.000.000.000 / 255.000.000.000 ++ { PACKADDR( 190, 0 , 0 , 0 ), MAKEMASK( 8 )}, // 190.000.000.000 / 255.000.000.000 ++ { PACKADDR( 192, 0 , 2 , 0 ), MAKEMASK( 24 )}, // 192.000.002.000 / 255.255.255.000 ++ { PACKADDR( 192, 168, 0 , 0 ), MAKEMASK( 16 )}, // 192.168.000.000 / 255.255.000.000 ++ { PACKADDR( 197, 0 , 0 , 0 ), MAKEMASK( 8 )}, // 197.000.000.000 / 255.000.000.000 ++ { PACKADDR( 198, 18 , 0 , 0 ), MAKEMASK( 15 )}, // 198.018.000.000 / 255.127.000.000 ++ { PACKADDR( 223, 0 , 0 , 0 ), MAKEMASK( 8 )}, // 223.000.000.000 / 255.000.000.000 ++ { PACKADDR( 224, 0 , 0 , 0 ), MAKEMASK( 4 )}, // 224.000.000.000 / X.000.000.000 ++*/ ++}; ++ ++ ++/** ++ * void Manager::doList() ++ * ++ * list all registerd handlers ++ */ ++void DownloadManager::doList() ++{ ++ list ::iterator dhandler; ++ logSpam("=--- %-69s ---=\n","DownloadManager"); ++ uint32_t i=0; ++ for(dhandler = m_DownloadHandlers.begin();dhandler != m_DownloadHandlers.end();dhandler++,i++) ++ { ++ logSpam(" %i) %5s %-8s %s\n",i,dhandler->m_Protocol.c_str() ,dhandler->m_Handler->getDownloadHandlerName().c_str(), dhandler->m_Handler->getDownloadHandlerDescription().c_str()); ++ } ++ logSpam("=--- %2i %-66s ---=\n",i, "DownloadHandlers registerd"); ++ ++ for ( i = 0; i < sizeof(m_irLocalRanges) / sizeof(ip_range_t); i++ ) ++ { ++ string range= inet_ntoa(*(in_addr *)&m_irLocalRanges[i].m_ulAddress); ++ range += "/"; ++ range += inet_ntoa(*(in_addr *)&m_irLocalRanges[i].m_ulMask); ++ logSpam("Ignoring %s \n", range.c_str()); ++ } ++ logSpam("=--- %2i %-66s ---=\n\n",i, "Ranges ignored"); ++ ++} ++ ++ ++/** ++ * check if a fiven ipv4 address is a local address ++ * ++ * @param ulAddress the ip to check ++ * ++ * @return true if it is a local address, else false. ++ */ ++bool DownloadManager::isLocalAddress(uint32_t ulAddress) ++{ ++ for ( uint32_t i = 0; i < sizeof(m_irLocalRanges) / sizeof(ip_range_t); i++ ) ++ if ( (ulAddress & m_irLocalRanges[i].m_ulMask) == m_irLocalRanges[i].m_ulAddress ) ++ return true; ++ ++ return false; ++} ++ ++/** ++ * gives the download to the handler who registerd the used protocol ++ * ++ * @param down the Download information ++ * ++ * @return returns true if a handler was found, else false ++ */ ++bool DownloadManager::downloadUrl(Download *down) ++{ ++ ++ // this is an event ++ SubmitEvent se(EV_DOWNLOAD,down); ++ g_Nepenthes->getEventMgr()->handleEvent(&se); ++ ++ if ( down->getDownloadUrl()->getPort() <= 0 || down->getDownloadUrl()->getPort() > 65536 ) ++ { ++ logWarn("malformed url 0getUrl().c_str()); ++ delete down; ++ return false; ++ } ++ ++ uint32_t ulAddress = inet_addr(down->getDownloadUrl()->getHost().c_str()); ++ ++ logSpam("Checking Host %s for locality \n",down->getDownloadUrl()->getHost().c_str()); ++ if ( ulAddress != INADDR_NONE ) ++ { // address is either dns or invalid ip ++ logSpam("Host %s is valid ip \n",down->getDownloadUrl()->getHost().c_str()); ++ bool bReplaceHost = false; ++ if ( isLocalAddress(ulAddress) == true ) ++ { // local ip ++ if ( m_ReplaceLocalIps ) ++ { ++ bReplaceHost = true; ++ logInfo("Link %s has local address, replacing with real ip \n",down->getUrl().c_str()); ++ ++ } ++ else ++ { ++ logDebug(" Address %s is local, we will not download \n",inet_ntoa( *(in_addr *)&ulAddress)); ++ delete down; ++ return false; ++ } ++ } ++ ++ if ( bReplaceHost ) ++ { ++ string sUrl = down->getDownloadUrl()->getProtocol(); ++ sUrl += "://"; ++ ++ uint32_t newaddr = down->getRemoteHost(); ++ sUrl += inet_ntoa(*(in_addr *)&newaddr); ++ down->getDownloadUrl()->setHost(newaddr); ++ logInfo("Replaced Address, new URL is %s \n",sUrl.c_str()); ++ ++ char *port; ++ asprintf(&port,":%i/",down->getDownloadUrl()->getPort()); ++ sUrl += port; ++ free(port); ++ ++ sUrl += down->getDownloadUrl()->getPath(); ++ down->setUrl(&sUrl); ++ } ++ } ++ ++ ++ list ::iterator handler; ++ for ( handler = m_DownloadHandlers.begin(); handler != m_DownloadHandlers.end(); handler++ ) ++ { ++ if ( handler->m_Protocol == down->getDownloadUrl()->getProtocol() ) ++ { ++ logInfo("Handler %s will download %s \n",handler->m_Handler->getDownloadHandlerName().c_str(),down->getUrl().c_str()); ++ handler->m_Handler->download(down); ++ return true; ++ } ++ } ++ ++ logCrit("No Handler for protocoll %s \n",down->getDownloadUrl()->getProtocol().c_str()); ++ delete down; ++ return false; ++} ++ ++ ++/** ++ * download a file from a given url ++ * the provied information is wrapped to a class Download ++ * and given to downloadUrl(Download *) ++ * ++ * @param url the url to the file ++ * @param address the hosts address who provided the url so we can replace 0.0.0.0 urls with his address ++ * @param triggerline ++ * the triggerline ++ * @param downloadflags ++ * the download flags to use ++ * @param callback the DownloadCallback to attach to the Download ++ * @param obj the additional data to attach to the Download ++ * ++ * @return returns downloadUrl(Download *) return value ++ */ ++bool DownloadManager::downloadUrl(uint32_t localhost, char *url, uint32_t address, const char *triggerline, uint8_t downloadflags, DownloadCallback *callback, void *obj) ++{ ++ Download *down = new Download(localhost, url,address, (char *)triggerline, callback,obj); ++ down->addDownloadFlags(downloadflags); ++ return downloadUrl(down); ++} ++ ++ ++ ++ ++/** ++ * download a file from a given url ++ * ++ * @param proto protocoll ++ * @param user the user to use ++ * @param pass password to use ++ * @param host hostname to connect ++ * ++ * @param port port to use ++ * ++ * @param file file to download ++ * @param address attackers ip ++ * @param downloadflags ++ * downloadflags ++ * ++ * @return true ++ */ ++bool DownloadManager::downloadUrl(uint32_t localhost, char *proto, char *user, char *pass, char *host, char *port, char *file, uint32_t address, uint8_t downloadflags) ++{ ++ string url = proto; ++ url += "://"; ++ url += user; ++ url += ":"; ++ url += pass; ++ url += "@"; ++ url += host; ++ url += ":"; ++ url += port; ++ url += "/"; ++ url += file; ++ ++ Download *down = new Download(localhost, (char *)url.c_str(),address,(char *)url.c_str()); ++ ++ down->getDownloadUrl()->setProtocol(proto); ++ down->getDownloadUrl()->setUser(user); ++ down->getDownloadUrl()->setPass(pass); ++ down->getDownloadUrl()->setHost(host); ++ down->getDownloadUrl()->setPort(atoi(port)); ++ down->getDownloadUrl()->setPath(file); ++ down->getDownloadUrl()->setFile(file); ++ ++ down->addDownloadFlags(downloadflags); ++ return downloadUrl(down); ++} ++ ++ ++ ++/** ++ * registers a downloadhandler with his ptr and his protocol ++ * ++ * @param handler pointer to the DownloadHandler ++ * @param protocol the protocol, f.e. "http" ++ * ++ * @return returns true if the downloadhandler could be registerd ++ * false if another downloadhandler already registerd the protocol ++ */ ++bool DownloadManager::registerDownloadHandler(DownloadHandler * handler, const char * protocol) ++{ ++ DownloadHandlerTuple dht; ++ dht.m_Handler = handler; ++ dht.m_Protocol = protocol; ++ m_DownloadHandlers.push_back(dht); ++ logDebug("Registerd %s as handler for protocol %-9s (%i protocols supported)\n",handler->getDownloadHandlerName().c_str(),protocol, m_DownloadHandlers.size()); ++ return true; ++} ++ ++ ++/** ++ * delete a downloadhandler from the manager ++ * ++ * @param protocol the protocols handler we want to remove from the downloadmanager ++ */ ++void DownloadManager::unregisterDownloadHandler(const char * protocol) ++{ ++ ++ return; ++} +diff -urNad nepenthes-0.2.2~/nepenthes-core/src/ModuleManager.cpp nepenthes-0.2.2/nepenthes-core/src/ModuleManager.cpp +--- nepenthes-0.2.2~/nepenthes-core/src/ModuleManager.cpp 2009-02-18 21:05:21.000000000 -0200 ++++ nepenthes-0.2.2/nepenthes-core/src/ModuleManager.cpp 2009-02-18 21:05:22.000000000 -0200 +@@ -35,6 +35,7 @@ + #include "Nepenthes.hpp" + #include "LogManager.hpp" + ++#include + #include + + using namespace nepenthes; +diff -urNad nepenthes-0.2.2~/nepenthes-core/src/ShellcodeManager.cpp nepenthes-0.2.2/nepenthes-core/src/ShellcodeManager.cpp +--- nepenthes-0.2.2~/nepenthes-core/src/ShellcodeManager.cpp 2006-04-11 23:18:51.000000000 -0300 ++++ nepenthes-0.2.2/nepenthes-core/src/ShellcodeManager.cpp 2009-02-18 21:05:22.000000000 -0200 +@@ -35,6 +35,8 @@ + #include "SocketEvent.hpp" + #include "EventManager.hpp" + ++#include ++ + using namespace nepenthes; + + #ifdef STDTAGS +diff -urNad nepenthes-0.2.2~/nepenthes-core/src/Socket.cpp nepenthes-0.2.2/nepenthes-core/src/Socket.cpp +--- nepenthes-0.2.2~/nepenthes-core/src/Socket.cpp 2009-02-18 21:05:21.000000000 -0200 ++++ nepenthes-0.2.2/nepenthes-core/src/Socket.cpp 2009-02-18 21:05:22.000000000 -0200 +@@ -29,6 +29,7 @@ + + #include + #include ++#include + #include + + #include +diff -urNad nepenthes-0.2.2~/nepenthes-core/src/Utilities.cpp nepenthes-0.2.2/nepenthes-core/src/Utilities.cpp +--- nepenthes-0.2.2~/nepenthes-core/src/Utilities.cpp 2009-02-18 21:05:21.000000000 -0200 ++++ nepenthes-0.2.2/nepenthes-core/src/Utilities.cpp 2009-02-18 21:05:22.000000000 -0200 +@@ -38,6 +38,7 @@ + #include + #include + ++#include + #include + + #include "Utilities.hpp" only in patch2: unchanged: --- nepenthes-0.2.2.orig/debian/patches/07_includes_for_eglibc_2.10.dpatch +++ nepenthes-0.2.2/debian/patches/07_includes_for_eglibc_2.10.dpatch @@ -0,0 +1,18 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 06_more_includes.dpatch by Ilya Barygin +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Add missing #include to modules/submit-postgres/PGDownloadContext.cpp + +@DPATCH@ +diff -urNad nepenthes-0.2.2~/modules/submit-postgres/PGDownloadContext.cpp nepenthes-0.2.2/modules/submit-postgres/PGDownloadContext.cpp +--- nepenthes-0.2.2~/modules/submit-postgres/PGDownloadContext.cpp 2006-10-29 23:08:42.000000000 +0300 ++++ nepenthes-0.2.2/modules/submit-postgres/PGDownloadContext.cpp 2009-12-10 15:16:08.000000000 +0300 +@@ -41,6 +41,7 @@ + #include + #include + #include ++#include + + #include + #include