diff src/context.cpp @ 86:c1280cd3e248

add multiple debug syslog levels, remove duplicate dnsbl definitions
author carl
date Tue, 19 Jul 2005 22:47:15 -0700
parents fa47e1e401f1
children 7245c45cef7a
line wrap: on
line diff
--- a/src/context.cpp	Sun Jul 17 08:56:33 2005 -0700
+++ b/src/context.cpp	Tue Jul 19 22:47:15 2005 -0700
@@ -52,6 +52,13 @@
 }
 
 
+bool DNSBL::operator==(const DNSBL &rhs) {
+    return (strcmp(name,    rhs.name)    == 0) &&
+           (strcmp(suffix,  rhs.suffix)  == 0) &&
+           (strcmp(message, rhs.message) == 0);
+}
+
+
 CONFIG::CONFIG() {
     reference_count    = 0;
     generation         = 0;
@@ -96,6 +103,7 @@
             return;     // don't take over user@ entries from your ancestors children
         }
         if ((c != con) && (c != con->get_parent())) {
+            if (debug_syslog) {
             char oldname[maxlen];
             char newname[maxlen];
             char *oldn = c->get_full_name(oldname, maxlen);
@@ -105,6 +113,7 @@
             my_syslog(buf);
         }
     }
+    }
     env_to[to] = con;
 }
 
@@ -457,8 +466,14 @@
     char *suf = tok.next();
     char *msg = tok.next();
     if (!tsa(tok, token_semi)) return false;
-    DNSBLP dns = new DNSBL(name, suf, msg);
-    me.add_dnsbl(name, dns);
+    DNSBLP dnsnew = new DNSBL(name, suf, msg);
+    DNSBLP dnsold = me.find_dnsbl(name);
+    if (dnsold && (*dnsold == *dnsnew)) {
+        // duplicate redefinition, ignore it
+        delete dnsnew;
+        return true;
+    }
+    me.add_dnsbl(name, dnsnew);
     return true;
 }