changeset 216:784030ac71f1

Never whitelist self addressed mail. Changes for Fedora 10 and const correctness.
author Carl Byington <carl@five-ten-sg.com>
date Sat, 27 Dec 2008 22:40:12 -0800
parents faac35ae3ccc
children 500aa5a32811
files ChangeLog Makefile.am NEWS configure.in dnsbl.conf dnsbl.spec.in src/dnsbl.cpp src/scanner.cpp xml/dnsbl.in
diffstat 9 files changed, 1444 insertions(+), 1431 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Jun 10 10:52:39 2008 -0700
+++ b/ChangeLog	Sat Dec 27 22:40:12 2008 -0800
@@ -1,3 +1,8 @@
+6.20 2008-12-27
+    Never whitelist self addressed mail. Spammers are once again
+    sending mail from A to A trying to get around filters. Changes
+    for Fedora 10 and const correctness.
+
 6.19 2008-06-10
     Fixes to compile on Fedora 9 and for const correctness.
 
--- a/Makefile.am	Tue Jun 10 10:52:39 2008 -0700
+++ b/Makefile.am	Sat Dec 27 22:40:12 2008 -0800
@@ -7,7 +7,7 @@
 htmldir = ${datadir}/doc/@PACKAGE@-@VERSION@
 html_DATA = AUTHORS COPYING ChangeLog NEWS README
 CLEANFILES = dnsbl xml/dnsbl xml/Makefile
-EXTRA_DIST = $(hack_DATA) dnsbl.spec $(wildcard xml/h*) $(wildcard xml/M*) $(wildcard xml/d*)
+EXTRA_DIST = $(hack_DATA) dnsbl.spec xml/header.sgml xml/header.xml xml/Makefile.am xml/Makefile.in xml/dnsbl.in
 
 dnsbl: dnsbl.rc
 	   cat dnsbl.rc                         | \
--- a/NEWS	Tue Jun 10 10:52:39 2008 -0700
+++ b/NEWS	Sat Dec 27 22:40:12 2008 -0800
@@ -1,3 +1,4 @@
+6.20 2008-12-27 Never whitelist self addressed mail.
 6.19 2008-06-10 Fixes to compile on Fedora 9 and for const correctness.
 6.18 2008-03-22 Extend auto-whitelisting even if specified in a parent context.
 6.17 2008-03-04 Verify all from/to pairs, fix dcc bulk thresholds of many.
--- a/configure.in	Tue Jun 10 10:52:39 2008 -0700
+++ b/configure.in	Sat Dec 27 22:40:12 2008 -0800
@@ -1,6 +1,6 @@
 
 AC_PREREQ(2.59)
-AC_INIT(dnsbl,6.19,carl@five-ten-sg.com)
+AC_INIT(dnsbl,6.20,carl@five-ten-sg.com)
 AC_CONFIG_SRCDIR([config.h.in])
 AC_CONFIG_HEADER([config.h])
 
--- a/dnsbl.conf	Tue Jun 10 10:52:39 2008 -0700
+++ b/dnsbl.conf	Sat Dec 27 22:40:12 2008 -0800
@@ -58,7 +58,7 @@
         dcc_bulk_threshold  20;
     };
 
-    generic "(^|[.-])(ppp|h|host)?([0-9]{1,3}[.-](Red-|dynamic[.-])?){4}"
+    generic "^dsl.static.*ttnet.net.tr$|(^|[x.-])(ppp|h|host)?([0-9]{1,3}[x.-](Red-|dynamic[x.-])?){4}"
             "your mail server %s seems to have a generic name";
 
     env_to {
--- a/dnsbl.spec.in	Tue Jun 10 10:52:39 2008 -0700
+++ b/dnsbl.spec.in	Sat Dec 27 22:40:12 2008 -0800
@@ -95,8 +95,12 @@
 
 
 %changelog
+* Sat Dec 27 2008 Carl Byington <carl@five-ten-sg.com> - 6.20-1
+- Never whitelist self addressed mail.
+- Fixes to compile on Fedora 10 and for const correctness.
+
 * Tue Jun 10 2008 Carl Byington <carl@five-ten-sg.com> - 6.19-1
-- Fixes to compile on Fedora 9 and for const correctness
+- Fixes to compile on Fedora 9 and for const correctness.
 
 * Wed Mar 05 2008 Carl Byington <carl@five-ten-sg.com> - 6.18-1
 - Extend auto-whitelisting when receiving mail even if the auto
--- a/src/dnsbl.cpp	Tue Jun 10 10:52:39 2008 -0700
+++ b/src/dnsbl.cpp	Sat Dec 27 22:40:12 2008 -0800
@@ -1027,6 +1027,7 @@
     CONFIG &dc = *priv.pc;
     const char  *rcptaddr  = rcpt[0];
     const char  *loto      = to_lower_string(rcptaddr);
+    bool self = (strcmp(loto, priv.mailaddr) == 0);
 
     // some version of sendmail allowed rcpt to:<> and passed it thru to the milters
     if (strcmp(loto, "<>") == 0) {
@@ -1072,7 +1073,7 @@
     else if (fromvalue == token_black) {
         st = black;
     }
-    else if (fromvalue == token_white) {
+    else if ((fromvalue == token_white) && !self) {
         st = white;
     }
     else {
@@ -1580,6 +1581,8 @@
                 fprintf(stdout, "envelope from <%s> finds context %s\n", from, fc->get_full_name(buf,maxlen));
                 const char *st = fc->find_from(from);
                 fprintf(stdout, "envelope from <%s> finds status %s\n", from, st);
+                bool self = (strcmp(from, to) == 0);
+                if ((st == token_white) && self) fprintf(stdout, "ignore self whitelisting\n");
                 delete conf;
             }
         }
--- a/src/scanner.cpp	Tue Jun 10 10:52:39 2008 -0700
+++ b/src/scanner.cpp	Sat Dec 27 22:40:12 2008 -0800
@@ -79,7 +79,7 @@
 			uu_cr
 		   };
 
-static char* state_names[] = {"h_init",
+static const char* state_names[] = {"h_init",
 							  "h_host",
 							  "t_init",
 							  "t_tag1",
@@ -126,7 +126,7 @@
 
 #define PENDING_LIMIT 100
 class fsa {
-	char		*myname;
+    const char  *myname;
 	u_char		pending[PENDING_LIMIT];
 	int 		count;
 	state		st;
@@ -136,7 +136,7 @@
 	recorder	*memory;
 
 public:
-	fsa(char *myname_, state init, fsa *next1_, fsa *next2_, recorder *memory_);
+    fsa(const char *myname_, state init, fsa *next1_, fsa *next2_, recorder *memory_);
 	void push(u_char *buf, int len);
 	void pusher();
 	void validhost();
@@ -1225,7 +1225,7 @@
 ////////////////////////////////////////////////
 //
 //
-fsa::fsa(char *myname_, state init_, fsa *next1_, fsa *next2_, recorder *memory_) {
+fsa::fsa(const char *myname_, state init_, fsa *next1_, fsa *next2_, recorder *memory_) {
 	myname = myname_;
 	count  = 0;
 	st	   = init_;
@@ -1290,8 +1290,8 @@
 		u_char c = buf[i];
 		pending[count++] = c;
 		if (debug_syslog > 10) {
-			char *old1 = state_names[st];
-			char *new1 = state_names[parse_table[c][st]];
+            const char *old1 = state_names[st];
+            const char *new1 = state_names[parse_table[c][st]];
 			char msg[200];
 			snprintf(msg, sizeof(msg), "%s at (%d,%c) switches from %s to %s", myname, i, c, old1, new1);
 			memory->syslog(msg);
--- a/xml/dnsbl.in	Tue Jun 10 10:52:39 2008 -0700
+++ b/xml/dnsbl.in	Sat Dec 27 22:40:12 2008 -0800
@@ -738,7 +738,7 @@
         dcc_bulk_threshold  20;
     };
 
-    generic "(^|[.-])(ppp|h|host)?([0-9]{1,3}[.-](Red-|dynamic[.-])?){4}"
+    generic "^dsl.static.*ttnet.net.tr$|(^|[x.-])(ppp|h|host)?([0-9]{1,3}[x.-](Red-|dynamic[x.-])?){4}"
             "your mail server %s seems to have a generic name";
 
     env_to {