--- libspf2-1.2.5.orig/config/config.sub +++ libspf2-1.2.5/config/config.sub @@ -1,9 +1,9 @@ #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -timestamp='2004-01-05' +timestamp='2004-06-24' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -70,7 +70,7 @@ version="\ GNU config.sub ($timestamp) -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO @@ -145,7 +145,7 @@ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis) + -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; @@ -237,7 +237,7 @@ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ - | m32r | m68000 | m68k | m88k | mcore \ + | m32r | m32rle | m68000 | m68k | m88k | mcore \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ @@ -262,7 +262,7 @@ | pyramid \ | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ - | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ + | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \ | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ @@ -300,7 +300,7 @@ | avr-* \ | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ - | clipper-* | cydra-* \ + | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ @@ -308,7 +308,7 @@ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ - | m32r-* \ + | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ @@ -326,8 +326,9 @@ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ + | mmix-* \ | msp430-* \ - | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ @@ -336,7 +337,7 @@ | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ - | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ @@ -363,6 +364,9 @@ basic_machine=a29k-amd os=-udi ;; + abacus) + basic_machine=abacus-unknown + ;; adobe68k) basic_machine=m68010-adobe os=-scout @@ -442,12 +446,24 @@ basic_machine=j90-cray os=-unicos ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16c) + basic_machine=cr16c-unknown + os=-elf + ;; crds | unos) basic_machine=m68k-crds ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; da30 | da30-*) basic_machine=m68k-da30 ;; @@ -648,10 +664,6 @@ mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; - mmix*) - basic_machine=mmix-knuth - os=-mmixware - ;; monitor) basic_machine=m68k-rom68k os=-coff @@ -732,10 +744,6 @@ np1) basic_machine=np1-gould ;; - nv1) - basic_machine=nv1-cray - os=-unicosmp - ;; nsr-tandem) basic_machine=nsr-tandem ;; @@ -1048,6 +1056,9 @@ romp) basic_machine=romp-ibm ;; + mmix) + basic_machine=mmix-knuth + ;; rs6000) basic_machine=rs6000-ibm ;; @@ -1070,7 +1081,7 @@ sh64) basic_machine=sh64-unknown ;; - sparc | sparcv9 | sparcv9b) + sparc | sparcv8 | sparcv9 | sparcv9b) basic_machine=sparc-sun ;; cydra) @@ -1143,8 +1154,9 @@ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -knetbsd* | -netbsd* | -openbsd* | -kfreebsd* | -freebsd* | -riscix* \ - | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ @@ -1362,6 +1374,9 @@ *-ibm) os=-aix ;; + *-knuth) + os=-mmixware + ;; *-wec) os=-proelf ;; --- libspf2-1.2.5.orig/config/config.guess +++ libspf2-1.2.5/config/config.guess @@ -1,9 +1,9 @@ #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -timestamp='2004-01-05' +timestamp='2004-08-13' # 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 @@ -53,7 +53,7 @@ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO @@ -197,15 +197,21 @@ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit 0 ;; + amd64:OpenBSD:*:*) + echo x86_64-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; - arc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} + cats:OpenBSD:*:*) + echo arm-unknown-openbsd${UNAME_RELEASE} exit 0 ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; + luna88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; mac68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; @@ -221,28 +227,33 @@ mvmeppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; - pegasos:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - pmax:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; sgi:OpenBSD:*:*) - echo mipseb-unknown-openbsd${UNAME_RELEASE} + echo mips64-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sun3:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; - wgrisc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} exit 0 ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit 0 ;; + macppc:MirBSD:*:*) + echo powerppc-unknown-mirbsd${UNAME_RELEASE} + exit 0 ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit 0 ;; alpha:OSF1:*:*) - if test $UNAME_RELEASE = "V4.0"; then + case $UNAME_RELEASE in + *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - fi + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU @@ -280,14 +291,12 @@ "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac + # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit 0 ;; - Alpha*:OpenVMS:*:*) - echo alpha-hp-vms + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit 0 ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? @@ -405,6 +414,9 @@ *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit 0 ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit 0 ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit 0 ;; @@ -740,7 +752,7 @@ echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; *:UNICOS/mp:*:*) - echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` @@ -763,21 +775,7 @@ echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:FreeBSD:*:*) - # Determine whether the default compiler uses glibc. - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - #if __GLIBC__ >= 2 - LIBC=gnu - #else - LIBC= - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - # GNU/KFreeBSD systems have a "k" prefix to indicate we are using - # FreeBSD's kernel, but not the complete OS. - case ${LIBC} in gnu) kernel_only='k' ;; esac - echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin @@ -829,6 +827,9 @@ ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; @@ -1069,9 +1070,9 @@ M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit 0 ;; - M68*:*:R3V[567]*:*) + M68*:*:R3V[5678]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0) + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` @@ -1169,9 +1170,10 @@ echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Darwin:*:*) - case `uname -p` in + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in *86) UNAME_PROCESSOR=i686 ;; - powerpc) UNAME_PROCESSOR=powerpc ;; + unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit 0 ;; @@ -1230,9 +1232,16 @@ SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit 0 ;; - *:DRAGONFLY:*:*) - echo ${UNAME_MACHINE}-unknown-dragonfly${UNAME_RELEASE} + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms && exit 0 ;; + I*) echo ia64-dec-vms && exit 0 ;; + V*) echo vax-dec-vms && exit 0 ;; + esac esac #echo '(No uname command or uname output not recognized.)' 1>&2 --- libspf2-1.2.5.orig/debian/control +++ libspf2-1.2.5/debian/control @@ -0,0 +1,39 @@ +Source: libspf2 +Priority: optional +Maintainer: Eric Dorland +Build-Depends: debhelper (>> 4.1), cdbs +Standards-Version: 3.6.1 + +Package: libspf2-dev +Section: libdevel +Architecture: any +Depends: libspf2-2 (= ${Source-Version}) +Description: Header and development libraries for libspf2 + libspf2 implements the Sender Policy Framework, a part of the SPF/SRS + protocol pair. libspf2 is a library which allows email systems such + as Sendmail, Postfix, Exim, Zmailer and MS Exchange to check SPF + records and make sure that the email is authorized by the domain name + that it is coming from. This prevents email forgery, commonly used by + spammers, scammers and email viruses/worms. + +Package: libspf2-2 +Section: libs +Architecture: any +Conflicts: libspf2-0 +Replaces: libspf2-0 +Depends: ${shlibs:Depends} +Description: Sender Policy Framework library, written in C + libspf2 implements the Sender Policy Framework, a part of the SPF/SRS + protocol pair. libspf2 is a library which allows email systems such + as Sendmail, Postfix, Exim, Zmailer and MS Exchange to check SPF + records and make sure that the email is authorized by the domain name + that it is coming from. This prevents email forgery, commonly used by + spammers, scammers and email viruses/worms. + +Package: spfquery +Section: mail +Architecture: any +Depends: ${shlibs:Depends} +Conflicts: libmail-spf-query-perl +Description: Sender Policy Framework library, written in C + Utilities to test and query SPF records. \ No newline at end of file --- libspf2-1.2.5.orig/debian/libspf2-2.install +++ libspf2-1.2.5/debian/libspf2-2.install @@ -0,0 +1 @@ +debian/tmp/usr/lib/*.so.* usr/lib --- libspf2-1.2.5.orig/debian/rules +++ libspf2-1.2.5/debian/rules @@ -0,0 +1,6 @@ +#!/usr/bin/make -f + +include /usr/share/cdbs/1/class/autotools.mk +include /usr/share/cdbs/1/rules/debhelper.mk + +DEB_DH_MAKESHLIBS_ARGS_ALL := -V --- libspf2-1.2.5.orig/debian/libspf2-dev.README.Debian +++ libspf2-1.2.5/debian/libspf2-dev.README.Debian @@ -0,0 +1,8 @@ +libspf2 for Debian +------------------ + +Information and more recent versions of libspf2 are available from + + http://www.libspf2.org/ + + -- Eric Dorland , Sun Jul 4 19:02:07 2004 --- libspf2-1.2.5.orig/debian/changelog +++ libspf2-1.2.5/debian/changelog @@ -0,0 +1,74 @@ +libspf2 (1.2.5-3ubuntu0.1) dapper-security; urgency=high + + * SECURITY UPDATE: + * References CVE2008-2469 + * Change libspf2/src/libspf2/spf_dns_resolv.c to fix buffer overflows in + handling DNS responses. (LP: #271025) + + -- Scott Kitterman Wed, 15 Oct 2008 00:35:25 -0400 + +libspf2 (1.2.5-3) unstable; urgency=low + + * src/include/spf_server.h: Remove useless include to + spf_dns_internal.h. (Closes: #312145) + * debian/control: Have spfquery against libmail-spf-query-perl to work + around #306875, hopefully temporarily. + + -- Eric Dorland Sat, 30 Jul 2005 01:25:24 -0400 + +libspf2 (1.2.5-2) unstable; urgency=low + + * The "Doh, missed a soname change" release. + * debian/libspf2-0.install: Rename to libspf2-2.install. + * debian/control: + - Change libspf2-0 to libspf2-2 to reflect soname change. + (Closes: #306205) + - Add spfquery package, don't package spfd for now, can't figure + out how to make it work. This partially addresses #258360. + * debian/spfquery.install: New file. + + -- Eric Dorland Mon, 25 Apr 2005 20:07:48 -0400 + +libspf2 (1.2.5-1) unstable; urgency=low + + * New upstream release. + + -- Eric Dorland Sun, 17 Apr 2005 23:37:27 -0400 + +libspf2 (1.0.4-4) unstable; urgency=medium + + * configure, aclocal.m4: Run aclocal and autoconf to get the right code + for the libtool test to use the pass_all method on arm. (Closes: + #276516) + * Urgency medium to get this bloody thing fixed already. + + -- Eric Dorland Fri, 26 Nov 2004 00:15:04 -0500 + +libspf2 (1.0.4-3) unstable; urgency=low + + * config/ltmain.sh: Re-libtoolize again, hopefully this will fix arm + building. + + -- Eric Dorland Wed, 17 Nov 2004 13:50:50 -0500 + +libspf2 (1.0.4-2) unstable; urgency=low + + * config/ltmain.sh: Re-libtoolize. (Closes: #269936) + * configure.ac: Apply patch from Kurt Roeckx to fix build on + amd64. (Closes: #262687) + * Rerun autoconf to apply the changes. + + -- Eric Dorland Mon, 6 Sep 2004 19:36:20 -0400 + +libspf2 (1.0.4-1) unstable; urgency=low + + * New upstream release. (Closes: #261709) + + -- Eric Dorland Mon, 9 Aug 2004 00:57:49 -0400 + +libspf2 (1.0.3-1) unstable; urgency=low + + * Initial release. (Closes: #257644) + + -- Eric Dorland Fri, 2 Jul 2004 00:00:19 -0400 + --- libspf2-1.2.5.orig/debian/libspf2-dev.install +++ libspf2-1.2.5/debian/libspf2-dev.install @@ -0,0 +1,4 @@ +debian/tmp/usr/lib/*.so usr/lib +debian/tmp/usr/lib/*.a usr/lib +debian/tmp/usr/lib/*.la usr/lib +debian/tmp/usr/include/* usr/include --- libspf2-1.2.5.orig/debian/spfquery.install +++ libspf2-1.2.5/debian/spfquery.install @@ -0,0 +1,3 @@ +debian/tmp/usr/bin/spfquery usr/bin +debian/tmp/usr/bin/spftest usr/bin +debian/tmp/usr/bin/spf_example usr/bin --- libspf2-1.2.5.orig/debian/copyright +++ libspf2-1.2.5/debian/copyright @@ -0,0 +1,17 @@ +This package was debianized by Eric Dorland on +Sun, 04 Jul 2004 19:00:36 -0400 + +It was downloaded from http://www.libspf2.org/ + +Upstream Author: Wayne Schlitt + +Copyright: + +This software is copyright (c) 2004 by Wayne Schlitt + +You are free to distribute this software under the terms of +the GNU General Public License version 2 or the BSD license, at your choice. + +On Debian systems, the complete text of the GNU General Public +License can be found in the file `/usr/share/common-licenses/GPL-2' and +the BSD license can be found in the file `/usr/share/common-licenses/BSD'. --- libspf2-1.2.5.orig/src/libspf2/spf_dns_resolv.c +++ libspf2-1.2.5/src/libspf2/spf_dns_resolv.c @@ -110,7 +110,8 @@ int nrec; int cnt; - u_char response[2048]; + u_char *responsebuf; + size_t responselen; int dns_len; @@ -127,11 +128,13 @@ char name_buf[ NS_MAXDNAME ]; int prio; - int rdlen; - const u_char *rdata, *rdata_end; + size_t rdlen; + const u_char *rdata; +#if HAVE_DECL_RES_NINIT void *res_spec; struct __res_state *res_state; +#endif SPF_ASSERT_NOTNULL(spf_dns_server); @@ -140,10 +143,12 @@ SPF_ASSERT_NOTNULL(spfhook); #endif +#if HAVE_DECL_RES_NINIT res_spec = pthread_getspecific(res_state_key); if (res_spec == NULL) { res_state = (struct __res_state *) malloc(sizeof(struct __res_state)); + memset(res_state, 0, sizeof(struct __res_state)); if (res_ninit(res_state) != 0) { SPF_error("Failed to call res_ninit()"); } @@ -152,20 +157,45 @@ else { res_state = (struct __res_state *)res_spec; } +#endif + + responselen = 2048; + responsebuf = (u_char *)malloc(responselen); + memset(responsebuf, 0, responselen); + + /* + * Retry the lookup until our response buffer is big enough. + * + * This loop repeats until either we fail a lookup or we succeed. + * The size of the response buffer is monotonic increasing, so eventually we + * must either succeed, or we try to malloc more RAM than we can. + * + * The Linux man pages do not describe res_nquery adequately. Solaris says: + * + * The res_nquery() and res_query() routines return a length that may be bigger + * than anslen. In that case, retry the query with a larger buf. The answer to the + * second query may be larger still], so it is recommended that you supply a buf + * larger than the answer returned by the previous query. answer must be large + * enough to receive a maximum UDP response from the server or parts of the answer + * will be silently discarded. The default maximum UDP response size is 512 bytes. + */ + for (;;) { /* * try resolving the name */ #if HAVE_DECL_RES_NINIT dns_len = res_nquery(res_state, domain, ns_c_in, rr_type, - response, sizeof(response)); + responsebuf, responselen); #else dns_len = res_query(domain, ns_c_in, rr_type, - response, sizeof(response)); + responsebuf, responselen); #endif if ( dns_len < 0 ) { + /* We failed to perform a lookup. */ /* This block returns unconditionally. */ + free(responsebuf); if ( spf_dns_server->debug ) SPF_debugf( "query failed: err = %d %s (%d): %s", dns_len, hstrerror( SPF_h_errno ), SPF_h_errno, @@ -178,6 +208,25 @@ return SPF_dns_rr_new_init(spf_dns_server, domain, rr_type, 0, SPF_h_errno); } + else if (dns_len > responselen) { + /* We managed a lookup but our buffer was too small. */ + responselen = dns_len + (dns_len >> 1); +#if 0 + /* Sanity-trap - we should never hit this. */ + if (responselen > 1048576) { /* One megabyte. */ + free(responsebuf); + return SPF_dns_rr_new_init(spf_dns_server, + domain, rr_type, 0, SPF_h_errno); + } +#endif + responsebuf = realloc(responsebuf, responselen); + } + else { + /* We managed a lookup, and our buffer was large enough. */ + responselen = dns_len; + break; + } + } /* * initialize stuff @@ -185,12 +234,13 @@ spfrr = SPF_dns_rr_new_init(spf_dns_server, domain, rr_type, 0, NETDB_SUCCESS); - err = ns_initparse( response, dns_len, &ns_handle ); + err = ns_initparse(responsebuf, responselen, &ns_handle); if ( err < 0 ) { /* 0 or -1 */ if ( spf_dns_server->debug ) SPF_debugf( "ns_initparse failed: err = %d %s (%d)", err, strerror( errno ), errno ); + free(responsebuf); return spfrr; } @@ -226,6 +276,7 @@ if ( spf_dns_server->debug > 1 ) SPF_debugf( "ns_parserr failed: err = %d %s (%d)", err, strerror( errno ), errno ); + free(responsebuf); return spfrr; } @@ -257,8 +308,8 @@ break; case ns_t_ns: - err = ns_name_uncompress( response, - response + sizeof( response ), + err = ns_name_uncompress( responsebuf, + responsebuf + responselen, rdata, name_buf, sizeof( name_buf ) ); if ( err < 0 ) /* 0 or -1 */ @@ -271,8 +322,8 @@ break; case ns_t_cname: - err = ns_name_uncompress( response, - response + sizeof( response ), + err = ns_name_uncompress( responsebuf, + responsebuf + responselen, rdata, name_buf, sizeof( name_buf ) ); if ( err < 0 ) /* 0 or -1 */ @@ -286,8 +337,8 @@ case ns_t_mx: prio = ns_get16( rdata ); - err = ns_name_uncompress( response, - response + sizeof( response ), + err = ns_name_uncompress( responsebuf, + responsebuf + sizeof( responselen ), rdata + NS_INT16SZ, name_buf, sizeof( name_buf ) ); if ( err < 0 ) /* 0 or -1 */ @@ -300,14 +351,13 @@ break; case ns_t_txt: - rdata_end = rdata + rdlen; SPF_debugf( "TXT: (%d) \"%.*s\"", rdlen, rdlen-1, rdata+1 ); break; case ns_t_ptr: - err = ns_name_uncompress( response, - response + sizeof( response ), + err = ns_name_uncompress( responsebuf, + responsebuf + responselen, rdata, name_buf, sizeof( name_buf ) ); if ( err < 0 ) /* 0 or -1 */ @@ -341,18 +391,21 @@ { case ns_t_a: if ( SPF_dns_rr_buf_realloc( spfrr, cnt, - sizeof( spfrr->rr[cnt]->a ) ) != SPF_E_SUCCESS ) + sizeof(spfrr->rr[cnt]->a)) != SPF_E_SUCCESS) { + free(responsebuf); return spfrr; - memmove( &spfrr->rr[cnt]->a, rdata, sizeof( spfrr->rr[cnt]->a ) ); + } + memcpy(&spfrr->rr[cnt]->a, rdata, sizeof(spfrr->rr[cnt]->a)); cnt++; break; case ns_t_aaaa: if ( SPF_dns_rr_buf_realloc( spfrr, cnt, - sizeof( spfrr->rr[cnt]->aaaa ) ) != SPF_E_SUCCESS ) + sizeof(spfrr->rr[cnt]->aaaa)) != SPF_E_SUCCESS) { + free(responsebuf); return spfrr; - memmove( &spfrr->rr[cnt]->aaaa, rdata, sizeof( spfrr->rr[cnt]->aaaa ) ); - + } + memcpy(&spfrr->rr[cnt]->aaaa, rdata, sizeof(spfrr->rr[cnt]->aaaa)); cnt++; break; @@ -364,8 +417,8 @@ break; case ns_t_mx: - err = ns_name_uncompress( response, - response + sizeof( response ), + err = ns_name_uncompress(responsebuf, + responsebuf + responselen, rdata + NS_INT16SZ, name_buf, sizeof( name_buf ) ); if ( err < 0 ) /* 0 or -1 */ @@ -373,12 +426,15 @@ if ( spf_dns_server->debug > 1 ) SPF_debugf( "ns_name_uncompress failed: err = %d %s (%d)", err, strerror( errno ), errno ); + free(responsebuf); return spfrr; } if ( SPF_dns_rr_buf_realloc( spfrr, cnt, - strlen( name_buf ) + 1 ) != SPF_E_SUCCESS ) + strlen(name_buf) + 1 ) != SPF_E_SUCCESS) { + free(responsebuf); return spfrr; + } strcpy( spfrr->rr[cnt]->mx, name_buf ); cnt++; @@ -390,8 +446,12 @@ u_char *src, *dst; size_t len; - if ( SPF_dns_rr_buf_realloc( spfrr, cnt, rdlen ) != SPF_E_SUCCESS ) + /* Just rdlen is enough because there is at least one + * length byte. */ + if (SPF_dns_rr_buf_realloc(spfrr, cnt, rdlen) != SPF_E_SUCCESS) { + free(responsebuf); return spfrr; + } dst = spfrr->rr[cnt]->txt; len = 0; @@ -400,15 +460,22 @@ { len = *src; src++; + rdlen--; + + /* Avoid buffer overrun if len is junk. */ + if (len > rdlen) + len = rdlen; memcpy( dst, src, len ); dst += len; src += len; - rdlen -= len + 1; + rdlen -= len; } *dst = '\0'; } else { - if ( SPF_dns_rr_buf_realloc( spfrr, cnt, 1 ) != SPF_E_SUCCESS ) + if (SPF_dns_rr_buf_realloc(spfrr, cnt, 1) != SPF_E_SUCCESS) { + free(responsebuf); return spfrr; + } spfrr->rr[cnt]->txt[0] = '\0'; } @@ -416,8 +483,8 @@ break; case ns_t_ptr: - err = ns_name_uncompress( response, - response + sizeof( response ), + err = ns_name_uncompress(responsebuf, + responsebuf + responselen, rdata, name_buf, sizeof( name_buf ) ); if ( err < 0 ) /* 0 or -1 */ @@ -425,12 +492,15 @@ if ( spf_dns_server->debug > 1 ) SPF_debugf( "ns_name_uncompress failed: err = %d %s (%d)", err, strerror( errno ), errno ); + free(responsebuf); return spfrr; } if ( SPF_dns_rr_buf_realloc( spfrr, cnt, - strlen( name_buf ) + 1 ) != SPF_E_SUCCESS ) + strlen(name_buf) + 1) != SPF_E_SUCCESS) { + free(responsebuf); return spfrr; + } strcpy( spfrr->rr[cnt]->ptr, name_buf ); cnt++; @@ -447,6 +517,7 @@ if ( spfrr->num_rr == 0 ) spfrr->herrno = NO_DATA; + free(responsebuf); return spfrr; } --- libspf2-1.2.5.orig/src/libspf2/spf_win32.c +++ libspf2-1.2.5/src/libspf2/spf_win32.c @@ -1,165 +1,165 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of either: - * - * a) The GNU Lesser General Public License as published by the Free - * Software Foundation; either version 2.1, or (at your option) any - * later version, - * - * OR - * - * b) The two-clause BSD license. - * - * These licenses can be found with the distribution in the file LICENSES - */ - -#ifdef _WIN32 - -#include "spf_win32_internal.h" - -int SPF_win32_startup() -{ - WORD wVersionRequested; - WSADATA wsaData; - int err; - - wVersionRequested = MAKEWORD( 2, 2 ); - - err = WSAStartup( wVersionRequested, &wsaData ); - if ( err != 0 ) - return 0; - - if ( LOBYTE( wsaData.wVersion ) != 2 || - HIBYTE( wsaData.wVersion ) != 2 ) - { - WSACleanup(); - return 0; - } - - return 1; -} - -int SPF_win32_cleanup() -{ - return WSACleanup(); -} - -char *inet_ntop( int af, const void *src, char *dst, size_t size ) -{ - void *pSrc_sockaddr; - struct sockaddr_in src_sockaddr; - struct sockaddr_in6 src6_sockaddr; - DWORD src_size; - DWORD temp; - int result; - DWORD error; - - switch( af ) - { - case AF_INET: - src_sockaddr.sin_family = AF_INET; - src_sockaddr.sin_port = 0; - memcpy( &src_sockaddr.sin_addr, src, sizeof( struct in_addr ) ); - pSrc_sockaddr = &src_sockaddr; - src_size = sizeof( struct sockaddr_in ); - break; - case AF_INET6: - src6_sockaddr.sin6_family = AF_INET6; - src6_sockaddr.sin6_port = 0; - src6_sockaddr.sin6_flowinfo = 0; - src6_sockaddr.sin6_scope_id = 0; - memcpy( &src6_sockaddr.sin6_addr, src, sizeof( struct in6_addr ) ); - pSrc_sockaddr = &src6_sockaddr; - src_size = sizeof( struct sockaddr_in6 ); - break; - default: - return NULL; - } - - temp = size; - result = WSAAddressToStringA( (LPSOCKADDR)pSrc_sockaddr, src_size, - NULL, dst, &temp ); - - error = GetLastError(); - - if (result == 0) - // Success - return dst; - else - // Failure - return NULL; -} - -int inet_pton( int af, const char *src, void *dst ) -{ - /* IPv6 is largest buffer, so use it for both */ - struct sockaddr_in6 dst_sockaddr; - struct sockaddr_in6 *pDst_sockaddr; - int dst_size; - int result; - DWORD error; - - pDst_sockaddr = &dst_sockaddr; - - switch( af ) - { - case AF_INET: - dst_size = sizeof( struct sockaddr_in ); - break; - case AF_INET6: - dst_size = sizeof( struct sockaddr_in6 ); - break; - default: - return 0; - } - - result = WSAStringToAddressA( src, af, NULL, - (LPSOCKADDR)pDst_sockaddr, &dst_size ); - - if ( result != 0 ) - { - error = GetLastError(); - return error; - return 0; - } - - switch( af ) - { - case AF_INET: - memcpy( dst, &((struct sockaddr_in*)pDst_sockaddr)->sin_addr, - sizeof( struct in_addr ) ); - break; - case AF_INET6: - memcpy( dst, &pDst_sockaddr->sin6_addr, - sizeof( struct in6_addr ) ); - break; - } - - return 1; -} - -int gethostnameFQDN( char *name, int namelen ) -{ - int result; - int fullnamelen; - struct hostent *he; - - result = gethostname( name, namelen ); - - if ( result == 0 ) - { - he = gethostbyname( name ); - - if (he != NULL) - { - fullnamelen = strlen( he->h_name ); - - if (fullnamelen < namelen) - strcpy( name, he->h_name ); - } - } - - return result; -} - -#endif +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of either: + * + * a) The GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1, or (at your option) any + * later version, + * + * OR + * + * b) The two-clause BSD license. + * + * These licenses can be found with the distribution in the file LICENSES + */ + +#ifdef _WIN32 + +#include "spf_win32_internal.h" + +int SPF_win32_startup() +{ + WORD wVersionRequested; + WSADATA wsaData; + int err; + + wVersionRequested = MAKEWORD( 2, 2 ); + + err = WSAStartup( wVersionRequested, &wsaData ); + if ( err != 0 ) + return 0; + + if ( LOBYTE( wsaData.wVersion ) != 2 || + HIBYTE( wsaData.wVersion ) != 2 ) + { + WSACleanup(); + return 0; + } + + return 1; +} + +int SPF_win32_cleanup() +{ + return WSACleanup(); +} + +char *inet_ntop( int af, const void *src, char *dst, size_t size ) +{ + void *pSrc_sockaddr; + struct sockaddr_in src_sockaddr; + struct sockaddr_in6 src6_sockaddr; + DWORD src_size; + DWORD temp; + int result; + DWORD error; + + switch( af ) + { + case AF_INET: + src_sockaddr.sin_family = AF_INET; + src_sockaddr.sin_port = 0; + memcpy( &src_sockaddr.sin_addr, src, sizeof( struct in_addr ) ); + pSrc_sockaddr = &src_sockaddr; + src_size = sizeof( struct sockaddr_in ); + break; + case AF_INET6: + src6_sockaddr.sin6_family = AF_INET6; + src6_sockaddr.sin6_port = 0; + src6_sockaddr.sin6_flowinfo = 0; + src6_sockaddr.sin6_scope_id = 0; + memcpy( &src6_sockaddr.sin6_addr, src, sizeof( struct in6_addr ) ); + pSrc_sockaddr = &src6_sockaddr; + src_size = sizeof( struct sockaddr_in6 ); + break; + default: + return NULL; + } + + temp = size; + result = WSAAddressToStringA( (LPSOCKADDR)pSrc_sockaddr, src_size, + NULL, dst, &temp ); + + error = GetLastError(); + + if (result == 0) + // Success + return dst; + else + // Failure + return NULL; +} + +int inet_pton( int af, const char *src, void *dst ) +{ + /* IPv6 is largest buffer, so use it for both */ + struct sockaddr_in6 dst_sockaddr; + struct sockaddr_in6 *pDst_sockaddr; + int dst_size; + int result; + DWORD error; + + pDst_sockaddr = &dst_sockaddr; + + switch( af ) + { + case AF_INET: + dst_size = sizeof( struct sockaddr_in ); + break; + case AF_INET6: + dst_size = sizeof( struct sockaddr_in6 ); + break; + default: + return 0; + } + + result = WSAStringToAddressA( src, af, NULL, + (LPSOCKADDR)pDst_sockaddr, &dst_size ); + + if ( result != 0 ) + { + error = GetLastError(); + return error; + return 0; + } + + switch( af ) + { + case AF_INET: + memcpy( dst, &((struct sockaddr_in*)pDst_sockaddr)->sin_addr, + sizeof( struct in_addr ) ); + break; + case AF_INET6: + memcpy( dst, &pDst_sockaddr->sin6_addr, + sizeof( struct in6_addr ) ); + break; + } + + return 1; +} + +int gethostnameFQDN( char *name, int namelen ) +{ + int result; + int fullnamelen; + struct hostent *he; + + result = gethostname( name, namelen ); + + if ( result == 0 ) + { + he = gethostbyname( name ); + + if (he != NULL) + { + fullnamelen = strlen( he->h_name ); + + if (fullnamelen < namelen) + strcpy( name, he->h_name ); + } + } + + return result; +} + +#endif --- libspf2-1.2.5.orig/src/libspf2/spf_dns_windns.c +++ libspf2-1.2.5/src/libspf2/spf_dns_windns.c @@ -1,516 +1,516 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of either: - * - * a) The GNU Lesser General Public License as published by the Free - * Software Foundation; either version 2.1, or (at your option) any - * later version, - * - * OR - * - * b) The two-clause BSD license. - * - * These licenses can be found with the distribution in the file LICENSES - */ - -#ifdef _WIN32 - -#include "spf_sys_config.h" - -#ifdef HAVE_ERRNO_H -#include -#endif - -#ifdef STDC_HEADERS -# include /* stdin / stdout */ -# include /* malloc / free */ -#endif - -#ifdef HAVE_STRING_H -# include /* strstr / strdup */ -#else -# ifdef HAVE_STRINGS_H -# include /* strstr / strdup */ -# endif -#endif - -#include "spf.h" -#include "spf_dns.h" -#include "spf_internal.h" -#include "spf_dns_internal.h" -#include "spf_dns_windns.h" +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of either: + * + * a) The GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1, or (at your option) any + * later version, + * + * OR + * + * b) The two-clause BSD license. + * + * These licenses can be found with the distribution in the file LICENSES + */ + +#ifdef _WIN32 + +#include "spf_sys_config.h" + +#ifdef HAVE_ERRNO_H +#include +#endif + +#ifdef STDC_HEADERS +# include /* stdin / stdout */ +# include /* malloc / free */ +#endif + +#ifdef HAVE_STRING_H +# include /* strstr / strdup */ +#else +# ifdef HAVE_STRINGS_H +# include /* strstr / strdup */ +# endif +#endif + +#include "spf.h" +#include "spf_dns.h" +#include "spf_internal.h" +#include "spf_dns_internal.h" +#include "spf_dns_windns.h" #pragma comment(lib, "dnsapi.lib") -#include - - -typedef struct -{ - int debug; - SPF_dns_rr_t spfrr; -} SPF_dns_windns_config_t; - - -#define SPF_h_errno WSAGetLastError() - - -static inline SPF_dns_windns_config_t *SPF_voidp2spfhook( void *hook ) - { return (SPF_dns_windns_config_t *)hook; } -static inline void *SPF_spfhook2voidp( SPF_dns_windns_config_t *spfhook ) - { return (void *)spfhook; } - - -LPSTR SPF_dns_create_error_message_windns(DWORD last_error) -{ - LPSTR error_message; - - if (!FormatMessageA( - (FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS), - NULL, - last_error, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language - (LPSTR) &error_message, - 0, - NULL)) - { - return NULL; - } - - return error_message; -} - - -void SPF_dns_destroy_error_message_windns(LPSTR error_message) -{ - LocalFree( error_message ); -} - - -size_t SPF_dns_txt_get_length_windns(DWORD count, PSTR strings[]) -{ - size_t length; - DWORD i; - - length = 0; - - for( i = 0; i < count; i++ ) - { - length = length + strlen(strings[i]); - } - - return length; -} - - -char *SPF_dns_txt_concat_windns(char *buffer, DWORD count, PSTR strings[]) -{ - DWORD i; - - buffer[0] = 0; - - for( i = 0; i < count; i++ ) - { - if ( strcat( buffer, strings[i] ) == NULL ) - return NULL; - } - - return buffer; -} - - -static SPF_dns_rr_t *SPF_dns_lookup_windns( SPF_dns_config_t spfdcid, const char *domain, ns_type rr_type, int should_cache ) -{ - SPF_dns_iconfig_t *spfdic = SPF_dcid2spfdic( spfdcid ); - SPF_dns_windns_config_t *spfhook = SPF_voidp2spfhook( spfdic->hook ); - SPF_dns_rr_t *spfrr; - - int cnt; - - PDNS_RECORDA pDnsRecord; - - DNS_STATUS status; - LPSTR error_message; - - char ip4_buf[ INET_ADDRSTRLEN ]; - char ip6_buf[ INET6_ADDRSTRLEN ]; - - int rdlen; - - DNS_A_DATA *pA_data; - DNS_AAAA_DATA *pAAAA_data; - DNS_MX_DATAA *pMX_data; - DNS_TXT_DATAA *pTXT_data; - DNS_PTR_DATAA *pPTR_data; - - size_t txt_data_len; - char *txt_concat; - - - /* - * initialize stuff - */ - spfrr = &spfhook->spfrr; - SPF_dns_reset_rr( spfrr ); - spfrr->herrno = NO_RECOVERY; - spfrr->rr_type = rr_type; - if ( domain && domain[0] != '\0' ) - { - char *new_domain; - size_t new_len = strlen( domain ) + 1; - - if ( spfrr->domain_buf_len < new_len ) - { - new_domain = realloc( spfrr->domain, new_len ); - if ( new_domain == NULL ) - return spfrr; - - spfrr->domain = new_domain; - spfrr->domain_buf_len = new_len; - } - strcpy( spfrr->domain, domain ); - } - else if ( spfrr->domain ) - spfrr->domain[0] = '\0'; - - cnt = 0; - - if ( spfhook->debug ) - SPF_debugf( "WinDNS looking for: %s %s (%d)", - domain, - ( - (rr_type == ns_t_a) ? "A" : - (rr_type == ns_t_aaaa) ? "AAAA" : - (rr_type == ns_t_mx) ? "MX" : - (rr_type == ns_t_txt) ? "TXT" : - (rr_type == ns_t_ptr) ? "PTR" : - (rr_type == ns_t_any) ? "ANY" : - "??" - ), - rr_type ); - - - /* - * try resolving the name - */ - status = DnsQuery_A( domain, rr_type, - (DNS_QUERY_STANDARD + DNS_QUERY_TREAT_AS_FQDN), - NULL, &pDnsRecord, NULL ); - - if ( status != DNS_RCODE_NOERROR ) - { - if ( spfhook->debug ) - { - error_message = SPF_dns_create_error_message_windns(SPF_h_errno); - - SPF_debugf( "query failed: err = %d %s (%d)", - status, error_message, SPF_h_errno ); - - SPF_dns_destroy_error_message_windns(error_message); - } - - if ( - ( SPF_h_errno == HOST_NOT_FOUND ) && - ( spfdic->layer_below ) - ) - return SPF_dcid2spfdic( spfdic->layer_below )->lookup( spfdic->layer_below, domain, rr_type, should_cache ); - - spfrr->herrno = SPF_h_errno; - return spfrr; - } - else - spfrr->herrno = NETDB_SUCCESS; - - while (pDnsRecord) - { - rdlen = pDnsRecord->wDataLength; - - if ( spfhook->debug > 1 ) - SPF_debugf( "name: %s type: %d ttl: %d rdlen: %d", - pDnsRecord->pName, pDnsRecord->wType, - pDnsRecord->dwTtl, rdlen ); - - if ( rdlen <= 0 ) - { - pDnsRecord = pDnsRecord->pNext; - continue; - } - - /* No sense in doing this twice */ - if (pDnsRecord->wType == ns_t_txt) - { - pTXT_data = &pDnsRecord->Data.TXT; - - txt_data_len = - SPF_dns_txt_get_length_windns( - pTXT_data->dwStringCount, - pTXT_data->pStringArray - ); - } - - if ( spfhook->debug > 1 ) - { - switch( pDnsRecord->wType ) - { - case ns_t_a: - - pA_data = &pDnsRecord->Data.A; - - SPF_debugf( "A: %s", - inet_ntop( AF_INET, &pA_data->IpAddress, - ip4_buf, sizeof( ip4_buf ) )); - break; - - case ns_t_aaaa: - - pAAAA_data = &pDnsRecord->Data.AAAA; - - SPF_debugf( "AAAA: %s", - inet_ntop( AF_INET6, &pAAAA_data->Ip6Address, - ip6_buf, sizeof( ip6_buf ) )); - break; - - case ns_t_ns: - - SPF_debugf( "NS: %s", pDnsRecord->Data.NS.pNameHost ); - break; - - case ns_t_cname: - - SPF_debugf( "CNAME: %s", pDnsRecord->Data.CNAME.pNameHost ); - break; - - case ns_t_mx: - - pMX_data = &pDnsRecord->Data.MX; - - SPF_debugf( "MX: %d %s", - pMX_data->wPreference, pMX_data->pNameExchange ); - break; - - case ns_t_txt: - - txt_concat = malloc(txt_data_len + 1); - - if ( txt_concat == NULL ) - SPF_debugf( "TXT: (%d) - no memory for concatination", - txt_data_len ); - else - { - if ( SPF_dns_txt_concat_windns( - txt_concat, - pTXT_data->dwStringCount, - pTXT_data->pStringArray - ) == NULL ) - SPF_debugf( "TXT: (%d) - error in concatination", - txt_data_len ); - else - { - SPF_debugf( "TXT: (%d) \"%s\"", - txt_data_len, txt_concat ); - } - free( txt_concat ); - } - break; - - case ns_t_ptr: - - pPTR_data = &pDnsRecord->Data.PTR; - - SPF_debugf( "PTR: %s", pPTR_data->pNameHost ); - break; - - default: - SPF_debugf( "not parsed: type: %d", pDnsRecord->wType ); - break; - } - } - - if ( - ( pDnsRecord->Flags.S.Section != DNSREC_ANSWER ) && - ( spfhook->debug > 1 ) - ) - { - pDnsRecord = pDnsRecord->pNext; - continue; - } - - - if ( - ( pDnsRecord->wType != spfrr->rr_type ) && - ( pDnsRecord->wType != ns_t_cname ) - ) - { - SPF_debugf( "unexpected rr type: %d expected: %d", - pDnsRecord->wType, rr_type ); - pDnsRecord = pDnsRecord->pNext; - continue; - } - - switch( pDnsRecord->wType ) - { - case ns_t_a: - - pA_data = &pDnsRecord->Data.A; - - if ( SPF_dns_rr_buf_malloc( - spfrr, cnt, sizeof( pA_data->IpAddress ) - ) != SPF_E_SUCCESS ) - return spfrr; - - memmove( &spfrr->rr[cnt]->a, &pA_data->IpAddress, - sizeof( pA_data->IpAddress ) ); - - cnt++; - break; - - case ns_t_aaaa: - - pAAAA_data = &pDnsRecord->Data.AAAA; - - if ( SPF_dns_rr_buf_malloc( - spfrr, cnt, sizeof( pAAAA_data->Ip6Address ) - ) != SPF_E_SUCCESS ) - return spfrr; - - memmove( &spfrr->rr[cnt]->aaaa, &pAAAA_data->Ip6Address, - sizeof( pAAAA_data->Ip6Address ) ); - - cnt++; - break; - - case ns_t_ns: - break; - - case ns_t_cname: - /* FIXME: are CNAMEs always sent with the real RR? */ - break; - - case ns_t_mx: - - pMX_data = &pDnsRecord->Data.MX; - - if ( SPF_dns_rr_buf_malloc( - spfrr, cnt, strlen( pMX_data->pNameExchange ) + 1 - ) != SPF_E_SUCCESS ) - return spfrr; - - strcpy( spfrr->rr[cnt]->mx, pMX_data->pNameExchange ); - - cnt++; - break; - - case ns_t_txt: - - if ( SPF_dns_rr_buf_malloc( - spfrr, cnt, txt_data_len + 1 - ) != SPF_E_SUCCESS ) - return spfrr; - - if ( SPF_dns_txt_concat_windns( - spfrr->rr[cnt]->txt, - pTXT_data->dwStringCount, - pTXT_data->pStringArray - ) == NULL ) - return spfrr; - - cnt++; - break; - - case ns_t_ptr: - - pPTR_data = &pDnsRecord->Data.PTR; - - if ( SPF_dns_rr_buf_malloc( - spfrr, cnt, strlen( pPTR_data->pNameHost ) + 1 - ) != SPF_E_SUCCESS ) - return spfrr; - - strcpy( spfrr->rr[cnt]->ptr, pPTR_data->pNameHost ); - - cnt++; - break; - - default: - break; - } - - spfrr->num_rr = cnt; - - pDnsRecord = pDnsRecord->pNext; - } - - if ( spfrr->num_rr == 0 ) - spfhook->spfrr.herrno = NO_DATA; - - return spfrr; -} - - -SPF_dns_config_t SPF_dns_create_config_windns( SPF_dns_config_t layer_below, int debug ) -{ - SPF_dns_iconfig_t *spfdic; - SPF_dns_windns_config_t *spfhook; - - - spfdic = malloc( sizeof( *spfdic ) ); - if ( spfdic == NULL ) - return NULL; - - spfdic->hook = calloc( 1, sizeof( SPF_dns_windns_config_t ) ); - if ( spfdic->hook == NULL ) - { - free( spfdic ); - return NULL; - } - - spfdic->destroy = SPF_dns_destroy_config_windns; - spfdic->lookup = SPF_dns_lookup_windns; - spfdic->get_spf = NULL; - spfdic->get_exp = NULL; - spfdic->add_cache = NULL; - spfdic->layer_below = layer_below; - spfdic->name = "windns"; - - spfhook = SPF_voidp2spfhook( spfdic->hook ); - - spfhook->debug = debug; - SPF_dns_reset_rr( &spfhook->spfrr ); - spfhook->spfrr.source = SPF_spfdic2dcid( spfdic ); - - return SPF_spfdic2dcid( spfdic ); -} - -void SPF_dns_reset_config_windns( SPF_dns_config_t spfdcid ) -{ - SPF_dns_iconfig_t *spfdic = SPF_dcid2spfdic( spfdcid ); - - - if ( spfdcid == NULL ) - SPF_error( "spfdcid is NULL" ); - - - SPF_dns_reset_rr( &(SPF_voidp2spfhook( spfdic->hook )->spfrr) ); -} - -void SPF_dns_destroy_config_windns( SPF_dns_config_t spfdcid ) -{ - SPF_dns_iconfig_t *spfdic = SPF_dcid2spfdic( spfdcid ); - - if ( spfdcid == NULL ) - SPF_error( "spfdcid is NULL" ); - - if ( spfdic->hook ) - { - SPF_dns_windns_config_t *spfhook = SPF_voidp2spfhook( spfdic->hook ); - - SPF_dns_destroy_rr_var( &spfhook->spfrr ); - - free( spfdic->hook ); - } - - if ( spfdic ) - free( spfdic ); -} - +#include + + +typedef struct +{ + int debug; + SPF_dns_rr_t spfrr; +} SPF_dns_windns_config_t; + + +#define SPF_h_errno WSAGetLastError() + + +static inline SPF_dns_windns_config_t *SPF_voidp2spfhook( void *hook ) + { return (SPF_dns_windns_config_t *)hook; } +static inline void *SPF_spfhook2voidp( SPF_dns_windns_config_t *spfhook ) + { return (void *)spfhook; } + + +LPSTR SPF_dns_create_error_message_windns(DWORD last_error) +{ + LPSTR error_message; + + if (!FormatMessageA( + (FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS), + NULL, + last_error, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language + (LPSTR) &error_message, + 0, + NULL)) + { + return NULL; + } + + return error_message; +} + + +void SPF_dns_destroy_error_message_windns(LPSTR error_message) +{ + LocalFree( error_message ); +} + + +size_t SPF_dns_txt_get_length_windns(DWORD count, PSTR strings[]) +{ + size_t length; + DWORD i; + + length = 0; + + for( i = 0; i < count; i++ ) + { + length = length + strlen(strings[i]); + } + + return length; +} + + +char *SPF_dns_txt_concat_windns(char *buffer, DWORD count, PSTR strings[]) +{ + DWORD i; + + buffer[0] = 0; + + for( i = 0; i < count; i++ ) + { + if ( strcat( buffer, strings[i] ) == NULL ) + return NULL; + } + + return buffer; +} + + +static SPF_dns_rr_t *SPF_dns_lookup_windns( SPF_dns_config_t spfdcid, const char *domain, ns_type rr_type, int should_cache ) +{ + SPF_dns_iconfig_t *spfdic = SPF_dcid2spfdic( spfdcid ); + SPF_dns_windns_config_t *spfhook = SPF_voidp2spfhook( spfdic->hook ); + SPF_dns_rr_t *spfrr; + + int cnt; + + PDNS_RECORDA pDnsRecord; + + DNS_STATUS status; + LPSTR error_message; + + char ip4_buf[ INET_ADDRSTRLEN ]; + char ip6_buf[ INET6_ADDRSTRLEN ]; + + int rdlen; + + DNS_A_DATA *pA_data; + DNS_AAAA_DATA *pAAAA_data; + DNS_MX_DATAA *pMX_data; + DNS_TXT_DATAA *pTXT_data; + DNS_PTR_DATAA *pPTR_data; + + size_t txt_data_len; + char *txt_concat; + + + /* + * initialize stuff + */ + spfrr = &spfhook->spfrr; + SPF_dns_reset_rr( spfrr ); + spfrr->herrno = NO_RECOVERY; + spfrr->rr_type = rr_type; + if ( domain && domain[0] != '\0' ) + { + char *new_domain; + size_t new_len = strlen( domain ) + 1; + + if ( spfrr->domain_buf_len < new_len ) + { + new_domain = realloc( spfrr->domain, new_len ); + if ( new_domain == NULL ) + return spfrr; + + spfrr->domain = new_domain; + spfrr->domain_buf_len = new_len; + } + strcpy( spfrr->domain, domain ); + } + else if ( spfrr->domain ) + spfrr->domain[0] = '\0'; + + cnt = 0; + + if ( spfhook->debug ) + SPF_debugf( "WinDNS looking for: %s %s (%d)", + domain, + ( + (rr_type == ns_t_a) ? "A" : + (rr_type == ns_t_aaaa) ? "AAAA" : + (rr_type == ns_t_mx) ? "MX" : + (rr_type == ns_t_txt) ? "TXT" : + (rr_type == ns_t_ptr) ? "PTR" : + (rr_type == ns_t_any) ? "ANY" : + "??" + ), + rr_type ); + + + /* + * try resolving the name + */ + status = DnsQuery_A( domain, rr_type, + (DNS_QUERY_STANDARD + DNS_QUERY_TREAT_AS_FQDN), + NULL, &pDnsRecord, NULL ); + + if ( status != DNS_RCODE_NOERROR ) + { + if ( spfhook->debug ) + { + error_message = SPF_dns_create_error_message_windns(SPF_h_errno); + + SPF_debugf( "query failed: err = %d %s (%d)", + status, error_message, SPF_h_errno ); + + SPF_dns_destroy_error_message_windns(error_message); + } + + if ( + ( SPF_h_errno == HOST_NOT_FOUND ) && + ( spfdic->layer_below ) + ) + return SPF_dcid2spfdic( spfdic->layer_below )->lookup( spfdic->layer_below, domain, rr_type, should_cache ); + + spfrr->herrno = SPF_h_errno; + return spfrr; + } + else + spfrr->herrno = NETDB_SUCCESS; + + while (pDnsRecord) + { + rdlen = pDnsRecord->wDataLength; + + if ( spfhook->debug > 1 ) + SPF_debugf( "name: %s type: %d ttl: %d rdlen: %d", + pDnsRecord->pName, pDnsRecord->wType, + pDnsRecord->dwTtl, rdlen ); + + if ( rdlen <= 0 ) + { + pDnsRecord = pDnsRecord->pNext; + continue; + } + + /* No sense in doing this twice */ + if (pDnsRecord->wType == ns_t_txt) + { + pTXT_data = &pDnsRecord->Data.TXT; + + txt_data_len = + SPF_dns_txt_get_length_windns( + pTXT_data->dwStringCount, + pTXT_data->pStringArray + ); + } + + if ( spfhook->debug > 1 ) + { + switch( pDnsRecord->wType ) + { + case ns_t_a: + + pA_data = &pDnsRecord->Data.A; + + SPF_debugf( "A: %s", + inet_ntop( AF_INET, &pA_data->IpAddress, + ip4_buf, sizeof( ip4_buf ) )); + break; + + case ns_t_aaaa: + + pAAAA_data = &pDnsRecord->Data.AAAA; + + SPF_debugf( "AAAA: %s", + inet_ntop( AF_INET6, &pAAAA_data->Ip6Address, + ip6_buf, sizeof( ip6_buf ) )); + break; + + case ns_t_ns: + + SPF_debugf( "NS: %s", pDnsRecord->Data.NS.pNameHost ); + break; + + case ns_t_cname: + + SPF_debugf( "CNAME: %s", pDnsRecord->Data.CNAME.pNameHost ); + break; + + case ns_t_mx: + + pMX_data = &pDnsRecord->Data.MX; + + SPF_debugf( "MX: %d %s", + pMX_data->wPreference, pMX_data->pNameExchange ); + break; + + case ns_t_txt: + + txt_concat = malloc(txt_data_len + 1); + + if ( txt_concat == NULL ) + SPF_debugf( "TXT: (%d) - no memory for concatination", + txt_data_len ); + else + { + if ( SPF_dns_txt_concat_windns( + txt_concat, + pTXT_data->dwStringCount, + pTXT_data->pStringArray + ) == NULL ) + SPF_debugf( "TXT: (%d) - error in concatination", + txt_data_len ); + else + { + SPF_debugf( "TXT: (%d) \"%s\"", + txt_data_len, txt_concat ); + } + free( txt_concat ); + } + break; + + case ns_t_ptr: + + pPTR_data = &pDnsRecord->Data.PTR; + + SPF_debugf( "PTR: %s", pPTR_data->pNameHost ); + break; + + default: + SPF_debugf( "not parsed: type: %d", pDnsRecord->wType ); + break; + } + } + + if ( + ( pDnsRecord->Flags.S.Section != DNSREC_ANSWER ) && + ( spfhook->debug > 1 ) + ) + { + pDnsRecord = pDnsRecord->pNext; + continue; + } + + + if ( + ( pDnsRecord->wType != spfrr->rr_type ) && + ( pDnsRecord->wType != ns_t_cname ) + ) + { + SPF_debugf( "unexpected rr type: %d expected: %d", + pDnsRecord->wType, rr_type ); + pDnsRecord = pDnsRecord->pNext; + continue; + } + + switch( pDnsRecord->wType ) + { + case ns_t_a: + + pA_data = &pDnsRecord->Data.A; + + if ( SPF_dns_rr_buf_malloc( + spfrr, cnt, sizeof( pA_data->IpAddress ) + ) != SPF_E_SUCCESS ) + return spfrr; + + memmove( &spfrr->rr[cnt]->a, &pA_data->IpAddress, + sizeof( pA_data->IpAddress ) ); + + cnt++; + break; + + case ns_t_aaaa: + + pAAAA_data = &pDnsRecord->Data.AAAA; + + if ( SPF_dns_rr_buf_malloc( + spfrr, cnt, sizeof( pAAAA_data->Ip6Address ) + ) != SPF_E_SUCCESS ) + return spfrr; + + memmove( &spfrr->rr[cnt]->aaaa, &pAAAA_data->Ip6Address, + sizeof( pAAAA_data->Ip6Address ) ); + + cnt++; + break; + + case ns_t_ns: + break; + + case ns_t_cname: + /* FIXME: are CNAMEs always sent with the real RR? */ + break; + + case ns_t_mx: + + pMX_data = &pDnsRecord->Data.MX; + + if ( SPF_dns_rr_buf_malloc( + spfrr, cnt, strlen( pMX_data->pNameExchange ) + 1 + ) != SPF_E_SUCCESS ) + return spfrr; + + strcpy( spfrr->rr[cnt]->mx, pMX_data->pNameExchange ); + + cnt++; + break; + + case ns_t_txt: + + if ( SPF_dns_rr_buf_malloc( + spfrr, cnt, txt_data_len + 1 + ) != SPF_E_SUCCESS ) + return spfrr; + + if ( SPF_dns_txt_concat_windns( + spfrr->rr[cnt]->txt, + pTXT_data->dwStringCount, + pTXT_data->pStringArray + ) == NULL ) + return spfrr; + + cnt++; + break; + + case ns_t_ptr: + + pPTR_data = &pDnsRecord->Data.PTR; + + if ( SPF_dns_rr_buf_malloc( + spfrr, cnt, strlen( pPTR_data->pNameHost ) + 1 + ) != SPF_E_SUCCESS ) + return spfrr; + + strcpy( spfrr->rr[cnt]->ptr, pPTR_data->pNameHost ); + + cnt++; + break; + + default: + break; + } + + spfrr->num_rr = cnt; + + pDnsRecord = pDnsRecord->pNext; + } + + if ( spfrr->num_rr == 0 ) + spfhook->spfrr.herrno = NO_DATA; + + return spfrr; +} + + +SPF_dns_config_t SPF_dns_create_config_windns( SPF_dns_config_t layer_below, int debug ) +{ + SPF_dns_iconfig_t *spfdic; + SPF_dns_windns_config_t *spfhook; + + + spfdic = malloc( sizeof( *spfdic ) ); + if ( spfdic == NULL ) + return NULL; + + spfdic->hook = calloc( 1, sizeof( SPF_dns_windns_config_t ) ); + if ( spfdic->hook == NULL ) + { + free( spfdic ); + return NULL; + } + + spfdic->destroy = SPF_dns_destroy_config_windns; + spfdic->lookup = SPF_dns_lookup_windns; + spfdic->get_spf = NULL; + spfdic->get_exp = NULL; + spfdic->add_cache = NULL; + spfdic->layer_below = layer_below; + spfdic->name = "windns"; + + spfhook = SPF_voidp2spfhook( spfdic->hook ); + + spfhook->debug = debug; + SPF_dns_reset_rr( &spfhook->spfrr ); + spfhook->spfrr.source = SPF_spfdic2dcid( spfdic ); + + return SPF_spfdic2dcid( spfdic ); +} + +void SPF_dns_reset_config_windns( SPF_dns_config_t spfdcid ) +{ + SPF_dns_iconfig_t *spfdic = SPF_dcid2spfdic( spfdcid ); + + + if ( spfdcid == NULL ) + SPF_error( "spfdcid is NULL" ); + + + SPF_dns_reset_rr( &(SPF_voidp2spfhook( spfdic->hook )->spfrr) ); +} + +void SPF_dns_destroy_config_windns( SPF_dns_config_t spfdcid ) +{ + SPF_dns_iconfig_t *spfdic = SPF_dcid2spfdic( spfdcid ); + + if ( spfdcid == NULL ) + SPF_error( "spfdcid is NULL" ); + + if ( spfdic->hook ) + { + SPF_dns_windns_config_t *spfhook = SPF_voidp2spfhook( spfdic->hook ); + + SPF_dns_destroy_rr_var( &spfhook->spfrr ); + + free( spfdic->hook ); + } + + if ( spfdic ) + free( spfdic ); +} + #endif --- libspf2-1.2.5.orig/src/libreplace/win32_config.h +++ libspf2-1.2.5/src/libreplace/win32_config.h @@ -1,15 +1,15 @@ -#ifdef _WIN32 - -#ifndef WIN32_CONFIG -#define WIN32_CONFIG - - -#define STDC_HEADERS - -#define snprintf _snprintf -#define vsnprintf _vsnprintf - - -#endif - -#endif +#ifdef _WIN32 + +#ifndef WIN32_CONFIG +#define WIN32_CONFIG + + +#define STDC_HEADERS + +#define snprintf _snprintf +#define vsnprintf _vsnprintf + + +#endif + +#endif --- libspf2-1.2.5.orig/src/include/spf_win32.h +++ libspf2-1.2.5/src/include/spf_win32.h @@ -1,61 +1,61 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of either: - * - * a) The GNU Lesser General Public License as published by the Free - * Software Foundation; either version 2.1, or (at your option) any - * later version, - * - * OR - * - * b) The two-clause BSD license. - * - * These licenses can be found with the distribution in the file LICENSES - */ - - - - -#ifdef _WIN32 - -#ifndef INC_SPF_WIN32 -#define INC_SPF_WIN32 - - -#include - -#include +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of either: + * + * a) The GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1, or (at your option) any + * later version, + * + * OR + * + * b) The two-clause BSD license. + * + * These licenses can be found with the distribution in the file LICENSES + */ + + + + +#ifdef _WIN32 + +#ifndef INC_SPF_WIN32 +#define INC_SPF_WIN32 + + +#include + +#include #pragma comment(lib, "ws2_32.lib") -#include -#include - - -/* ********************************************************************* */ - -/* - * SPF startup and cleanup for Win32 - */ - -/* - * These routines basically just startup and cleanup the Winsock layer - * with a version is known to work with this library (version 2.2). - * If Winsock startup and cleanup is already being performed by the - * application, then these calls are not necessary. - * - * Otherwise, startup must be done before any other calls, and cleanup - * should be called when the application is done with the library. - */ -#ifdef _WIN32 -int SPF_win32_startup(); -int SPF_win32_cleanup(); -#endif - - - -#define __attribute__(n) - - - -#endif - -#endif +#include +#include + + +/* ********************************************************************* */ + +/* + * SPF startup and cleanup for Win32 + */ + +/* + * These routines basically just startup and cleanup the Winsock layer + * with a version is known to work with this library (version 2.2). + * If Winsock startup and cleanup is already being performed by the + * application, then these calls are not necessary. + * + * Otherwise, startup must be done before any other calls, and cleanup + * should be called when the application is done with the library. + */ +#ifdef _WIN32 +int SPF_win32_startup(); +int SPF_win32_cleanup(); +#endif + + + +#define __attribute__(n) + + + +#endif + +#endif --- libspf2-1.2.5.orig/src/include/spf_server.h +++ libspf2-1.2.5/src/include/spf_server.h @@ -20,7 +20,6 @@ #include "spf_record.h" #include "spf_dns.h" -#include "spf_dns_internal.h" #ifndef SPF_MAX_DNS_MECH /* It is a bad idea to change this for two reasons. --- libspf2-1.2.5.orig/src/include/spf_dns_windns.h +++ libspf2-1.2.5/src/include/spf_dns_windns.h @@ -1,48 +1,48 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of either: - * - * a) The GNU Lesser General Public License as published by the Free - * Software Foundation; either version 2.1, or (at your option) any - * later version, - * - * OR - * - * b) The two-clause BSD license. - * - * These licenses can be found with the distribution in the file LICENSES - */ - - - - -#ifndef INC_SPF_DNS_WINDNS -#define INC_SPF_DNS_WINDNS - -/* For an overview of the DNS layer system, see spf_dns.h */ - -/* - * The WinDNS layer is an interface to the Windows DNS API. - * - * While multiple WinDNS layers can be created, I can't see much - * use for more than one. - */ - -/* - * These routines take care of creating/destroying/etc. the objects - * that hold the DNS layer configuration. spfdcid objects contain - * malloc'ed data, so they must be destroyed when you are finished - * with them, or you will leak memory. - */ - -/* - * if debugging is enabled, information about the results from - * WinDNS will be displayed. This information is often not passed - * on to (and not needed by) the higher level DNS layers. - */ -SPF_dns_config_t SPF_dns_create_config_windns( SPF_dns_config_t layer_below, int debug ); -void SPF_dns_reset_config_windns( SPF_dns_config_t spfdcid ); -void SPF_dns_destroy_config_windns( SPF_dns_config_t spfdcid ); - - -#endif +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of either: + * + * a) The GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1, or (at your option) any + * later version, + * + * OR + * + * b) The two-clause BSD license. + * + * These licenses can be found with the distribution in the file LICENSES + */ + + + + +#ifndef INC_SPF_DNS_WINDNS +#define INC_SPF_DNS_WINDNS + +/* For an overview of the DNS layer system, see spf_dns.h */ + +/* + * The WinDNS layer is an interface to the Windows DNS API. + * + * While multiple WinDNS layers can be created, I can't see much + * use for more than one. + */ + +/* + * These routines take care of creating/destroying/etc. the objects + * that hold the DNS layer configuration. spfdcid objects contain + * malloc'ed data, so they must be destroyed when you are finished + * with them, or you will leak memory. + */ + +/* + * if debugging is enabled, information about the results from + * WinDNS will be displayed. This information is often not passed + * on to (and not needed by) the higher level DNS layers. + */ +SPF_dns_config_t SPF_dns_create_config_windns( SPF_dns_config_t layer_below, int debug ); +void SPF_dns_reset_config_windns( SPF_dns_config_t spfdcid ); +void SPF_dns_destroy_config_windns( SPF_dns_config_t spfdcid ); + + +#endif