(1) Added $host_lookup_deferred.
authorPhilip Hazel <ph10@hermes.cam.ac.uk>
Tue, 25 Jan 2005 14:16:33 +0000 (14:16 +0000)
committerPhilip Hazel <ph10@hermes.cam.ac.uk>
Tue, 25 Jan 2005 14:16:33 +0000 (14:16 +0000)
(2) Some old tests needed tweaking because of previous changes.
(3) Comment added to EDITME re USE_READLINE.

src/exim_monitor/em_globals.c
src/src/EDITME
src/src/expand.c
src/src/globals.c
src/src/globals.h
src/src/host.c
src/src/spool_in.c
src/src/spool_out.c

index cd6e38d93535e8efaabc3c01307bfa9ff09aac48..44389c195d70ddf2fa39bdd63b53ab0020556866 100644 (file)
@@ -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                    *
 
 /*************************************************
 *                Exim Monitor                    *
@@ -144,6 +144,7 @@ BOOL   fake_reject             = FALSE;
 header_line *header_last       = NULL;
 header_line *header_list       = NULL;
 
 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;
 BOOL    host_lookup_failed     = FALSE;
 uschar *interface_address      = NULL;
 int     interface_port         = 0;
index b70c3272bab2272b131d84f421e6ec4b7b5839b0..93cca9351a083f65a5a98e7424b6986ac38f8e00 100644 (file)
@@ -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         #
 
 ##################################################
 #          The Exim mail transport agent         #
@@ -819,6 +819,10 @@ SYSTEM_ALIASES_FILE=/etc/aliases
 
 # USE_READLINE=yes
 
 
 # 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.
+
 
 
 ###############################################################################
 
 
 ###############################################################################
index 9506d7ae004f4fb3ed031bda292f1f91aeec6f55..49af95fd955013665dd01af7116cf83676ef54fd 100644 (file)
@@ -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    *
 
 /*************************************************
 *     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",                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 },
   { "host_lookup_failed",  vtype_int,         &host_lookup_failed },
   { "inode",               vtype_ino,         &deliver_inode },
   { "interface_address",   vtype_stringptr,   &interface_address },
index 8184758c8a00a4dc4d7ff74b84414209f9fd2892..129923063b00ea0038c03afac18ccd637c5bd320 100644 (file)
@@ -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    *
 
 /*************************************************
 *     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;
 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"";
 BOOL    host_lookup_failed     = FALSE;
 uschar *host_lookup_order      = US"bydns:byaddr";
 uschar *host_lookup_msg        = US"";
index ed67b491ead302560f51afb69402a1716e65ed31..c7be2e0eaa8bf2299089483a8ea7ad1f7f42b1ac 100644 (file)
@@ -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    *
 
 /*************************************************
 *     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_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 */
 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 */
index 0ebdf8b84ab90db0f1910642fe1e6563ddf45113..8cc239b0fe19771027a40e8cb3c6652b5187db1e 100644 (file)
@@ -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    *
 
 /*************************************************
 *     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
 
 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
 connection. */
 
 int
@@ -1355,6 +1357,8 @@ dns_record *rr;
 dns_answer dnsa;
 dns_scan dnss;
 
 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);
 
 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");
   {
   HDEBUG(D_host_lookup)
     debug_printf("Test harness: host name lookup returns DEFER\n");
+  host_lookup_deferred = TRUE;   
   return DEFER;
   }
 
   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");
       {
       HDEBUG(D_host_lookup)
         debug_printf("IP address PTR lookup gave temporary error\n");
+      host_lookup_deferred = TRUE;   
       return DEFER;
       }
     }
       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");
     {
     HDEBUG(D_host_lookup)
       debug_printf("IP address lookup using gethostbyaddr()\n");
-
     rc = host_name_lookup_byaddr();
     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 */
     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)";
     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;
   }
 
   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");
   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
     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_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;
 }
 host_lookup_failed = TRUE;
 return FAIL;
 }
@@ -1664,6 +1672,19 @@ int i, yield, times;
 uschar **addrlist;
 host_item *last = NULL;
 BOOL temp_error = FALSE;
 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
 
 /* 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
 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,
   #ifndef STAND_ALONE
   if (dns_ipv4_lookup != NULL &&
         match_isinlist(host->name, &dns_ipv4_lookup, 0, NULL, NULL, MCL_DOMAIN,
index aca1b131b890dc96a3e76724dc9831d1671ded77..0e4297114df97548ca202387c1a3b4dac506f29b 100644 (file)
@@ -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    *
 
 /*************************************************
 *     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;
 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;
 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 (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)
   else if (Ustrcmp(big_buffer, "-host_lookup_failed") == 0)
     host_lookup_failed = TRUE;
   else if (Ustrncmp(big_buffer, "-body_linecount", 15) == 0)
index a157e84ba789c4bfe363e4de073ba81fbb8c5fb2..7e74a2619f5393b49bad4dabf7c45e753be6a65d 100644 (file)
@@ -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    *
 
 /*************************************************
 *     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 (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");
 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");