Show command line arguments in debugging output, even without
[exim.git] / src / src / transport.c
index 1bdb677464f8458262211489778b02fd59ade7e2..d4f8930fd74eccc4953c0238a5e1145e7b1432aa 100644 (file)
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/transport.c,v 1.5 2005/03/08 15:32:02 tom Exp $ */
+/* $Cambridge: exim/src/src/transport.c,v 1.7 2005/03/22 16:44:04 ph10 Exp $ */
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
@@ -797,7 +797,10 @@ if ((options & topt_no_headers) == 0)
   same alias might share some of them) but we want to output them in the
   opposite order. This is a bit tedious, but there shouldn't be very many
   of them. We just walk the list twice, reversing the pointers each time,
-  but on the second time, write out the items. */
+  but on the second time, write out the items.
+
+  Headers added to an address by a router are guaranteed to end with a newline.
+  */
 
   if (addr != NULL)
     {
@@ -824,7 +827,8 @@ if ((options & topt_no_headers) == 0)
   /* If a string containing additional headers exists, expand it and write
   out the result. This is done last so that if it (deliberately or accidentally)
   isn't in header format, it won't mess up any other headers. An empty string
-  or a forced expansion failure are noops. */
+  or a forced expansion failure are noops. An added header string from a
+  transport may not end with a newline; add one if it does not. */
 
   if (add_headers != NULL)
     {
@@ -846,7 +850,11 @@ if ((options & topt_no_headers) == 0)
         if (s[len-1] != '\n' && !write_chunk(fd, US"\n", 1, use_crlf))
           return FALSE;
         DEBUG(D_transport)
-          debug_printf("added header line(s):\n%s---\n", s);
+          {
+          debug_printf("added header line(s):\n%s", s);
+          if (s[len-1] != '\n') debug_printf("\n");
+          debug_printf("---\n");
+          }
         }
       }
     }
@@ -920,7 +928,7 @@ return (len = chunk_ptr - deliver_out_buffer) <= 0 ||
    signed message down the original fd (or TLS fd).
 
 Arguments:     as for internal_transport_write_message() above, with additional
-               arguments: 
+               arguments:
                uschar *dk_private_key         The private key to use (filename or plain data)
                uschar *dk_domain              Override domain (normally NULL)
                uschar *dk_selector            The selector to use.
@@ -948,7 +956,7 @@ dk_transport_write_message(address_item *addr, int fd, int options,
   int sread = 0;
   int wwritten = 0;
   uschar *dk_signature = NULL;
-  
+
   snprintf(CS dk_spool_name, 256, "%s/input/%s/%s-K",
           spool_directory, message_subdir, message_id);
   dk_fd = Uopen(dk_spool_name, O_RDWR|O_CREAT|O_EXCL, SPOOL_MODE);
@@ -959,13 +967,13 @@ dk_transport_write_message(address_item *addr, int fd, int options,
     save_errno = errno;
     goto CLEANUP;
     }
-  
+
   /* Call original function */
   rc = transport_write_message(addr, dk_fd, options,
     size_limit, add_headers, remove_headers,
     check_string, escape_string, rewrite_rules,
     rewrite_existflags);
-  
+
   /* Save error state. We must clean up before returning. */
   if (!rc)
     {
@@ -980,7 +988,7 @@ dk_transport_write_message(address_item *addr, int fd, int options,
                               dk_domain,
                               dk_selector,
                               dk_canon);
-    
+
   if (dk_signature != NULL)
     {
     /* Send the signature first */
@@ -1017,9 +1025,9 @@ dk_transport_write_message(address_item *addr, int fd, int options,
       }
     }
 
-  /* Rewind file and send it down the original fd. */ 
+  /* Rewind file and send it down the original fd. */
   lseek(dk_fd, 0, SEEK_SET);
-  
+
   while((sread = read(dk_fd,sbuf,2048)) > 0)
     {
     char *p = sbuf;
@@ -1044,7 +1052,7 @@ dk_transport_write_message(address_item *addr, int fd, int options,
       goto DK_WRITE;
       }
     }
-    
+
   if (sread == -1)
     {
     save_errno = errno;