[exim-dev] [Bug 2694] Wrong distribution to spamd-servers

Top Page
Delete this message
Reply to this message
Author: admin
Date:  
To: exim-dev
Subject: [exim-dev] [Bug 2694] Wrong distribution to spamd-servers
https://bugs.exim.org/show_bug.cgi?id=2694

Git Commit <git@???> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |git@???


--- Comment #5 from Git Commit <git@???> ---
Git commit:
https://git.exim.org/exim.git/commitdiff/6296a393aeab9fecc38916dfcbf1c94d54691650

commit 6296a393aeab9fecc38916dfcbf1c94d54691650
Author:     Heiko Schlichting <heiko@???>
AuthorDate: Fri Feb 19 11:11:51 2021 +0000
Commit:     Jeremy Harris <jgh146exb@???>
CommitDate: Fri Feb 19 11:51:17 2021 +0000


    Fix weight calculation for spamd_address.  Bug 2694
---
 doc/doc-txt/ChangeLog | 4 +++-
 src/src/spam.c        | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)


diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog
index 5b900a5..59fb46a 100644
--- a/doc/doc-txt/ChangeLog
+++ b/doc/doc-txt/ChangeLog
@@ -203,7 +203,9 @@ JH/42 Bug 2693: 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 3318bff..b0e24b3 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;
   }


--
You are receiving this mail because:
You are on the CC list for the bug.