changeset 156:a220bfb9211f

add auto whitelisting
author carl
date Sun, 08 Jul 2007 09:46:55 -0700
parents a76a6af7ed8b
children dcfa43a59ec8
files src/context.cpp src/context.h src/dnsbl.cpp xml/dnsbl.in
diffstat 4 files changed, 22 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/context.cpp	Sat Jul 07 21:39:45 2007 -0700
+++ b/src/context.cpp	Sun Jul 08 09:46:55 2007 -0700
@@ -472,6 +472,7 @@
 				}
 			}
 			ofs.close();
+			need = false;
 		}
 	pthread_mutex_unlock(&mutex);
 }
@@ -512,7 +513,10 @@
 			rc = new WHITELISTER(fn, days);
 			whitelisters[fn] = rc;
 		}
-		else rc = (*i).second;
+		else {
+			rc = (*i).second;
+			rc->set_days(days);
+		}
 	pthread_mutex_unlock(&whitelister_mutex);
 	return rc;
 }
--- a/src/context.h	Sat Jul 07 21:39:45 2007 -0700
+++ b/src/context.h	Sun Jul 08 09:46:55 2007 -0700
@@ -103,6 +103,7 @@
 	void	sent(char *to);
 	bool	is_white(char *from);	// should we white list this sender (did we send them anything recently)
 	int 	get_days() {return days;};
+	void	set_days(int d) {days = d;};
 };
 
 struct DNSBL {
--- a/src/dnsbl.cpp	Sat Jul 07 21:39:45 2007 -0700
+++ b/src/dnsbl.cpp	Sun Jul 08 09:46:55 2007 -0700
@@ -962,7 +962,7 @@
 	if (debug_syslog > 1) {
 		char buf[maxlen];
 		char msg[maxlen];
-		snprintf(msg, sizeof(msg), "from <%s> to <%s> using context %s out %s reply %s", priv.mailaddr, loto, con.get_full_name(buf,maxlen), fromvalue, replyvalue);
+		snprintf(msg, sizeof(msg), "from <%s> to <%s> using context %s state %s reply state %s", priv.mailaddr, loto, con.get_full_name(buf,maxlen), fromvalue, replyvalue);
 		my_syslog(&priv, msg);
 	}
 	free(loto);
@@ -1026,6 +1026,12 @@
 	WHITELISTERP w = con2.find_autowhite(priv.mailaddr);
 	if (w) {
 		char *loto = to_lower_string(rcptaddr);
+		if (debug_syslog > 1) {
+			char buf[maxlen];
+			char msg[maxlen];
+			snprintf(msg, sizeof(msg), "whitelist reply from <%s> in context %s", loto, con.get_full_name(buf,maxlen));
+			my_syslog(&priv, msg);
+		}
 		w->sent(loto);	// don't free it, the whitelister takes ownership of the string
 	}
 	// accept the recipient
--- a/xml/dnsbl.in	Sat Jul 07 21:39:45 2007 -0700
+++ b/xml/dnsbl.in	Sun Jul 08 09:46:55 2007 -0700
@@ -176,6 +176,14 @@
                 allowed to relay thru this mail server with no spam filtering.
             </para>
             <para>
+                Consider the case of a message from A to B passing thru this milter.
+                If that message is not blocked, then we might eventually see a reply
+                message from B to A. If the filtering context for A includes an
+                autowhite entry, then this milter will add an entry in that file to
+                whitelist such replies.  Note that manually editing such autowhite files
+                is not supported.
+            </para>
+            <para>
                 The DNSBL milter reads a text configuration file (dnsbl.conf) on
                 startup, and whenever the config file (or any of the referenced include
                 files) is changed.  The entire configuration file is case insensitive.