comparison 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
comparison
equal deleted inserted replaced
85:7e4a90e5f213 86:c1280cd3e248
50 suffix = s; 50 suffix = s;
51 message = m; 51 message = m;
52 } 52 }
53 53
54 54
55 bool DNSBL::operator==(const DNSBL &rhs) {
56 return (strcmp(name, rhs.name) == 0) &&
57 (strcmp(suffix, rhs.suffix) == 0) &&
58 (strcmp(message, rhs.message) == 0);
59 }
60
61
55 CONFIG::CONFIG() { 62 CONFIG::CONFIG() {
56 reference_count = 0; 63 reference_count = 0;
57 generation = 0; 64 generation = 0;
58 load_time = 0; 65 load_time = 0;
59 default_context = NULL; 66 default_context = NULL;
94 my_syslog(buf); 101 my_syslog(buf);
95 } 102 }
96 return; // don't take over user@ entries from your ancestors children 103 return; // don't take over user@ entries from your ancestors children
97 } 104 }
98 if ((c != con) && (c != con->get_parent())) { 105 if ((c != con) && (c != con->get_parent())) {
99 char oldname[maxlen]; 106 if (debug_syslog) {
100 char newname[maxlen]; 107 char oldname[maxlen];
101 char *oldn = c->get_full_name(oldname, maxlen); 108 char newname[maxlen];
102 char *newn = con->get_full_name(newname, maxlen); 109 char *oldn = c->get_full_name(oldname, maxlen);
103 char buf[maxlen*3]; 110 char *newn = con->get_full_name(newname, maxlen);
104 snprintf(buf, maxlen*3, "both %s and %s claim envelope to %s, the second one wins", oldn, newn, to); 111 char buf[maxlen*3];
105 my_syslog(buf); 112 snprintf(buf, maxlen*3, "both %s and %s claim envelope to %s, the second one wins", oldn, newn, to);
113 my_syslog(buf);
114 }
106 } 115 }
107 } 116 }
108 env_to[to] = con; 117 env_to[to] = con;
109 } 118 }
110 119
455 bool parse_dnsbl(TOKEN &tok, CONFIG &dc, CONTEXT &me) { 464 bool parse_dnsbl(TOKEN &tok, CONFIG &dc, CONTEXT &me) {
456 char *name = tok.next(); 465 char *name = tok.next();
457 char *suf = tok.next(); 466 char *suf = tok.next();
458 char *msg = tok.next(); 467 char *msg = tok.next();
459 if (!tsa(tok, token_semi)) return false; 468 if (!tsa(tok, token_semi)) return false;
460 DNSBLP dns = new DNSBL(name, suf, msg); 469 DNSBLP dnsnew = new DNSBL(name, suf, msg);
461 me.add_dnsbl(name, dns); 470 DNSBLP dnsold = me.find_dnsbl(name);
471 if (dnsold && (*dnsold == *dnsnew)) {
472 // duplicate redefinition, ignore it
473 delete dnsnew;
474 return true;
475 }
476 me.add_dnsbl(name, dnsnew);
462 return true; 477 return true;
463 } 478 }
464 479
465 480
466 //////////////////////////////////////////////// 481 ////////////////////////////////////////////////