comparison src/dnsbl.cpp @ 58:7bb8bbf79285

changes to handle 5iantlavalamp.com
author carl
date Thu, 28 Oct 2004 22:54:34 -0700
parents 419e00901570
children 510a511ad554
comparison
equal deleted inserted replaced
57:419e00901570 58:7bb8bbf79285
607 int lim = priv.pc->host_limit; // we should not look at more than this many hosts 607 int lim = priv.pc->host_limit; // we should not look at more than this many hosts
608 int cnt = priv.memory->hosts.size(); // number of hosts we could look at 608 int cnt = priv.memory->hosts.size(); // number of hosts we could look at
609 int_set ips; // remove duplicate ip addresses 609 int_set ips; // remove duplicate ip addresses
610 for (string_set::iterator i=priv.memory->hosts.begin(); i!=priv.memory->hosts.end(); i++) { 610 for (string_set::iterator i=priv.memory->hosts.begin(); i!=priv.memory->hosts.end(); i++) {
611 host = *i; // a reference into priv.memory->hosts, which will live until this smtp transaction is closed 611 host = *i; // a reference into priv.memory->hosts, which will live until this smtp transaction is closed
612
613 // don't bother looking up hosts on the ignore list
612 string_set::iterator j = priv.pc->content_host_ignore.find(host); 614 string_set::iterator j = priv.pc->content_host_ignore.find(host);
613 if (j == priv.pc->content_host_ignore.end()) { 615 if (j != priv.pc->content_host_ignore.end()) continue;
614 continue; // don't bother looking up this host 616
615 } 617 // try to only look at lim/cnt fraction of the available cnt host names in random mode
616 if ((cnt > lim) && (lim > 0) && ran) { 618 if ((cnt > lim) && (lim > 0) && ran) {
617 // try to only look at lim/cnt fraction of the available cnt host names
618 int r = rand() % cnt; 619 int r = rand() % cnt;
619 if (r >= lim) { 620 if (r >= lim) {
620 char buf[1000]; 621 char buf[1000];
621 snprintf(buf, sizeof(buf), "host %s skipped", host); 622 snprintf(buf, sizeof(buf), "host %s skipped", host);
622 my_syslog(&priv, buf); 623 my_syslog(&priv, buf);