summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Hazel <ph10@hermes.cam.ac.uk>2005-01-25 14:16:33 +0000
committerPhilip Hazel <ph10@hermes.cam.ac.uk>2005-01-25 14:16:33 +0000
commitb08b24c880b30c34f3ed5f4c59a286fdefb1c0f5 (patch)
treede9873938eb41cd7d996a754242cc7a53903924d
parent23fd96b1bfb48403313e4be99f60968ce959e1bd (diff)
(1) Added $host_lookup_deferred.
(2) Some old tests needed tweaking because of previous changes. (3) Comment added to EDITME re USE_READLINE.
-rw-r--r--src/exim_monitor/em_globals.c3
-rw-r--r--src/src/EDITME6
-rw-r--r--src/src/expand.c3
-rw-r--r--src/src/globals.c3
-rw-r--r--src/src/globals.h3
-rw-r--r--src/src/host.c41
-rw-r--r--src/src/spool_in.c5
-rw-r--r--src/src/spool_out.c3
8 files changed, 49 insertions, 18 deletions
diff --git a/src/exim_monitor/em_globals.c b/src/exim_monitor/em_globals.c
index cd6e38d93..44389c195 100644
--- a/src/exim_monitor/em_globals.c
+++ b/src/exim_monitor/em_globals.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/exim_monitor/em_globals.c,v 1.4 2005/01/04 10:00:42 ph10 Exp $ */
+/* $Cambridge: exim/src/exim_monitor/em_globals.c,v 1.5 2005/01/25 14:16:33 ph10 Exp $ */
/*************************************************
* Exim Monitor *
@@ -144,6 +144,7 @@ BOOL fake_reject = FALSE;
header_line *header_last = NULL;
header_line *header_list = NULL;
+BOOL host_lookup_deferred = FALSE;
BOOL host_lookup_failed = FALSE;
uschar *interface_address = NULL;
int interface_port = 0;
diff --git a/src/src/EDITME b/src/src/EDITME
index b70c3272b..93cca9351 100644
--- a/src/src/EDITME
+++ b/src/src/EDITME
@@ -1,4 +1,4 @@
-# $Cambridge: exim/src/src/EDITME,v 1.6 2004/12/17 14:52:44 ph10 Exp $
+# $Cambridge: exim/src/src/EDITME,v 1.7 2005/01/25 14:16:33 ph10 Exp $
##################################################
# The Exim mail transport agent #
@@ -819,6 +819,10 @@ SYSTEM_ALIASES_FILE=/etc/aliases
# USE_READLINE=yes
+# You may need to add -ldl to EXTRA_LIBS when you set USE_READLINE=yes.
+# Note that this option adds to the size of the Exim binary, because the
+# dynamic loading library is not otherwise included.
+
###############################################################################
diff --git a/src/src/expand.c b/src/src/expand.c
index 9506d7ae0..49af95fd9 100644
--- a/src/src/expand.c
+++ b/src/src/expand.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/expand.c,v 1.11 2005/01/13 10:09:36 ph10 Exp $ */
+/* $Cambridge: exim/src/src/expand.c,v 1.12 2005/01/25 14:16:33 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -351,6 +351,7 @@ static var_entry var_table[] = {
{ "host", vtype_stringptr, &deliver_host },
{ "host_address", vtype_stringptr, &deliver_host_address },
{ "host_data", vtype_stringptr, &host_data },
+ { "host_lookup_deferred",vtype_int, &host_lookup_deferred },
{ "host_lookup_failed", vtype_int, &host_lookup_failed },
{ "inode", vtype_ino, &deliver_inode },
{ "interface_address", vtype_stringptr, &interface_address },
diff --git a/src/src/globals.c b/src/src/globals.c
index 8184758c8..129923063 100644
--- a/src/src/globals.c
+++ b/src/src/globals.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/globals.c,v 1.14 2005/01/12 14:41:12 ph10 Exp $ */
+/* $Cambridge: exim/src/src/globals.c,v 1.15 2005/01/25 14:16:33 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -559,6 +559,7 @@ BOOL host_checking_callout = FALSE;
uschar *host_data = NULL;
BOOL host_find_failed_syntax= FALSE;
uschar *host_lookup = NULL;
+BOOL host_lookup_deferred = FALSE;
BOOL host_lookup_failed = FALSE;
uschar *host_lookup_order = US"bydns:byaddr";
uschar *host_lookup_msg = US"";
diff --git a/src/src/globals.h b/src/src/globals.h
index ed67b491e..c7be2e0ea 100644
--- a/src/src/globals.h
+++ b/src/src/globals.h
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/globals.h,v 1.10 2005/01/04 10:00:42 ph10 Exp $ */
+/* $Cambridge: exim/src/src/globals.h,v 1.11 2005/01/25 14:16:33 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -331,6 +331,7 @@ extern BOOL host_find_failed_syntax;/* DNS syntax check failure */
extern BOOL host_checking_callout; /* TRUE if real callout wanted */
extern uschar *host_data; /* Obtained from lookup in ACL */
extern uschar *host_lookup; /* For which IP addresses are always looked up */
+extern BOOL host_lookup_deferred; /* TRUE if lookup deferred */
extern BOOL host_lookup_failed; /* TRUE if lookup failed */
extern uschar *host_lookup_order; /* Order of host lookup types */
extern uschar *host_lookup_msg; /* Text for why it failed */
diff --git a/src/src/host.c b/src/src/host.c
index 0ebdf8b84..8cc239b0f 100644
--- a/src/src/host.c
+++ b/src/src/host.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/host.c,v 1.7 2005/01/12 12:17:41 ph10 Exp $ */
+/* $Cambridge: exim/src/src/host.c,v 1.8 2005/01/25 14:16:33 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -1336,9 +1336,11 @@ Returns: OK on success, the answer being placed in the global variable
The variable host_lookup_msg is set to an empty string on sucess, or to a
reason for the failure otherwise, in a form suitable for tagging onto an error
-message, and also host_lookup_failed is set TRUE if the lookup failed. Any
-dynamically constructed string for host_lookup_msg must be in permanent store,
-because it might be used for several incoming messages on the same SMTP
+message, and also host_lookup_failed is set TRUE if the lookup failed. If there
+was a defer, host_lookup_deferred is set TRUE.
+
+Any dynamically constructed string for host_lookup_msg must be in permanent
+store, because it might be used for several incoming messages on the same SMTP
connection. */
int
@@ -1355,6 +1357,8 @@ dns_record *rr;
dns_answer dnsa;
dns_scan dnss;
+host_lookup_deferred = host_lookup_failed = FALSE;
+
HDEBUG(D_host_lookup)
debug_printf("looking up host name for %s\n", sender_host_address);
@@ -1366,6 +1370,7 @@ if (running_in_test_harness &&
{
HDEBUG(D_host_lookup)
debug_printf("Test harness: host name lookup returns DEFER\n");
+ host_lookup_deferred = TRUE;
return DEFER;
}
@@ -1455,6 +1460,7 @@ while ((ordername = string_nextinlist(&list, &sep, buffer, sizeof(buffer)))
{
HDEBUG(D_host_lookup)
debug_printf("IP address PTR lookup gave temporary error\n");
+ host_lookup_deferred = TRUE;
return DEFER;
}
}
@@ -1465,9 +1471,12 @@ while ((ordername = string_nextinlist(&list, &sep, buffer, sizeof(buffer)))
{
HDEBUG(D_host_lookup)
debug_printf("IP address lookup using gethostbyaddr()\n");
-
rc = host_name_lookup_byaddr();
- if (rc == DEFER) return rc; /* Can't carry on */
+ if (rc == DEFER)
+ {
+ host_lookup_deferred = TRUE;
+ return rc; /* Can't carry on */
+ }
if (rc == OK) break; /* Found a name */
}
} /* Loop for bydns/byaddr scanning */
@@ -1481,8 +1490,7 @@ if (sender_host_name == NULL)
log_write(L_host_lookup_failed, LOG_MAIN, "no host name found for IP "
"address %s", sender_host_address);
host_lookup_msg = US" (failed to find host name from IP address)";
-
-host_lookup_failed = TRUE;
+ host_lookup_failed = TRUE;
return FAIL;
}
@@ -1570,6 +1578,7 @@ for (hname = sender_host_name; hname != NULL; hname = *aliases++)
else if (rc == HOST_FIND_AGAIN)
{
HDEBUG(D_host_lookup) debug_printf("temporary error for host name lookup\n");
+ host_lookup_deferred = TRUE;
return DEFER;
}
else
@@ -1614,7 +1623,6 @@ store_pool = POOL_PERM;
host_lookup_msg = string_sprintf(" (%s does not match any IP address for %s)",
sender_host_address, save_hostname);
store_pool = old_pool;
-
host_lookup_failed = TRUE;
return FAIL;
}
@@ -1664,6 +1672,19 @@ int i, yield, times;
uschar **addrlist;
host_item *last = NULL;
BOOL temp_error = FALSE;
+#if HAVE_IPV6
+int af;
+#endif
+
+/* If we are in the test harness, a name ending in .test.again.dns always
+forces a temporary error response. */
+
+if (running_in_test_harness)
+ {
+ uschar *endname = host->name + Ustrlen(host->name);
+ if (Ustrcmp(endname - 14, "test.again.dns") == 0)
+ return HOST_FIND_AGAIN;
+ }
/* In an IPv6 world, we need to scan for both kinds of address, so go round the
loop twice. Note that we have ensured that AF_INET6 is defined even in an IPv4
@@ -1672,8 +1693,6 @@ matches the domain, we also just do IPv4 lookups here (except when testing
standalone). */
#if HAVE_IPV6
- int af;
-
#ifndef STAND_ALONE
if (dns_ipv4_lookup != NULL &&
match_isinlist(host->name, &dns_ipv4_lookup, 0, NULL, NULL, MCL_DOMAIN,
diff --git a/src/src/spool_in.c b/src/src/spool_in.c
index aca1b131b..0e4297114 100644
--- a/src/src/spool_in.c
+++ b/src/src/spool_in.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/spool_in.c,v 1.5 2005/01/12 12:24:13 ph10 Exp $ */
+/* $Cambridge: exim/src/src/spool_in.c,v 1.6 2005/01/25 14:16:33 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -250,6 +250,7 @@ deliver_frozen_at = 0;
deliver_manual_thaw = FALSE;
/* dont_deliver must NOT be reset */
header_list = header_last = NULL;
+host_lookup_deferred = FALSE;
host_lookup_failed = FALSE;
interface_address = NULL;
interface_port = 0;
@@ -387,6 +388,8 @@ for (;;)
else if (Ustrncmp(big_buffer, "-bmi_verdicts ", 14) == 0)
bmi_verdicts = string_copy(big_buffer + 14);
#endif
+ else if (Ustrcmp(big_buffer, "-host_lookup_deferred") == 0)
+ host_lookup_deferred = TRUE;
else if (Ustrcmp(big_buffer, "-host_lookup_failed") == 0)
host_lookup_failed = TRUE;
else if (Ustrncmp(big_buffer, "-body_linecount", 15) == 0)
diff --git a/src/src/spool_out.c b/src/src/spool_out.c
index a157e84ba..7e74a2619 100644
--- a/src/src/spool_out.c
+++ b/src/src/spool_out.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/spool_out.c,v 1.4 2005/01/04 10:00:42 ph10 Exp $ */
+/* $Cambridge: exim/src/src/spool_out.c,v 1.5 2005/01/25 14:16:33 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -215,6 +215,7 @@ if (allow_unqualified_sender) fprintf(f, "-allow_unqualified_sender\n");
if (deliver_firsttime) fprintf(f, "-deliver_firsttime\n");
if (deliver_freeze) fprintf(f, "-frozen %d\n", deliver_frozen_at);
if (dont_deliver) fprintf(f, "-N\n");
+if (host_lookup_deferred) fprintf(f, "-host_lookup_deferred\n");
if (host_lookup_failed) fprintf(f, "-host_lookup_failed\n");
if (sender_local) fprintf(f, "-local\n");
if (local_error_message) fprintf(f, "-localerror\n");