diff src/dnsbl.cpp @ 242:d8ee4c97b9ab stable-6-0-26

64 bit fixes for libresolv.a
author Carl Byington <carl@five-ten-sg.com>
date Fri, 19 Nov 2010 13:01:07 -0800
parents 7b818a4e21a4
children ef97c7cd4a6e
line wrap: on
line diff
--- 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;