From 4d9b939b2e25471936a9b0fa6c928bf11bda1068 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Arkadiusz=20Mi=C5=9Bkiewicz?= Date: Thu, 6 Jan 2011 13:14:09 +0000 Subject: [PATCH] - up to 4.73; add better spamd loadbalance patch; drop noloadbalance patch Changed files: exim-bug-1056.patch -> 1.1 exim-noloadbalance.patch -> 1.2 exim.spec -> 1.322 --- exim-bug-1056.patch | 68 ++++++++++++++++++++++++++++++++++++++++ exim-noloadbalance.patch | 47 --------------------------- exim.spec | 10 +++--- 3 files changed, 73 insertions(+), 52 deletions(-) create mode 100644 exim-bug-1056.patch delete mode 100644 exim-noloadbalance.patch diff --git a/exim-bug-1056.patch b/exim-bug-1056.patch new file mode 100644 index 0000000..05c8d01 --- /dev/null +++ b/exim-bug-1056.patch @@ -0,0 +1,68 @@ +diff -urN exim-4.71/src/spam.c exim-4.71-new/src/spam.c +--- exim-4.71/src/spam.c 2008-07-18 18:55:42.000000000 +0100 ++++ exim-4.71-new/src/spam.c 2009-12-17 12:37:14.000000000 +0000 +@@ -104,10 +104,8 @@ + + /* socket does not start with '/' -> network socket */ + if (*spamd_address_work != '/') { +- time_t now = time(NULL); + int num_servers = 0; +- int current_server = 0; +- int start_server = 0; ++ int current_server; + uschar *address = NULL; + uschar *spamd_address_list_ptr = spamd_address_work; + uschar address_buffer[256]; +@@ -119,6 +117,7 @@ + address_buffer, + sizeof(address_buffer))) != NULL) { + ++ /* Potential memory leak as we never free the store. */ + spamd_address_container *this_spamd = + (spamd_address_container *)store_get(sizeof(spamd_address_container)); + +@@ -143,9 +142,10 @@ + return DEFER; + }; + +- current_server = start_server = (int)now % num_servers; ++ while ( num_servers > 0 ) { + +- while (1) { ++ /* Randomly pick a server to try */ ++ current_server = random_number( num_servers ); + + debug_printf("trying server %s, port %u\n", + spamd_address_vector[current_server]->tcp_addr, +@@ -173,16 +173,21 @@ + spamd_address_vector[current_server]->tcp_addr, + spamd_address_vector[current_server]->tcp_port, + strerror(errno)); +- current_server++; +- if (current_server >= num_servers) +- current_server = 0; +- if (current_server == start_server) { +- log_write(0, LOG_MAIN|LOG_PANIC, "spam acl condition: all spamd servers failed"); +- (void)fclose(mbox_file); +- (void)close(spamd_sock); +- return DEFER; +- }; +- }; ++ ++ (void)close(spamd_sock); ++ ++ /* Remove the server from the list. XXX We should free the memory */ ++ num_servers--; ++ int i; ++ for( i = current_server; i < num_servers; i++ ) ++ spamd_address_vector[i] = spamd_address_vector[i+1]; ++ } ++ ++ if ( num_servers == 0 ) { ++ log_write(0, LOG_MAIN|LOG_PANIC, "spam acl condition: all spamd servers failed"); ++ (void)fclose(mbox_file); ++ return DEFER; ++ } + + } + else { diff --git a/exim-noloadbalance.patch b/exim-noloadbalance.patch deleted file mode 100644 index f204d62..0000000 --- a/exim-noloadbalance.patch +++ /dev/null @@ -1,47 +0,0 @@ -diff -urbB exim-4.54.org/src/globals.c exim-4.54/src/globals.c ---- exim-4.54.org/src/globals.c 2005-11-25 22:02:44.762799750 +0100 -+++ exim-4.54/src/globals.c 2005-11-25 21:54:06.210392250 +0100 -@@ -1058,6 +1058,7 @@ - - #ifdef WITH_CONTENT_SCAN - uschar *spamd_address = US"127.0.0.1 783"; -+BOOL spamd_loadbalance = TRUE; - uschar *spam_bar = NULL; - uschar *spam_report = NULL; - uschar *spam_score = NULL; -diff -urbB exim-4.54.org/src/globals.h exim-4.54/src/globals.h ---- exim-4.54.org/src/globals.h 2005-11-25 22:02:44.762799750 +0100 -+++ exim-4.54/src/globals.h 2005-11-25 21:54:37.700360250 +0100 -@@ -656,6 +656,7 @@ - - #ifdef WITH_CONTENT_SCAN - extern uschar *spamd_address; /* address for the spamassassin daemon */ -+extern BOOL spamd_loadbalance; /* load balance or try in order from config */ - extern uschar *spam_bar; /* the spam "bar" (textual representation of spam_score) */ - extern uschar *spam_report; /* the spamd report (multiline) */ - extern uschar *spam_score; /* the spam score (float) */ -diff -urbB exim-4.54.org/src/readconf.c exim-4.54/src/readconf.c ---- exim-4.54.org/src/readconf.c 2005-11-25 22:02:44.762799750 +0100 -+++ exim-4.54/src/readconf.c 2005-11-25 21:55:01.061820250 +0100 -@@ -339,6 +339,7 @@ - { "smtp_return_error_details",opt_bool, &smtp_return_error_details }, - #ifdef WITH_CONTENT_SCAN - { "spamd_address", opt_stringptr, &spamd_address }, -+ { "spamd_loadbalance", opt_bool, &spamd_loadbalance }, - #endif - { "split_spool_directory", opt_bool, &split_spool_directory }, - { "spool_directory", opt_stringptr, &spool_directory }, -diff -urbB exim-4.54.org/src/spam.c exim-4.54/src/spam.c ---- exim-4.54.org/src/spam.c 2005-10-04 10:55:28.000000000 +0200 -+++ exim-4.54/src/spam.c 2005-11-25 22:01:46.839179750 +0100 -@@ -127,7 +127,10 @@ - return DEFER; - }; - -+ if (spamd_loadbalance) - current_server = start_server = (int)now % num_servers; -+ else -+ current_server = start_server = 0; - - while (1) { - diff --git a/exim.spec b/exim.spec index 2032e75..2301616 100644 --- a/exim.spec +++ b/exim.spec @@ -13,15 +13,15 @@ Summary: University of Cambridge Mail Transfer Agent Summary(pl.UTF-8): Agent Transferu Poczty Uniwersytetu w Cambridge Summary(pt_BR.UTF-8): Servidor de correio eletrônico exim Name: exim -Version: 4.72 -Release: 5 +Version: 4.73 +Release: 1 Epoch: 2 License: GPL Group: Networking/Daemons/SMTP Source0: ftp://ftp.exim.org/pub/exim/exim4/%{name}-%{version}.tar.bz2 -# Source0-md5: ccc937b533568e5e8340f181a3b3d2ff +# Source0-md5: b32fb85c5161ad2fabfe9ba860a1ad2c Source1: ftp://ftp.exim.org/pub/exim/exim4/%{name}-html-%{version}.tar.bz2 -# Source1-md5: 8b39be84de74b94bd4b5c3e7aad3fcdf +# Source1-md5: 2122481f3248a7c102024a5c22cd5c72 Source2: %{name}.init Source3: %{name}.cron.db Source4: %{name}4.conf @@ -46,7 +46,7 @@ Patch2: %{name}4-cflags.patch Patch4: %{name}4-Makefile-Default.patch # http://marc.merlins.org/linux/exim/files/sa-exim-cvs/localscan_dlopen_exim_4.20_or_better.patch Patch5: localscan_dlopen_%{name}_4.20_or_better.patch -Patch6: %{name}-noloadbalance.patch +Patch6: %{name}-bug-1056.patch # http://sourceforge.net/projects/eximdsn/ Patch7: %{name}_463_dsn_1_3.patch Patch8: %{name}-spam-timeout.patch -- 2.44.0