Mercurial > dnsbl
changeset 53:c2371bb6cf84 stable-3-5
3.5 - better error message when rejecting based on ns records on the sbl
author | carl |
---|---|
date | Sat, 17 Jul 2004 11:14:11 -0700 |
parents | a84752107aca |
children | dca56b2de019 |
files | ChangeLog dnsbl.spec.in package.bash src/dnsbl.cpp xml/dnsbl.in |
diffstat | 5 files changed, 48 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Thu Jul 15 23:01:41 2004 -0700 +++ b/ChangeLog Sat Jul 17 11:14:11 2004 -0700 @@ -1,8 +1,14 @@ $Id$ +3.5 2004-07-17 + Extend the error message for content filtering when the NS record + points to an ip address on the SBL. Include the original host name + that referenced that NS name. + + 3.4 2004-07-15 - Tokens with two consecutive periods cannot be ip addresses - or host names. + Tokens with two consecutive periods cannot be ip addresses or host + names. Updated dnsbl.spec file for building rpms from John Gunkel.
--- a/dnsbl.spec.in Thu Jul 15 23:01:41 2004 -0700 +++ b/dnsbl.spec.in Sat Jul 17 11:14:11 2004 -0700 @@ -1,6 +1,6 @@ Summary: DNSBL Sendmail Milter Name: dnsbl -Version: 3.4 +Version: 3.5 Release: 2 Copyright: GPL Group: System Environment/Daemons
--- a/package.bash Thu Jul 15 23:01:41 2004 -0700 +++ b/package.bash Sat Jul 17 11:14:11 2004 -0700 @@ -1,6 +1,6 @@ #!/bin/bash -VER=dnsbl-3.4 +VER=dnsbl-3.5 mkdir $VER target1=/home/httpd/html/510sg/util/dnsbl.tar.gz target2=/home/httpd/html/510sg/dnsbl.conf
--- a/src/dnsbl.cpp Thu Jul 15 23:01:41 2004 -0700 +++ b/src/dnsbl.cpp Sat Jul 17 11:14:11 2004 -0700 @@ -25,6 +25,8 @@ 3) Add option to only allow one recipient if the return path is empty. +4) Check if the envelope from domain name primary MX points 127.0.0.0/8 + */ @@ -118,7 +120,13 @@ typedef set<char *, ltstr> string_set; typedef set<int> int_set; typedef list<char *> string_list; -typedef map<char *, int, ltstr> ns_map; +typedef map<char *, int, ltstr> ns_mapper; + +struct ns_map { + // all the strings are owned by the keys/values in the ns_host string map + string_map ns_host; // nameserver name -> host name that uses this name server + ns_mapper ns_ip; // nameserver name -> ip address of the name server +}; struct CONFIG { // the only mutable stuff once it has been loaded from the config file @@ -192,22 +200,28 @@ // static void discard(ns_map &s); static void discard(ns_map &s) { - for (ns_map::iterator i=s.begin(); i!=s.end(); i++) { + for (string_map::iterator i=s.ns_host.begin(); i!=s.ns_host.end(); i++) { char *x = (*i).first; + char *y = (*i).second; free(x); + free(y); } - s.clear(); + s.ns_ip.clear(); + s.ns_host.clear(); } //////////////////////////////////////////////// // helper to register a string in an ns_map // -static void register_string(ns_map &s, char *name); -static void register_string(ns_map &s, char *name) { - ns_map::iterator i = s.find(name); - if (i != s.end()) return; +static void register_string(ns_map &s, char *name, char *refer); +static void register_string(ns_map &s, char *name, char *refer) { + string_map::iterator i = s.ns_host.find(name); + if (i != s.ns_host.end()) return; char *x = strdup(name); - s[x] = 0; + char *y = strdup(refer); + s.ns_ip[x] = 0; + s.ns_host[x] = y; + } //////////////////////////////////////////////// @@ -469,19 +483,19 @@ } if (n-nam) n--; // remove trailing . *n = '\0'; // null terminate it - register_string(ns, nam); // ns host to lookup later + register_string(ns, nam, question); // ns host to lookup later } } rrnum = 0; while (ns_parserr(&handle, ns_s_ar, rrnum++, &rr) == 0) { if (ns_rr_type(rr) == ns_t_a) { char* nam = (char*)ns_rr_name(rr); - ns_map::iterator i = ns.find(nam); - if (i != ns.end()) { + ns_mapper::iterator i = ns.ns_ip.find(nam); + if (i != ns.ns_ip.end()) { // we want this ip address int address; memcpy(&address, ns_rr_rdata(rr), sizeof(address)); - ns[nam] = address; + ns.ns_ip[nam] = address; } } } @@ -637,7 +651,7 @@ } } lim *= 4; // allow average of 3 ns per host name - for (ns_map::iterator i=nameservers.begin(); i!=nameservers.end(); i++) { + for (ns_mapper::iterator i=nameservers.ns_ip.begin(); i!=nameservers.ns_ip.end(); i++) { count++; if ((count > lim) && (lim > 0)) { if (ran) continue; // don't complain @@ -666,7 +680,16 @@ ips.insert(ip); status st = check_single(ip, dc.content_suffix); if (st == reject) { + string_map::iterator j = nameservers.ns_host.find(host); + if (j != nameservers.ns_host.end()) { + char *refer = (*j).second; + char buf[1000]; + snprintf(buf, sizeof(buf), "%s with nameserver %s", refer, host); + host = register_string(priv.memory->hosts, buf); // put a copy into priv.memory->hosts, and return that reference + } + else { host = register_string(priv.memory->hosts, host); // put a copy into priv.memory->hosts, and return that reference + } discard(nameservers); return st; }
--- a/xml/dnsbl.in Thu Jul 15 23:01:41 2004 -0700 +++ b/xml/dnsbl.in Sat Jul 17 11:14:11 2004 -0700 @@ -2,7 +2,7 @@ <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> -<title>DNSBL Sendmail milter</title> +<title>DNSBL Sendmail milter - Version 3.5</title> </head> <center>Introduction</center>