diff src/dnsbl.cpp @ 238:7b818a4e21a4 stable-6-0-25

produce correct uribl message
author Carl Byington <carl@five-ten-sg.com>
date Tue, 29 Sep 2009 12:11:42 -0700
parents c0d2e99c0a1d
children d8ee4c97b9ab
line wrap: on
line diff
--- a/src/dnsbl.cpp	Tue Sep 29 11:48:54 2009 -0700
+++ b/src/dnsbl.cpp	Tue Sep 29 12:11:42 2009 -0700
@@ -476,6 +476,7 @@
     queueid                 = NULL;
     authenticated           = NULL;
     client_name             = NULL;
+    host_uribl              = NULL;
     helo_uribl              = false;
     client_uribl            = false;
     from_uribl              = false;
@@ -520,6 +521,7 @@
     if (queueid)       free((void*)queueid);
     if (authenticated) free((void*)authenticated);
     if (client_name)   free((void*)client_name);
+    discard(hosts_uribl);
     delayer.clear();
     discard(env_to);
     if (memory)   delete memory;
@@ -533,6 +535,7 @@
         queueid                 = NULL;
         authenticated           = NULL;
         client_name             = NULL;
+        host_uribl              = NULL;
         helo_uribl              = false;
         client_uribl            = false;
         from_uribl              = false;
@@ -665,19 +668,16 @@
         content_host_ignore = &con.get_content_host_ignore();
         // if we are using uribl, test helo and client names here
         if (uribl_suffix) {
-            const char *found = NULL;
-            string_set hosts;
             if (helo) {
-                helo_uribl = check_uribl(*this, hosts, helo, found);
-            }
+                helo_uribl = check_uribl(*this, hosts_uribl, helo, host_uribl);
             if (client_name && !helo_uribl) {
-                client_uribl = check_uribl(*this, hosts, client_name, found);
-            }
+                    client_uribl = check_uribl(*this, hosts_uribl, client_name, host_uribl);
             if (mailaddr && !client_uribl) {
                 char *f = strchr(mailaddr, '@');
-                if (f) from_uribl = check_uribl(*this, hosts, f+1, found);
+                        if (f) from_uribl = check_uribl(*this, hosts_uribl, f+1, host_uribl);
             }
-            discard(hosts);
+                }
+            }
         }
     }
 }
@@ -1206,22 +1206,22 @@
             bool uri = false;
             // content filtering implies also checking helo name on uribl (if enabled)
             if (priv.helo_uribl) {
-                snprintf(bu, sizeof(bu), "(helo %s)", priv.helo);
+                snprintf(bu, sizeof(bu), "(helo %s)", priv.host_uribl);
                 uri = true;
             }
             // content filterint implies also checking client reverse dns name on uribl (if enabled)
             if (priv.client_uribl) {
-                snprintf(bu, sizeof(bu), "(rdns %s)", priv.client_name);
+                snprintf(bu, sizeof(bu), "(rdns %s)", priv.host_uribl);
                 uri = true;
             }
             // content filterint implies also checking mail from domain name on uribl (if enabled)
             if (priv.from_uribl) {
-                snprintf(bu, sizeof(bu), "(from %s)", priv.mailaddr);
+                snprintf(bu, sizeof(bu), "(from %s)", priv.host_uribl);
                 uri = true;
             }
             if (uri) {
                 char buf[maxlen];
-                snprintf(buf, sizeof(buf), priv.uribl_message, bu);
+                snprintf(buf, sizeof(buf), priv.uribl_message, bu, priv.host_uribl);
                 smfi_setreply(ctx, (char*)"550", (char*)"5.7.1", buf);
                 return SMFIS_REJECT;
             }