summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2017-10-12 14:03:08 +0100
committerJeremy Harris <jgh146exb@wizmail.org>2017-10-12 16:34:21 +0100
commit2d2bd7ad2a273ac0e174c9b7df322bf3b0549160 (patch)
tree8ede97935da47a275ba46fce4f7dbe29da42a09d
parent4b9e57976eaf0611bd5ff666eba60dc2a07f0ea3 (diff)
downloadexim4-2d2bd7ad2a273ac0e174c9b7df322bf3b0549160.tar.gz
Fix queue_run_in_order to ignore the PID portion of the message ID
-rw-r--r--doc/doc-txt/ChangeLog4
-rw-r--r--src/src/queue.c13
-rw-r--r--src/src/receive.c5
3 files changed, 16 insertions, 6 deletions
diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog
index 74a492686..73c86a9ce 100644
--- a/doc/doc-txt/ChangeLog
+++ b/doc/doc-txt/ChangeLog
@@ -50,6 +50,10 @@ JH/15 Fix a crash in the smtp transport caused when two hosts in succession
are unsuable for non-message-specific reasons - eg. connection timeout,
banner-time rejection.
+JH/29 Fix queue_run_in_order to ignore the PID portion of the message ID. This
+ matters on fast-turnover and PID-randomising systems, which were getting
+ out-of-order delivery.
+
Exim version 4.89
-----------------
diff --git a/src/src/queue.c b/src/src/queue.c
index 50e4aaef3..8db4094fd 100644
--- a/src/src/queue.c
+++ b/src/src/queue.c
@@ -80,7 +80,11 @@ queue_filename *first = NULL;
queue_filename **append = &first;
while (a && b)
- if (Ustrcmp(a->text, b->text) < 0)
+ {
+ int d;
+ if ((d = Ustrncmp(a->text, b->text, 6)) == 0)
+ d = Ustrcmp(a->text + 14, b->text + 14);
+ if (d < 0)
{
*append = a;
append= &a->next;
@@ -92,6 +96,7 @@ while (a && b)
append= &b->next;
b = b->next;
}
+ }
*append = a ? a : b;
return first;
@@ -278,7 +283,7 @@ for (; i <= *subcount; i++)
if (root[j])
{
next = merge_queue_lists(next, root[j]);
- root[j] = (j == LOG2_MAXNODES - 1)? next : NULL;
+ root[j] = j == LOG2_MAXNODES - 1 ? next : NULL;
}
else
{
@@ -460,8 +465,8 @@ subsequent iterations.
When the first argument of queue_get_spool_list() is -1 (for queue_run_in_
order), it scans all directories and makes a single message list. */
-for (i = (queue_run_in_order? -1 : 0);
- i <= (queue_run_in_order? -1 : subcount);
+for (i = queue_run_in_order ? -1 : 0;
+ i <= (queue_run_in_order ? -1 : subcount);
i++)
{
queue_filename *f;
diff --git a/src/src/receive.c b/src/src/receive.c
index 7980c324f..95cf13e12 100644
--- a/src/src/receive.c
+++ b/src/src/receive.c
@@ -2582,8 +2582,9 @@ letter and it is not used internally.
NOTE: If ever the format of message ids is changed, the regular expression for
checking that a string is in this format must be updated in a corresponding
way. It appears in the initializing code in exim.c. The macro MESSAGE_ID_LENGTH
-must also be changed to reflect the correct string length. Then, of course,
-other programs that rely on the message id format will need updating too. */
+must also be changed to reflect the correct string length. The queue-sort code
+needs to know the layout. Then, of course, other programs that rely on the
+message id format will need updating too. */
Ustrncpy(message_id, string_base62((long int)(message_id_tv.tv_sec)), 6);
message_id[6] = '-';