changeset 223:da9e7f1c8160

fix unsigned signed compare, back to mixed -lresolv and libresolv.a with auto requires
author Carl Byington <carl@five-ten-sg.com>
date Sun, 28 Dec 2008 09:15:25 -0800
parents b2a7ca398712
children fb0aafedb23d
files dnsbl.spec.in src/Makefile.am src/dnsbl.cpp src/includes.h
diffstat 4 files changed, 56 insertions(+), 59 deletions(-) [+]
line wrap: on
line diff
--- a/dnsbl.spec.in	Sun Dec 28 08:34:14 2008 -0800
+++ b/dnsbl.spec.in	Sun Dec 28 09:15:25 2008 -0800
@@ -9,7 +9,6 @@
 Source:             http://www.five-ten-sg.com/%{name}/packages/%{name}-%{version}.tar.gz
 BuildRoot:          %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
 URL:                http://www.five-ten-sg.com/%{name}/
-AutoReqProv:        no
 
 Requires(pre):          /usr/sbin/useradd
 Requires(pre):          /usr/bin/getent
@@ -20,7 +19,6 @@
 Requires:               sendmail >= 8.12.1
 Requires:               sendmail-cf
 Requires:               spamassassin
-Requires:               libc.so.6, libgcc_s.so.1, libm.so.6, libpthread.so.0, libstdc++.so.6
 
 
 %description
--- a/src/Makefile.am	Sun Dec 28 08:34:14 2008 -0800
+++ b/src/Makefile.am	Sun Dec 28 09:15:25 2008 -0800
@@ -7,7 +7,7 @@
 
 # the library search path.
 dnsbl_LDFLAGS = $(PTHREAD_CFLAGS) $(PTHREAD_LIBS)
-dnsbl_LDADD   = $(all_libraries) -lmilter /usr/lib/libresolv.a
+dnsbl_LDADD   = $(all_libraries) -lmilter -lresolv /usr/lib/libresolv.a
 
 # default compile flags
 dnsbl_CXXFLAGS = $(PTHREAD_CFLAGS)
--- a/src/dnsbl.cpp	Sun Dec 28 08:34:14 2008 -0800
+++ b/src/dnsbl.cpp	Sun Dec 28 09:15:25 2008 -0800
@@ -532,8 +532,9 @@
             snprintf(text, sizeof(text), "process_resolver_requests() has a question %s", question);
             my_syslog(text);
         #endif
-        glom.length = res_search(question, ns_c_in, ns_t_a, glom.answer, sizeof(glom.answer));
-        if (glom.length < 0) glom.length = 0;   // represent all errors as zero length answers
+        int res_result = res_search(question, ns_c_in, ns_t_a, glom.answer, sizeof(glom.answer));
+        if (res_result < 0) glom.length = 0;   // represent all errors as zero length answers
+        else                glom.length = (size_t)res_result;
 #else
         glom.length = sizeof(glom.answer);
         glom.answer = 0;
@@ -611,7 +612,7 @@
         snprintf(text, sizeof(text), "dns_interface() wrote question %s and has answer length %d", question, glom.length);
         my_syslog(text);
     #endif
-    if ((glom.length < 0) || (glom.length > sizeof(glom.answer))) {
+    if ((glom.length == 0) || (glom.length > sizeof(glom.answer))) {
         priv.err = true;
         return 0;  // cannot process overlarge answers
     }
@@ -622,7 +623,6 @@
     // stepping on each other while parsing the dns answer.
     int ret_address = 0;
     pthread_mutex_lock(&resolve_mutex);
-        if (glom.length > 0) {
             // parse the answer
             ns_msg handle;
             ns_rr  rr;
@@ -682,7 +682,6 @@
                     }
                 }
             }
-        }
     pthread_mutex_unlock(&resolve_mutex);
     #ifdef RESOLVER_DEBUG
         snprintf(text, sizeof(text), "dns_interface() found ip %d", ret_address);
--- a/src/includes.h	Sun Dec 28 08:34:14 2008 -0800
+++ b/src/includes.h	Sun Dec 28 09:15:25 2008 -0800
@@ -9,7 +9,7 @@
 #define VERIFY_DEBUG   1
 #define RESOLVER_DEBUG 1
 #undef	VERIFY_DEBUG
-//#undef	RESOLVER_DEBUG
+#undef	RESOLVER_DEBUG
 
 #ifdef HAVE_CONFIG_H
 	#include "config.h"