diff src/dnsbl.cpp @ 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 82886d4dd71f
children 495cfe5caead
line wrap: on
line diff
--- 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;
             }
         }