# HG changeset patch
# User carl
# Date 1183913215 25200
# Node ID a220bfb9211f29645e74ceebdf243f154bc3ca72
# Parent a76a6af7ed8b0373c702523e87c1c8f320474e39
add auto whitelisting
diff -r a76a6af7ed8b -r a220bfb9211f src/context.cpp
--- 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;
}
diff -r a76a6af7ed8b -r a220bfb9211f src/context.h
--- 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 {
diff -r a76a6af7ed8b -r a220bfb9211f src/dnsbl.cpp
--- 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
diff -r a76a6af7ed8b -r a220bfb9211f xml/dnsbl.in
--- 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.
+ 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.
+
+
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.