changeset 227:3fee608becbc stable-6-0-21

Fixes to compile on old systems without memrchr or string::clear(). Fix bug in spamassassin interface trying to clear a string with string::empty().
author Carl Byington <carl@five-ten-sg.com>
date Sat, 03 Jan 2009 15:16:47 -0800
parents c3a4b03f371d
children 87e760b2b1b9
files ChangeLog NEWS configure.in dnsbl.spec.in src/dccifd.cpp src/dnsbl.cpp src/includes.h src/spamass.cpp.in
diffstat 8 files changed, 29 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Jan 03 10:07:10 2009 -0800
+++ b/ChangeLog	Sat Jan 03 15:16:47 2009 -0800
@@ -1,3 +1,8 @@
+6.21 2009-01-03
+    Fixes to compile on old systems without memrchr or string::clear().
+    Fix bug in spamassassin interface trying to clear a string with
+    string::empty().
+
 6.20 2008-12-27
     Never whitelist self addressed mail. Spammers are once again
     sending mail from A to A trying to get around filters. Changes
--- a/NEWS	Sat Jan 03 10:07:10 2009 -0800
+++ b/NEWS	Sat Jan 03 15:16:47 2009 -0800
@@ -1,3 +1,4 @@
+6.21 2009-01-03 Fixes to compile on old systems without memrchr or string::clear().
 6.20 2008-12-27 Never whitelist self addressed mail.
 6.19 2008-06-10 Fixes to compile on Fedora 9 and for const correctness.
 6.18 2008-03-22 Extend auto-whitelisting even if specified in a parent context.
--- a/configure.in	Sat Jan 03 10:07:10 2009 -0800
+++ b/configure.in	Sat Jan 03 15:16:47 2009 -0800
@@ -1,6 +1,6 @@
 
 AC_PREREQ(2.59)
-AC_INIT(dnsbl,6.20,carl@five-ten-sg.com)
+AC_INIT(dnsbl,6.21,carl@five-ten-sg.com)
 AC_CONFIG_SRCDIR([config.h.in])
 AC_CONFIG_HEADER([config.h])
 
@@ -40,7 +40,7 @@
 AC_HEADER_STDC
 AC_FUNC_STAT
 AC_FUNC_STRFTIME
-AC_CHECK_FUNCS([daemon dup2 gethostbyname gethostname memmove memset socket strchr strdup strerror strncasecmp strrchr strstr strtol])
+AC_CHECK_FUNCS([daemon dup2 gethostbyname gethostname memmove memrchr memset regcomp socket strcasecmp strchr strdup strerror strncasecmp strrchr strstr strtol])
 
 # check for posix threads
 ACX_PTHREAD
--- a/dnsbl.spec.in	Sat Jan 03 10:07:10 2009 -0800
+++ b/dnsbl.spec.in	Sat Jan 03 15:16:47 2009 -0800
@@ -96,6 +96,10 @@
 
 
 %changelog
+* Sat Jan 03 2009 Carl Byington <carl@five-ten-sg.com> - 6.21-1
+- Fixes to compile on old systems without memrchr or string::clear().
+- Fix bug in spamassassin interface trying to clear a string with string::empty().
+
 * Sat Dec 27 2008 Carl Byington <carl@five-ten-sg.com> - 6.20-1
 - Never whitelist self addressed mail.
 - Fixes to compile on Fedora 10 and for const correctness.
--- a/src/dccifd.cpp	Sat Jan 03 10:07:10 2009 -0800
+++ b/src/dccifd.cpp	Sat Jan 03 15:16:47 2009 -0800
@@ -107,7 +107,7 @@
 	if (dccifd_socket == NULL_SOCKET) Connect();
 	if ((dccifd_socket != NULL_SOCKET) && (!dccifd_input.empty())) {
 		output(dccifd_input);
-		dccifd_input.clear();
+		dccifd_input = "";
 	}
 
 	if (first_header) {
@@ -194,8 +194,8 @@
 			i = j+1;
 		}
 	}
-	char buff[maxlen];
-	snprintf(buff, sizeof(buff), "dccifd found grey %s bulk %d", ((grey) ? "yes" : "no"), bulk);
+	//char buff[maxlen];
+	//snprintf(buff, sizeof(buff), "dccifd found grey %s bulk %d", ((grey) ? "yes" : "no"), bulk);
 	//my_syslog(priv, buff);
 }
 
--- a/src/dnsbl.cpp	Sat Jan 03 10:07:10 2009 -0800
+++ b/src/dnsbl.cpp	Sat Jan 03 15:16:47 2009 -0800
@@ -65,6 +65,17 @@
 	#include "daemon.c"
 #endif
 
+#ifndef HAVE_MEMRCHR
+    void *memrchr(const void *a, int c, size_t len);
+    void *memrchr(const void *a, int c, size_t len) {
+        const unsigned char *p = (const unsigned char *)a;
+        for (p += len-1; (const void *)p >= a; p--)
+            if (*p == c)
+                return (void *)p;
+        return (void *)0;
+    }
+#endif
+
 extern "C" {
     sfsistat mlfi_connect(SMFICTX *ctx, char *hostname, _SOCK_ADDR *hostaddr);
     sfsistat mlfi_helo(SMFICTX * ctx, char *helohost);
--- a/src/includes.h	Sat Jan 03 10:07:10 2009 -0800
+++ b/src/includes.h	Sat Jan 03 15:16:47 2009 -0800
@@ -22,6 +22,7 @@
 #include <regex.h>
 #include <string.h>
 #include <stdlib.h>
+#include <stdio.h>
 #include <string>
 
 #include "tokenizer.h"
--- a/src/spamass.cpp.in	Sat Jan 03 10:07:10 2009 -0800
+++ b/src/spamass.cpp.in	Sat Jan 03 15:16:47 2009 -0800
@@ -128,7 +128,7 @@
     if (!running) Connect();
     if (running) {
         output(spamc_input);
-        spamc_input.empty();
+        spamc_input = "";
     }
 
     output(headerf);