# HG changeset patch # User carl # Date 1142196940 28800 # Node ID 1d9e6c1b887299932868998d67755950fd04ed42 # Parent d9d2f8699621a9a093f075b1dea363ad2ead2f27 uribl patch from Jeff Evans diff -r d9d2f8699621 -r 1d9e6c1b8872 NEWS --- a/NEWS Sun Mar 12 12:38:43 2006 -0800 +++ b/NEWS Sun Mar 12 12:55:40 2006 -0800 @@ -1,6 +1,6 @@ $Id$ -5.13 2006-03-12 add SURBL/URIBL lookups, patch from Jeff Evans +5.13 2006-03-12 patch from Jeff Evans to add SURBL/URIBL lookups 5.12 2006-01-08 use larger resolver buffer to accomodate spammers with many name servers 5.11 2005-12-20 switch to autoconf/automake/docbook 5.10 2005-10-16 fix compile error on FC3 diff -r d9d2f8699621 -r 1d9e6c1b8872 configure.in --- a/configure.in Sun Mar 12 12:38:43 2006 -0800 +++ b/configure.in Sun Mar 12 12:55:40 2006 -0800 @@ -1,7 +1,7 @@ AC_INIT(configure.in) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(dnsbl,5.12) +AM_INIT_AUTOMAKE(dnsbl,5.13) AC_PATH_PROGS(BASH, bash) AC_LANG_CPLUSPLUS diff -r d9d2f8699621 -r 1d9e6c1b8872 install.bash --- a/install.bash Sun Mar 12 12:38:43 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -#!/bin/bash - -##################### -# stop the milter if it is already installed -if [ -f /etc/rc.d/init.d/dnsbl ]; then - /etc/rc.d/init.d/dnsbl stop - rm -f /etc/rc.d/init.d/dnsbl -fi - - -##################### -# build the milter -# add compiler flags - suggested by Nigel Horne -g++ -c $CXXFLAGS -pthread dnsbl.cpp scanner.cpp context.cpp tokenizer.cpp -if [ $? -ne 0 ]; then - echo "compiler errors" - exit -fi -g++ -o dnsbl dnsbl.o scanner.o context.o tokenizer.o /usr/lib/libresolv.a -lmilter -pthread -if [ $? -ne 0 ]; then - echo "linker errors" - exit -fi - - -##################### -# ensure the user is created -/usr/bin/getent passwd dnsbl || /usr/sbin/useradd -r -d /etc/dnsbl -M -c "dnsbl pseudo-user" -s /sbin/nologin dnsbl -# install the milter -DST=/etc/dnsbl -mkdir -p $DST -if [ -f /var/dnsbl/dnsbl.conf ]; then - # move the conf files to the new location - mv /var/dnsbl/*conf $DST - rm /var/dnsbl/dnsbl # remove the old binary - rmdir /var/dnsbl -fi -CONF=$DST/dnsbl.conf -if [ -f $CONF ]; then - grep '^context' $CONF >/dev/null - if [ $? -eq 1 ]; then - # config file exists, but it is for the older version - # preserve it and start over - suf=4.old - for i in dnsbl hosts-ignore html-tags tld; do - j=$DST/$i.conf - if [ -f $j ]; then - mv -f $j $j.$suf - fi - done - fi -fi -if [ ! -f $CONF ]; then - cp dnsbl.conf $DST - cp hosts-ignore.conf $DST - cp html-tags.conf $DST - cp tld.conf $DST -fi -if [ ! -f $DST/hosts-ignore.conf ]; then - cp hosts-ignore.conf $DST -fi -if [ ! -f $DST/html-tags.conf ]; then - cp html-tags.conf $DST -fi -rm -f $DST/tld.conf # new tld list -if [ ! -f $DST/tld.conf ]; then - cp tld.conf $DST -fi - -# make the directory for the socket -mkdir -p /var/run/dnsbl -chown dnsbl:dnsbl /var/run/dnsbl -chmod 700 /var/run/dnsbl - -# install the binaries -mv -f dnsbl /usr/sbin/dnsbl -cp dnsbl.rc /etc/rc.d/init.d/dnsbl -chmod 755 /etc/rc.d/init.d/dnsbl -/sbin/chkconfig --add dnsbl -/sbin/chkconfig --level 2345 dnsbl on -/etc/rc.d/init.d/dnsbl start diff -r d9d2f8699621 -r 1d9e6c1b8872 new.bash --- a/new.bash Sun Mar 12 12:38:43 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ -#!/bin/bash - -############################ -## compile and run the new parser program -## -rm -f dnsbl.o scanner.o context.o tokenizer.o -g++ -c -pthread dnsbl.cpp scanner.cpp context.cpp tokenizer.cpp -if [ $? -ne 0 ]; then - echo "compiler errors" - exit -fi -g++ -o dnsbl dnsbl.o scanner.o context.o tokenizer.o /usr/lib/libresolv.a -lmilter -pthread -if [ $? -ne 0 ]; then - echo "linker errors" - exit -fi diff -r d9d2f8699621 -r 1d9e6c1b8872 src/dnsbl.cpp --- a/src/dnsbl.cpp Sun Mar 12 12:38:43 2006 -0800 +++ b/src/dnsbl.cpp Sun Mar 12 12:55:40 2006 -0800 @@ -698,9 +698,9 @@ bool check_uribl(mlfiPriv &priv, char *hostname) { in_addr ip; if (inet_aton(hostname, &ip)) { + const u_char *src = (const u_char *)&ip.s_addr; char adr[sizeof "255.255.255.255"]; - adr[0] = '\0'; - inet_ntop(AF_INET, (const u_char *)&ip, adr, sizeof(adr)); + snprintf(adr, sizeof(adr), "%u.%u.%u.%u", src[3], src[2], src[1], src[0]); return (uriblookup(priv, adr, NULL)); } diff -r d9d2f8699621 -r 1d9e6c1b8872 test.bash --- a/test.bash Sun Mar 12 12:38:43 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -#!/bin/bash - -############################ -## compile and run the test program -## -#g++ -c test.cpp -#if [ $? -ne 0 ]; then -# echo "compiler errors" -# exit -#fi -#g++ -o test test.o -pthread -#if [ $? -ne 0 ]; then -# echo "linker errors" -# exit -#fi - - -########################### -# compile the milter -# - -if [ "$1" == "build" ]; then - rm -f dnsbl.o scanner.o context.o tokenizer.o - g++ -c -pthread dnsbl.cpp scanner.cpp context.cpp tokenizer.cpp - if [ $? -ne 0 ]; then - echo "compiler errors" - exit - fi - g++ -o dnsbl dnsbl.o scanner.o context.o tokenizer.o /usr/lib/libresolv.a -lmilter -pthread - if [ $? -ne 0 ]; then - echo "linker errors" - exit - fi -fi - -if [ "$1" == "test" ]; then - # build the test.cf file - make -f Makefile.test test.cf - - # start the milter - pid=/var/run/dnsbl.pid - echo start the milter - mkdir -p /var/run/dnsbl - chmod 700 /var/run/dnsbl - chown dnsbl:dnsbl /var/run/dnsbl - mv -f $pid $pid.save - ./dnsbl -d 10 -r /var/run/dnsbl/dnsbl.resolver.sock2 -p local:/var/run/dnsbl/dnsbl.sock2 - sleep 5 - P2=`cat $pid` - mv -f $pid.save $pid - echo started dnsbl milter as process $P2 - - /usr/lib/sendmail -bd -Ctest.cf -Ldnsbl - sleep 5 - P3=`head -1 /var/run/sm-test.pid` - echo started sendmail as process $P3 - - echo eventually "'"kill -KILL $P2 $P3"'" - -fi