# HG changeset patch # User Carl Byington # Date 1290200467 28800 # Node ID d8ee4c97b9abfeb9f820890977c3dfd60a7fe660 # Parent 315c53fbbb77566c9341346fd92f6d5cb99883cb 64 bit fixes for libresolv.a diff -r 315c53fbbb77 -r d8ee4c97b9ab ChangeLog --- a/ChangeLog Fri Nov 19 10:34:33 2010 -0800 +++ b/ChangeLog Fri Nov 19 13:01:07 2010 -0800 @@ -1,3 +1,6 @@ +6.26 2009-11-19 + 64 bit fixes for libresolv.a + 6.25 2009-09-29 Add surbl checks on the smtp helo value, client reverse dns name, and mail from domain name. diff -r 315c53fbbb77 -r d8ee4c97b9ab NEWS --- a/NEWS Fri Nov 19 10:34:33 2010 -0800 +++ b/NEWS Fri Nov 19 13:01:07 2010 -0800 @@ -1,3 +1,4 @@ +6.26 2009-11-19 64 bit fixes for libresolv.a 6.25 2009-09-29 Add surbl checks on the smtp helo value, client reverse dns name, and mail from domain name. 6.24 2009-06-09 Add SRS decoding to envelope addresses. 6.23 2009-05-25 Add whitelisting by regex expression filtering. diff -r 315c53fbbb77 -r d8ee4c97b9ab configure.in --- a/configure.in Fri Nov 19 10:34:33 2010 -0800 +++ b/configure.in Fri Nov 19 13:01:07 2010 -0800 @@ -1,6 +1,6 @@ AC_PREREQ(2.59) -AC_INIT(dnsbl,6.25,carl@five-ten-sg.com) +AC_INIT(dnsbl,6.26,carl@five-ten-sg.com) AC_CONFIG_SRCDIR([config.h.in]) AC_CONFIG_HEADER([config.h]) @@ -52,6 +52,22 @@ # check for posix threads ACX_PTHREAD +# find proper libresolv.a location +AC_MSG_CHECKING([for libresolv.a]) +if test -e /usr/lib64/libresolv.a; then + libresolvdir=/usr/lib64 + libresolvok=yes +else + if test -e /usr/lib/libresolv.a; then + libresolvdir=/usr/lib + libresolvok=yes + else + libresolvok=no + fi +fi +AC_MSG_RESULT($libresolvok) +AC_SUBST(LIBRESOLVDIR, [$libresolvdir]) + # See if we have progress callback AC_CHECK_LIB([milter], [smfi_progress], diff -r 315c53fbbb77 -r d8ee4c97b9ab dnsbl.spec.in --- a/dnsbl.spec.in Fri Nov 19 10:34:33 2010 -0800 +++ b/dnsbl.spec.in Fri Nov 19 13:01:07 2010 -0800 @@ -3,7 +3,7 @@ Summary: Sendmail milter for spam control Name: @PACKAGE@ Version: @VERSION@ -Release: 2%{?dist} +Release: 1%{?dist} License: GPLv3+ Group: System Environment/Daemons Source: http://www.five-ten-sg.com/%{name}/packages/%{name}-%{version}.tar.gz @@ -96,6 +96,9 @@ %changelog +* Fri Nov 19 2010 Carl Byington - 6.26-1 +- 64bit fixes for libresolv.a + * Thu Jul 22 2010 Carl Byington - 6.25-2 - chkconfig -del in %%preun, not %%postun diff -r 315c53fbbb77 -r d8ee4c97b9ab src/Makefile.am --- a/src/Makefile.am Fri Nov 19 10:34:33 2010 -0800 +++ b/src/Makefile.am Fri Nov 19 13:01:07 2010 -0800 @@ -7,7 +7,7 @@ # the library search path. dnsbl_LDFLAGS = $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) -dnsbl_LDADD = $(all_libraries) $(REGEXLIB) -lmilter -lresolv /usr/lib/libresolv.a +dnsbl_LDADD = $(all_libraries) $(REGEXLIB) -lmilter -lresolv @LIBRESOLVDIR@/libresolv.a # default compile flags dnsbl_CXXFLAGS = $(PTHREAD_CFLAGS) diff -r 315c53fbbb77 -r d8ee4c97b9ab src/context.h --- a/src/context.h Fri Nov 19 10:34:33 2010 -0800 +++ b/src/context.h Fri Nov 19 13:01:07 2010 -0800 @@ -24,6 +24,7 @@ typedef map string_map; typedef set int_set; +typedef set int32_t_set; typedef list smtp_list; typedef DNSBL * DNSBLP; typedef VERIFY * VERIFYP; @@ -34,7 +35,7 @@ typedef CONTEXT * CONTEXTP; typedef list context_list; typedef map context_map; -typedef map ns_mapper; +typedef map ns_mapper; // name to ipv4 address typedef map rcpt_rates; typedef map autowhite_sent; typedef map verify_map; diff -r 315c53fbbb77 -r d8ee4c97b9ab src/dnsbl.cpp --- a/src/dnsbl.cpp Fri Nov 19 10:34:33 2010 -0800 +++ b/src/dnsbl.cpp Fri Nov 19 13:01:07 2010 -0800 @@ -119,7 +119,7 @@ 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 + ns_mapper ns_ip; // nameserver name -> ipv4 address of the name server ~ns_map(); void add(const char *name, const char *refer); }; @@ -154,7 +154,7 @@ #ifdef NS_PACKETSZ u_char answer[NS_PACKETSZ*4]; // with a resolver, we return resolver answers #else - int answer; // without a resolver, we return a single ip4 address, 0 == no answer + int32_t answer; // without a resolver, we return a single ipv4 address, 0 == no answer #endif } __attribute__ ((packed)); @@ -259,8 +259,8 @@ // If we cannot get an answer, we just accept the mail. // // -int dns_interface(mlfiPriv &priv, const char *question, bool maybe_ip, ns_map *nameservers); -int dns_interface(mlfiPriv &priv, const char *question, bool maybe_ip, ns_map *nameservers) { +int32_t dns_interface(mlfiPriv &priv, const char *question, bool maybe_ip, ns_map *nameservers); +int32_t dns_interface(mlfiPriv &priv, const char *question, bool maybe_ip, ns_map *nameservers) { // tell sendmail we are still working #if _FFR_SMFI_PROGRESS if (priv.eom) smfi_progress(priv.ctx); @@ -274,7 +274,7 @@ // might be a bare ip address, try this first to avoid dns lookups that may not be needed in_addr ip; if (inet_aton(question, &ip)) { - return (int)ip.s_addr; + return (int32_t)ip.s_addr; } } int n = strlen(question); @@ -349,7 +349,7 @@ ns_mapper::iterator i = ns.ns_ip.find(nam); if (i != ns.ns_ip.end()) { // we want this ip address - int address; + int32_t address; memcpy(&address, ns_rr_rdata(rr), sizeof(address)); ns.ns_ip[nam] = address; } @@ -359,7 +359,7 @@ int rrnum = 0; while (ns_parserr(&handle, ns_s_an, rrnum++, &rr) == 0) { if (ns_rr_type(rr) == ns_t_a) { - int address; + int32_t address; memcpy(&address, ns_rr_rdata(rr), sizeof(address)); ret_address = address; } @@ -818,8 +818,8 @@ //////////////////////////////////////////////// // check a single dnsbl // -bool check_single(mlfiPriv &priv, int ip, const char *suffix); -bool check_single(mlfiPriv &priv, int ip, const char *suffix) { +bool check_single(mlfiPriv &priv, int32_t ip, const char *suffix); +bool check_single(mlfiPriv &priv, int32_t ip, const char *suffix) { // make a dns question const u_char *src = (const u_char *)&ip; if (src[0] == 127) return false; // don't do dns lookups on localhost @@ -840,8 +840,8 @@ //////////////////////////////////////////////// // check a single dnsbl // -bool check_single(mlfiPriv &priv, int ip, DNSBL &bl); -bool check_single(mlfiPriv &priv, int ip, DNSBL &bl) { +bool check_single(mlfiPriv &priv, int32_t ip, DNSBL &bl); +bool check_single(mlfiPriv &priv, int32_t ip, DNSBL &bl) { return check_single(priv, ip, bl.suffix); } @@ -875,8 +875,8 @@ // check the hosts from the body against the content filter and uribl dnsbls // // -bool check_hosts(mlfiPriv &priv, bool random, int limit, const char *&msg, const char *&host, int &ip, const char *&found); -bool check_hosts(mlfiPriv &priv, bool random, int limit, const char *&msg, const char *&host, int &ip, const char *&found) { +bool check_hosts(mlfiPriv &priv, bool random, int limit, const char *&msg, const char *&host, int32_t &ip, const char *&found); +bool check_hosts(mlfiPriv &priv, bool random, int limit, const char *&msg, const char *&host, int32_t &ip, const char *&found) { found = NULL; // normally ip address style if (!priv.content_suffix && !priv.uribl_suffix) return false; // nothing to check string_set &hosts = priv.memory->get_hosts(); @@ -884,7 +884,7 @@ int count = 0; int cnt = hosts.size(); // number of hosts we could look at - int_set ips; + int32_t_set ips; ns_map nameservers; for (string_set::iterator i=hosts.begin(); i!=hosts.end(); i++) { host = *i; // a reference into hosts, which will live until this smtp transaction is closed @@ -921,7 +921,7 @@ my_syslog(&priv, buf); } if (ip) { - int_set::iterator i = ips.find(ip); + int32_t_set::iterator i = ips.find(ip); if (i == ips.end()) { // we haven't looked this up yet ips.insert(ip); @@ -959,7 +959,7 @@ my_syslog(&priv, buf); } if (ip) { - int_set::iterator i = ips.find(ip); + int32_t_set::iterator i = ips.find(ip); if (i == ips.end()) { ips.insert(ip); if (check_single(priv, ip, priv.content_suffix)) { @@ -1312,7 +1312,7 @@ sfsistat rc; mlfiPriv &priv = *MLFIPRIV; const char *host = NULL; - int ip; + int32_t ip; // process end of message priv.eom = true; if (priv.authenticated || priv.only_whites) rc = SMFIS_CONTINUE; diff -r 315c53fbbb77 -r d8ee4c97b9ab src/dnsbl.h --- a/src/dnsbl.h Fri Nov 19 10:34:33 2010 -0800 +++ b/src/dnsbl.h Fri Nov 19 13:01:07 2010 -0800 @@ -31,7 +31,7 @@ CONFIG *pc; // global filtering configuration int fd; // to talk to dns resolver process bool err; // did we get any errors on the resolver socket? - int ip; // ip4 address of the smtp client + int32_t ip; // ip4 address of the smtp client const char *helo; // helo from client map checked; // map of dnsblp to result of (ip listed on that dnsbl) // message specific data