# HG changeset patch # User Carl Byington # Date 1341162810 25200 # Node ID d11b529ce9c56d743dedaf6bbf621ecf4c182088 # Parent 818cabace58f0c7aafdaaa471a350255f58fe9e1 Fix uribl lookups on client dns name, need to strip the ip address in brackets diff -r 818cabace58f -r d11b529ce9c5 ChangeLog --- a/ChangeLog Mon Apr 09 18:13:58 2012 -0700 +++ b/ChangeLog Sun Jul 01 10:13:30 2012 -0700 @@ -1,3 +1,7 @@ +6.31 2012-07-01 + Fix uribl lookups on client dns name, need to strip the ip + address in brackets. + 6.30 2012-04-09 Allow dnswl_list and dnsbl_list to be empty, to override lists specified in the ancestor contexts. diff -r 818cabace58f -r d11b529ce9c5 NEWS --- a/NEWS Mon Apr 09 18:13:58 2012 -0700 +++ b/NEWS Sun Jul 01 10:13:30 2012 -0700 @@ -1,3 +1,4 @@ +6.31 2012-07-01 Fix uribl lookups on client dns name. 6.30 2012-04-09 Allow dnswl_list and dnsbl_list to be empty; add daily recipient limits. 6.29 2012-04-08 Add dnswl support. 6.28 2011-09-30 Add prvs decoding to envelope addresses. diff -r 818cabace58f -r d11b529ce9c5 configure.in --- a/configure.in Mon Apr 09 18:13:58 2012 -0700 +++ b/configure.in Sun Jul 01 10:13:30 2012 -0700 @@ -1,6 +1,6 @@ AC_PREREQ(2.59) -AC_INIT(dnsbl,6.30,carl@five-ten-sg.com) +AC_INIT(dnsbl,6.31,carl@five-ten-sg.com) AC_CONFIG_SRCDIR([config.h.in]) AC_CONFIG_HEADER([config.h]) diff -r 818cabace58f -r d11b529ce9c5 dnsbl.spec.in --- a/dnsbl.spec.in Mon Apr 09 18:13:58 2012 -0700 +++ b/dnsbl.spec.in Sun Jul 01 10:13:30 2012 -0700 @@ -103,6 +103,10 @@ %changelog +* Sun Jul 01 2012 Carl Byington - 6.31-1 +- Fix uribl lookups on client dns name, need to strip the ip + address in brackets. + * Mon Apr 09 2012 Carl Byington - 6.30-1 - Allow dnswl_list and dnsbl_list to be empty, to override lists specified in the ancestor contexts. diff -r 818cabace58f -r d11b529ce9c5 src/dnsbl.cpp --- a/src/dnsbl.cpp Mon Apr 09 18:13:58 2012 -0700 +++ b/src/dnsbl.cpp Sun Jul 01 10:13:30 2012 -0700 @@ -487,6 +487,7 @@ queueid = NULL; authenticated = NULL; client_name = NULL; + client_dns_name = NULL; host_uribl = NULL; helo_uribl = false; client_uribl = false; @@ -532,6 +533,7 @@ if (queueid) free((void*)queueid); if (authenticated) free((void*)authenticated); if (client_name) free((void*)client_name); + if (client_dns_name) free((void*)client_dns_name); discard(hosts_uribl); delayer.clear(); discard(env_to); @@ -546,6 +548,7 @@ queueid = NULL; authenticated = NULL; client_name = NULL; + client_dns_name = NULL; host_uribl = NULL; helo_uribl = false; client_uribl = false; @@ -681,8 +684,10 @@ if (uribl_suffix) { if (helo) { helo_uribl = check_uribl(*this, hosts_uribl, helo, host_uribl); - if (client_name && !helo_uribl) { - client_uribl = check_uribl(*this, hosts_uribl, client_name, host_uribl); + } + if (client_dns_name && !helo_uribl) { + client_uribl = check_uribl(*this, hosts_uribl, client_dns_name, host_uribl); + } if (mailaddr && !client_uribl) { const char *f = strchr(mailaddr, '@'); if (f) from_uribl = check_uribl(*this, hosts_uribl, f+1, host_uribl); @@ -690,8 +695,6 @@ } } } - } -} mlfiPriv* fetch_priv_from_ctx(SMFICTX *ctx); @@ -1133,7 +1136,18 @@ priv.client_name = smfi_getsymval(ctx, (char*)"_"); if (!priv.helo) priv.helo = strdup("unknown"); if (priv.authenticated) priv.authenticated = strdup(priv.authenticated); - if (priv.client_name) priv.client_name = strdup(priv.client_name); + if (priv.client_name) { + priv.client_name = strdup(priv.client_name); + const char *p = strstr(priv.client_name, " ["); + if (p) { + uint pp = p - priv.client_name; + priv.client_dns_name = strdup(priv.client_name); + priv.client_dns_name[pp] = '\0'; + char text[500]; + snprintf(text, sizeof(text), "found simple dns client name %s", priv.client_dns_name); + my_syslog(text); + } + } if (spamc != spamc_empty) { priv.assassin = new SpamAssassin(&priv, priv.ip, priv.helo, priv.mailaddr, priv.queueid); } diff -r 818cabace58f -r d11b529ce9c5 src/dnsbl.h --- a/src/dnsbl.h Mon Apr 09 18:13:58 2012 -0700 +++ b/src/dnsbl.h Sun Jul 01 10:13:30 2012 -0700 @@ -40,7 +40,8 @@ const char *mailaddr; // envelope from value const char *queueid; // sendmail queue id const char *authenticated; // client authenticated? if so, suppress all dnsbl checks, but check rate limits - const char *client_name; // fully qualified host name of the smtp client + const char *client_name; // fully qualified host name of the smtp client xxx [ip.ad.dr.es] (may be forged) + char *client_dns_name; // fully qualified host name of the smtp client xxx const char *host_uribl; // pointer to helo/client/from host name if found on uribl string_set hosts_uribl; // string set to hold the helo/client/from host name if found on uribl bool helo_uribl; // helo value on uribl