diff src/dnsbl.cpp @ 57:419e00901570

changes to handle 5iantlavalamp.com
author carl
date Thu, 28 Oct 2004 22:48:52 -0700
parents 44babba1a9b9
children 7bb8bbf79285
line wrap: on
line diff
--- a/src/dnsbl.cpp	Wed Sep 08 14:46:45 2004 -0700
+++ b/src/dnsbl.cpp	Thu Oct 28 22:48:52 2004 -0700
@@ -142,6 +142,7 @@
     string_map  env_to_chkfrom;     // map recipient to a named from map
     char *      content_suffix;     // for sbl url body filtering
     char *      content_message;    // ""
+    string_set  content_host_ignore;// hosts to ignore for content sbl checking
     char *      host_limit_message; // error message for excessive host names
     int         host_limit;         // limit on host names
     bool        host_random;        // pick a random selection of host names rather than error for excessive hosts
@@ -608,6 +609,10 @@
     int_set ips;    // remove duplicate ip addresses
     for (string_set::iterator i=priv.memory->hosts.begin(); i!=priv.memory->hosts.end(); i++) {
         host = *i;  // a reference into priv.memory->hosts, which will live until this smtp transaction is closed
+        string_set::iterator j = priv.pc->content_host_ignore.find(host);
+        if (j == priv.pc->content_host_ignore.end()) {
+            continue;   // don't bother looking up this host
+        }
         if ((cnt > lim) && (lim > 0) && ran) {
             // try to only look at lim/cnt fraction of the available cnt host names
             int r = rand() % cnt;
@@ -930,6 +935,9 @@
     if (dc.content_suffix) {
         fprintf(stdout, "\ncontent filtering enabled with %s %s\n", dc.content_suffix, dc.content_message);
     }
+    for (string_set::iterator i=dc.content_host_ignore.begin(); i!=dc.content_host_ignore.end(); i++) {
+        fprintf(stdout, "ignore %s\n", (*i));
+    }
     if (dc.host_limit && !dc.host_random) {
         fprintf(stdout, "\ncontent filtering for host names hard limit %d %s\n", dc.host_limit, dc.host_limit_message);
     }
@@ -1048,9 +1056,10 @@
     }
     dc.config_files.push_back(fn);
     map<char*, int, ltstr> commands;
-    enum {dummy, tld, content, hostlimit, hostslimit, htmllimit, htmltag, dnsbl, dnsbll, envfrom, envto, include, includedcc};
+    enum {dummy, tld, content, ignore, hostlimit, hostslimit, htmllimit, htmltag, dnsbl, dnsbll, envfrom, envto, include, includedcc};
     commands["tld"            ] = tld;
     commands["content"        ] = content;
+    commands["ignore"         ] = ignore;
     commands["host_limit"     ] = hostlimit;
     commands["host_soft_limit"] = hostslimit;
     commands["html_limit"     ] = htmllimit;
@@ -1101,6 +1110,13 @@
                     processed = true;
                     } break;
 
+                case ignore: {
+                    char *host = next_token(delim);
+                    if (!host) break;
+                    dc.content_host_ignore.insert(host);
+                    processed = true;
+                    } break;
+
                 case hostlimit: {
                     char *limit = strtok(NULL, delim);
                     if (!limit) break;                          // no integer limit