Canonicize IPv6 addresses that are supplied via -bh or -bhc.
[exim.git] / src / src / exim.c
index e22fd23089f4f2be908244f6bd156a7a03a69980..e643cdeec1aa301aa22193972ec8a3ec5236b850 100644 (file)
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/exim.c,v 1.7 2004/11/04 12:19:48 ph10 Exp $ */
+/* $Cambridge: exim/src/src/exim.c,v 1.9 2004/11/18 11:17:33 ph10 Exp $ */
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
@@ -1863,7 +1863,8 @@ for (i = 1; i < argc; i++)
     break;
 
     /* -d: Set debug level (see also -v below) or set the drop_cr option.
-    The latter is now a no-opt, retained for compatibility only. */
+    The latter is now a no-op, retained for compatibility only. If -dd is used, 
+    debugging subprocesses of the daemon is disabled. */
 
     case 'd':
     if (Ustrcmp(argrest, "ropcr") == 0)
@@ -1879,6 +1880,11 @@ for (i = 1; i < argc; i++)
       unsigned int selector = D_default;
       debug_selector = 0;
       debug_file = NULL;
+      if (*argrest == 'd')
+        {
+        debug_daemon = TRUE;
+        argrest++;
+        }
       if (*argrest != 0)
         decode_bits(&selector, NULL, argrest, debug_options,
           debug_options_count, US"debug");
@@ -4088,10 +4094,22 @@ call to find the ident for. */
 
 if (host_checking)
   {
+  int x[4]; 
+  int size;
+    
   sender_ident = NULL;
   if (running_in_test_harness && sender_host_port != 0 &&
       interface_address != NULL && interface_port != 0)
     verify_get_ident(1413);
+    
+  /* In case the given address is a non-canonical IPv6 address, canonicize
+  it. The code works for both IPv4 and IPv6, as it happens. */
+  
+  size = host_aton(sender_host_address, x);
+  sender_host_address = store_get(48);  /* large enough for full IPv6 */
+  (void)host_nmtoa(size, x, -1, sender_host_address, ':');
+
+  /* Now set up for testing */
 
   host_build_sender_fullhost();
   smtp_input = TRUE;