]> git.netwichtig.de Git - user/henk/code/exim.git/blobdiff - src/src/deliver.c
Fix TLS SNI, and add regression test cases
[user/henk/code/exim.git] / src / src / deliver.c
index 68c04877e128dad812380dea81b777da4a83a062..d30b3940202323df39168275926cd214cb88c7a1 100644 (file)
@@ -842,17 +842,17 @@ else
 
 /* confirmation message (SMTP (host_used) and LMTP (driver_name)) */
 
-if ((log_extra_selector & LX_smtp_confirmation) != 0 &&
-    addr->message != NULL &&
-    ((addr->host_used != NULL) || (Ustrcmp(addr->transport->driver_name, "lmtp") == 0)))
+if (log_extra_selector & LX_smtp_confirmation &&
+    addr->message &&
+    (addr->host_used || Ustrcmp(addr->transport->driver_name, "lmtp") == 0))
   {
   int i;
   uschar *p = big_buffer;
   uschar *ss = addr->message;
   *p++ = '\"';
-  for (i = 0; i < 100 && ss[i] != 0; i++)
+  for (i = 0; i < 256 && ss[i] != 0; i++)      /* limit logged amount */
     {
-    if (ss[i] == '\"' || ss[i] == '\\') *p++ = '\\';
+    if (ss[i] == '\"' || ss[i] == '\\') *p++ = '\\'; /* quote \ and " */
     *p++ = ss[i];
     }
   *p++ = '\"';
@@ -863,16 +863,12 @@ if ((log_extra_selector & LX_smtp_confirmation) != 0 &&
 /* Time on queue and actual time taken to deliver */
 
 if ((log_extra_selector & LX_queue_time) != 0)
-  {
   s = string_append(s, &size, &ptr, 2, US" QT=",
-    readconf_printtime(time(NULL) - received_time));
-  }
+    readconf_printtime( (int) ((long)time(NULL) - (long)received_time)) );
 
 if ((log_extra_selector & LX_deliver_time) != 0)
-  {
   s = string_append(s, &size, &ptr, 2, US" DT=",
     readconf_printtime(addr->more_errno));
-  }
 
 /* string_cat() always leaves room for the terminator. Release the
 store we used to build the line after writing it. */
@@ -3019,7 +3015,7 @@ while (!done)
        (void) tls_import_cert(ptr, &addr->ourcert);
       break;
 
-      #ifdef EXPERIMENTAL_OCSP
+      #ifndef DISABLE_OCSP
       case '4':
       addr->ocsp = OCSP_NOT_REQ;
       if (*ptr)
@@ -4167,7 +4163,7 @@ for (delivery_count = 0; addr_remote != NULL; delivery_count++)
          *ptr++ = 0;
         rmt_dlv_checked_write(fd, big_buffer, ptr - big_buffer);
        }
-      # ifdef EXPERIMENTAL_OCSP
+      #ifndef DISABLE_OCSP
       if (addr->ocsp > OCSP_NOT_REQ)
        {
        ptr = big_buffer;
@@ -6497,7 +6493,8 @@ if (addr_senddsn != NULL)
     DEBUG(D_deliver) debug_printf("sending error message to: %s\n", sender_address);
   
     /* build unique id for MIME boundary */
-    snprintf(boundaryStr, 63, "%d-eximdsn-%d", time(NULL), rand());      
+    snprintf(boundaryStr, sizeof(boundaryStr)-1, TIME_T_FMT "-eximdsn-%d",
+      time(NULL), rand());
     DEBUG(D_deliver) debug_printf("DSN: MIME boundary: %s\n", boundaryStr);
   
     if (errors_reply_to != NULL) fprintf(f,"Reply-To: %s\n", errors_reply_to);
@@ -6699,6 +6696,12 @@ while (addr_failed != NULL)
       BOOL to_sender = strcmpic(sender_address, bounce_recipient) == 0;
       int max = (bounce_return_size_limit/DELIVER_IN_BUFFER_SIZE + 1) *
         DELIVER_IN_BUFFER_SIZE;
+#ifdef EXPERIMENTAL_DSN
+      uschar boundaryStr[64];
+      uschar *dsnlimitmsg;
+      uschar *dsnnotifyhdr;
+      int topt;
+#endif
 
       DEBUG(D_deliver)
         debug_printf("sending error message to: %s\n", bounce_recipient);
@@ -6754,8 +6757,7 @@ while (addr_failed != NULL)
 
 #ifdef EXPERIMENTAL_DSN
       /* generate boundary string and output MIME-Headers */
-      uschar boundaryStr[64];
-      snprintf(boundaryStr, 63, "%d-eximdsn-%d", time(NULL), rand());
+      snprintf(boundaryStr, 63, "%l-eximdsn-%d", (long) time(NULL), rand());
       fprintf(f,"Content-Type: multipart/report; report-type=delivery-status; boundary=%s\n", boundaryStr);
       fprintf(f,"MIME-Version: 1.0\n");
 #endif
@@ -7019,9 +7021,10 @@ wording. */
   
       fprintf(f,"\n--%s\n", boundaryStr);
 
-      uschar *dsnlimitmsg = US"X-Exim-DSN-Information: Due to administrative limits only headers are returned";
-      uschar *dsnnotifyhdr = NULL;
-      int topt = topt_add_return_path;
+      dsnlimitmsg = US"X-Exim-DSN-Information: Due to administrative limits only headers are returned";
+      dsnnotifyhdr = NULL;
+      topt = topt_add_return_path;
+
       /* RET=HDRS? top priority */
       if (dsn_ret == dsn_ret_hdrs)
         topt |= topt_no_body;
@@ -7172,7 +7175,7 @@ if (addr_defer == NULL)
 
   if ((log_extra_selector & LX_queue_time_overall) != 0)
     log_write(0, LOG_MAIN, "Completed QT=%s",
-      readconf_printtime(time(NULL) - received_time));
+      readconf_printtime( (int) ((long)time(NULL) - (long)received_time)) );
   else
     log_write(0, LOG_MAIN, "Completed");
 
@@ -7363,6 +7366,9 @@ else if (addr_defer != (address_item *)(+1))
         uschar *wmf_text;
         FILE *wmf = NULL;
         FILE *f = fdopen(fd, "wb");
+#ifdef EXPERIMENTAL_DSN
+       uschar boundaryStr[64];
+#endif
 
         if (warn_message_file != NULL)
           {
@@ -7385,8 +7391,7 @@ else if (addr_defer != (address_item *)(+1))
 
 #ifdef EXPERIMENTAL_DSN
         /* generated boundary string and output MIME-Headers */
-        uschar boundaryStr[64];
-        snprintf(boundaryStr, 63, "%d-eximdsn-%d", time(NULL), rand());
+        snprintf(boundaryStr, 63, "%l-eximdsn-%d", (long) time(NULL), rand());
         fprintf(f,"Content-Type: multipart/report; report-type=delivery-status; boundary=%s\n", boundaryStr);
         fprintf(f,"MIME-Version: 1.0\n");
 #endif