summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeiko Schlichting <heiko@fu-berlin.de>2021-02-19 11:11:51 +0000
committerJeremy Harris <jgh146exb@wizmail.org>2021-02-19 16:37:02 +0000
commit56aaf18ba56889f4b51aede05317368ce146a2aa (patch)
tree84fe90f7a244bb670cfef6ea2be2669829884c31
parent847af3bf8ab8fce233b5927428d5cd06bf8d9bc9 (diff)
downloadexim4-56aaf18ba56889f4b51aede05317368ce146a2aa.tar.gz
Fix weight calculation for spamd_address. Bug 2694
(cherry picked from commit 6296a393aeab9fecc38916dfcbf1c94d54691650)
-rw-r--r--doc/doc-txt/ChangeLog4
-rw-r--r--src/src/spam.c2
2 files changed, 4 insertions, 2 deletions
diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog
index f687f73f5..f8bfcf10c 100644
--- a/doc/doc-txt/ChangeLog
+++ b/doc/doc-txt/ChangeLog
@@ -153,7 +153,9 @@ JH/42 Bug 2692: Harden against a peer which reneges on a 452 "too many
previous coding assumed this would not happen, and under PIPELINING
would result in both lost and duplicate recipients for a message.
-
+JH/43 Bug 2694: Fix weighted distribution of work to multiple spamd servers.
+ Previously the weighting was incorrectly applied. Found and fixed by
+ Heiko Schlichting.
Exim version 4.94
diff --git a/src/src/spam.c b/src/src/spam.c
index 340f8b92f..2fffa1447 100644
--- a/src/src/spam.c
+++ b/src/src/spam.c
@@ -174,7 +174,7 @@ for (long rnd = random() % weights, i = 0; i < num_servers; i++)
{
sd = spamds[i];
if (!sd->is_failed && sd->priority == pri)
- if ((rnd -= sd->weight) <= 0)
+ if ((rnd -= sd->weight) < 0)
return i;
}