summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPhilip Hazel <ph10@hermes.cam.ac.uk>2006-02-08 14:28:51 +0000
committerPhilip Hazel <ph10@hermes.cam.ac.uk>2006-02-08 14:28:51 +0000
commitea49d0e16fbc6f56fc5b8519d266f88d09139187 (patch)
tree461a6152e7ee2b4c512fbd48740fd924bd78476c /src
parent1349e1e5bcfa5fb3db8aa2f02825b7e70bf47cdb (diff)
Fix retry key bug for pipe, file, or autoreply deliveries.
Diffstat (limited to 'src')
-rw-r--r--src/src/deliver.c23
-rw-r--r--src/src/readconf.c8
-rw-r--r--src/src/retry.c52
3 files changed, 63 insertions, 20 deletions
diff --git a/src/src/deliver.c b/src/src/deliver.c
index 9351d45d7..dbec42e0e 100644
--- a/src/src/deliver.c
+++ b/src/src/deliver.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/deliver.c,v 1.26 2006/02/07 11:19:00 ph10 Exp $ */
+/* $Cambridge: exim/src/src/deliver.c,v 1.27 2006/02/08 14:28:51 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -2250,10 +2250,12 @@ while (addr_local != NULL)
DEBUG(D_retry)
{
- debug_printf("retry record exists: age=%d (max=%d)\n",
- (int)(now - retry_record->time_stamp), retry_data_expire);
- debug_printf(" time to retry = %d expired = %d\n",
- (int)(now - retry_record->next_try), retry_record->expired);
+ debug_printf("retry record exists: age=%s ",
+ readconf_printtime(now - retry_record->time_stamp));
+ debug_printf("(max %s)\n", readconf_printtime(retry_data_expire));
+ debug_printf(" time to retry = %s expired = %d\n",
+ readconf_printtime(retry_record->next_try - now),
+ retry_record->expired);
}
if (queue_running && !deliver_force)
@@ -2282,9 +2284,18 @@ while (addr_local != NULL)
for (last_rule = retry->rules;
last_rule->next != NULL;
last_rule = last_rule->next);
+ DEBUG(D_deliver|D_retry)
+ debug_printf("now=%d received_time=%d diff=%d timeout=%d\n",
+ (int)now, received_time, (int)now - received_time,
+ last_rule->timeout);
if (now - received_time > last_rule->timeout) ok = TRUE;
}
- else ok = TRUE; /* No rule => timed out */
+ else
+ {
+ DEBUG(D_deliver|D_retry)
+ debug_printf("no retry rule found: assume timed out\n");
+ ok = TRUE; /* No rule => timed out */
+ }
DEBUG(D_deliver|D_retry)
{
diff --git a/src/src/readconf.c b/src/src/readconf.c
index b860b96d3..5623b87f4 100644
--- a/src/src/readconf.c
+++ b/src/src/readconf.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/readconf.c,v 1.17 2006/02/07 11:19:00 ph10 Exp $ */
+/* $Cambridge: exim/src/src/readconf.c,v 1.18 2006/02/08 14:28:51 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -2011,6 +2011,12 @@ readconf_printtime(int t)
int s, m, h, d, w;
uschar *p = time_buffer;
+if (t < 0)
+ {
+ *p++ = '-';
+ t = -t;
+ }
+
s = t % 60;
t /= 60;
m = t % 60;
diff --git a/src/src/retry.c b/src/src/retry.c
index b54bb7d4a..2a5516003 100644
--- a/src/src/retry.c
+++ b/src/src/retry.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/retry.c,v 1.5 2006/02/07 11:19:00 ph10 Exp $ */
+/* $Cambridge: exim/src/src/retry.c,v 1.6 2006/02/08 14:28:51 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -46,8 +46,17 @@ if (retry != NULL && retry->rules != NULL)
for (last_rule = retry->rules;
last_rule->next != NULL;
last_rule = last_rule->next);
+ DEBUG(D_transport|D_retry)
+ debug_printf("now=%d received_time=%d diff=%d timeout=%d\n",
+ (int)now, received_time, (int)(now - received_time),
+ last_rule->timeout);
address_timeout = (now - received_time > last_rule->timeout);
}
+else
+ {
+ DEBUG(D_transport|D_retry)
+ debug_printf("no retry rule found: assume timed out\n");
+ }
return address_timeout;
}
@@ -340,23 +349,38 @@ retry_config *
retry_find_config(uschar *key, uschar *alternate, int basic_errno,
int more_errno)
{
-int replace;
+int replace = 0;
uschar *use_key, *use_alternate;
uschar *colon = Ustrchr(key, ':');
retry_config *yield;
-/* If there's a colon in the key, temporarily replace it with
-a zero to terminate the string there. */
+/* If there's a colon in the key, there are two possibilities:
+
+(1) This is a key for a host, ip address, and possibly port, in the format
+
+ hostname:ip+port
+
+ In this case, we temporarily replace the colon with a zero, to terminate
+ the string after the host name.
+
+(2) This is a key for a pipe, file, or autoreply delivery, in the format
+
+ pipe-or-file-or-auto:x@y
+
+ where x@y is the original address that provoked the delivery. The pipe or
+ file or auto will start with | or / or >, whereas a host name will start
+ with a letter or a digit. In this case we want to use the original address
+ to search for a retry rule. */
if (colon != NULL)
{
- replace = ':';
- }
-else
- {
- colon = key + Ustrlen(key);
- replace = 0;
+ if (isalnum(*key))
+ replace = ':';
+ else
+ key = Ustrrchr(key, ':') + 1; /* Take from the last colon */
}
+
+if (replace == 0) colon = key + Ustrlen(key);
*colon = 0;
/* Sort out the keys */
@@ -619,10 +643,12 @@ for (i = 0; i < 3; i++)
DEBUG(D_retry)
{
if ((rti->flags & rf_host) != 0)
- debug_printf("retry for %s (%s) = %s\n", rti->key,
- addr->domain, retry->pattern);
+ debug_printf("retry for %s (%s) = %s %d %d\n", rti->key,
+ addr->domain, retry->pattern, retry->basic_errno,
+ retry->more_errno);
else
- debug_printf("retry for %s = %s\n", rti->key, retry->pattern);
+ debug_printf("retry for %s = %s %d %d\n", rti->key, retry->pattern,
+ retry->basic_errno, retry->more_errno);
}
/* Set up the message for the database retry record. Because DBM