Mercurial > dnsbl
diff src/dnsbl.cpp @ 74:b7449114ebb0
start coding on new config syntax
author | carl |
---|---|
date | Sun, 10 Jul 2005 14:19:00 -0700 |
parents | 2b369f7db7bf |
children | 1142e46be550 |
line wrap: on
line diff
--- a/src/dnsbl.cpp Sun Jul 10 13:28:33 2005 -0700 +++ b/src/dnsbl.cpp Sun Jul 10 14:19:00 2005 -0700 @@ -119,7 +119,7 @@ }; -void ns_map::~ns_map() { +ns_map::~ns_map() { for (string_map::iterator i=ns_host.begin(); i!=ns_host.end(); i++) { char *x = (*i).first; char *y = (*i).second; @@ -635,10 +635,9 @@ // check the hosts from the body against the content dnsbl // bool check_hosts(mlfiPriv &priv, bool random, int limit, char *&host, int ip); -bool check_hosts(mlfiPriv &priv) { - static buf[2000]; +bool check_hosts(mlfiPriv &priv, bool random, int limit, char *&host, int ip) { CONFIG &dc = *priv.pc; - string_set &hosts = priv.memory->hosts; + string_set &hosts = priv.memory->get_hosts(); string_set &ignore = dc.get_content_host_ignore(); int count = 0; @@ -681,7 +680,7 @@ int_set::iterator i = ips.find(ip); if (i == ips.end()) { ips.insert(ip); - if (check_single(priv, ip, dc.content_suffix)) { + if (check_single(priv, ip, dc.get_content_suffix())) { return true; } } @@ -714,7 +713,7 @@ int_set::iterator i = ips.find(ip); if (i == ips.end()) { ips.insert(ip); - if (check_single(priv, ip, dc.content_suffix)) { + if (check_single(priv, ip, dc.get_content_suffix())) { string_map::iterator j = nameservers.ns_host.find(host); if (j != nameservers.ns_host.end()) { char *refer = (*j).second; @@ -778,7 +777,7 @@ } else { // check the dns based lists - st = check_dnsbl(priv, con.get_dnsbl_list(), rejectlist); + st = (check_dnsbl(priv, con.get_dnsbl_list(), rejectlist)) ? black : oksofar; } if (st == reject) { // reject the recipient based on some dnsbl @@ -833,11 +832,11 @@ char *msg = NULL; string_set alive; bool random = false; - bool limit = 0; - for (context_map::iterator i=env_to.begin(); i!=env_to.end(); i++) { + int limit = 0; + for (context_map::iterator i=priv.env_to.begin(); i!=priv.env_to.end(); i++) { char *rcpt = (*i).first; CONTEXT &con = *((*i).second); - if (!con.acceptable_content(priv.memory, msg)) { + if (!con.acceptable_content(*priv.memory, msg)) { // bad html tags or excessive hosts smfi_delrcpt(ctx, rcpt); } @@ -927,7 +926,7 @@ char buf[200]; snprintf(buf, sizeof(buf), "loading configuration generation %d", newc->generation); my_syslog(buf); - if (load_conf(*newc, "dnsbl.conf") { + if (load_conf(*newc, "dnsbl.conf")) { newc->load_time = time(NULL); return newc; } @@ -952,7 +951,7 @@ time_t then = dc.load_time; struct stat st; bool reload = false; - for (string_list::iterator i=dc.config_files.begin(); i!=dc.config_files.end(); i++) { + for (string_set::iterator i=dc.config_files.begin(); i!=dc.config_files.end(); i++) { char *fn = *i; if (stat(fn, &st)) reload = true; // file disappeared else if (st.st_mtime > then) reload = true; // file modified