]> git.netwichtig.de Git - user/henk/code/exim.git/blobdiff - src/src/deliver.c
Logging: make cipher info available for continued-TLS connection deliveries
[user/henk/code/exim.git] / src / src / deliver.c
index c416ebf3fd78f79e11a864c8ae50eeb28fc82711..ccc32667e7ed3a57039eb81c45a54275dda88473 100644 (file)
@@ -671,7 +671,7 @@ address_item *aa;
 while (addr->parent)
   {
   addr = addr->parent;
-  if ((addr->child_count -= 1) > 0) return;   /* Incomplete parent */
+  if (--addr->child_count > 0) return;   /* Incomplete parent */
   address_done(addr, now);
 
   /* Log the completion of all descendents only when there is no ancestor with
@@ -2975,13 +2975,13 @@ while (addr_local)
        addr3 = store_get(sizeof(address_item));
        *addr3 = *addr2;
        addr3->next = NULL;
-       addr3->shadow_message = (uschar *) &(addr2->shadow_message);
+       addr3->shadow_message = US &addr2->shadow_message;
        addr3->transport = stp;
        addr3->transport_return = DEFER;
        addr3->return_filename = NULL;
        addr3->return_file = -1;
        *last = addr3;
-       last = &(addr3->next);
+       last = &addr3->next;
        }
 
     /* If we found any addresses to shadow, run the delivery, and stick any
@@ -3396,7 +3396,7 @@ while (!done)
 
     /* Cut out any "delete" items on the list. */
 
-    for (rp = &(addr->retries); (r = *rp); rp = &r->next)
+    for (rp = &addr->retries; (r = *rp); rp = &r->next)
       if (Ustrcmp(r->key, ptr+1) == 0)           /* Found item with same key */
         {
         if ((r->flags & rf_delete) == 0) break;  /* It was not "delete" */
@@ -3408,7 +3408,7 @@ while (!done)
     /* We want to add a delete item only if there is no non-delete item;
     however we still have to step ptr through the data. */
 
-    if (!r || (*ptr & rf_delete) == 0)
+    if (!r || !(*ptr & rf_delete))
       {
       r = store_get(sizeof(retry_item));
       r->next = addr->retries;
@@ -3458,36 +3458,34 @@ while (!done)
     switch (subid)
       {
       case '1':
-      addr->cipher = NULL;
-      addr->peerdn = NULL;
-
-      if (*ptr)
-       addr->cipher = string_copy(ptr);
-      while (*ptr++);
-      if (*ptr)
-       addr->peerdn = string_copy(ptr);
-      break;
+       addr->cipher = NULL;
+       addr->peerdn = NULL;
+
+       if (*ptr)
+         addr->cipher = string_copy(ptr);
+       while (*ptr++);
+       if (*ptr)
+         addr->peerdn = string_copy(ptr);
+       break;
 
       case '2':
-      if (*ptr)
-       (void) tls_import_cert(ptr, &addr->peercert);
-      else
-       addr->peercert = NULL;
-      break;
+       if (*ptr)
+         (void) tls_import_cert(ptr, &addr->peercert);
+       else
+         addr->peercert = NULL;
+       break;
 
       case '3':
-      if (*ptr)
-       (void) tls_import_cert(ptr, &addr->ourcert);
-      else
-       addr->ourcert = NULL;
-      break;
+       if (*ptr)
+         (void) tls_import_cert(ptr, &addr->ourcert);
+       else
+         addr->ourcert = NULL;
+       break;
 
 # ifndef DISABLE_OCSP
       case '4':
-      addr->ocsp = OCSP_NOT_REQ;
-      if (*ptr)
-       addr->ocsp = *ptr - '0';
-      break;
+       addr->ocsp = *ptr ? *ptr - '0' : OCSP_NOT_REQ;
+       break;
 # endif
       }
     while (*ptr++);
@@ -4713,13 +4711,17 @@ for (delivery_count = 0; addr_remote; delivery_count++)
         if (!addr->peerdn)
          *ptr++ = 0;
        else
-          {
-          ptr += sprintf(CS ptr, "%.512s", addr->peerdn);
-          ptr++;
-          }
+          ptr += sprintf(CS ptr, "%.512s", addr->peerdn) + 1;
 
         rmt_dlv_checked_write(fd, 'X', '1', big_buffer, ptr - big_buffer);
         }
+      else if (continue_proxy_cipher)
+       {
+        ptr = big_buffer + sprintf(CS big_buffer, "%.128s", continue_proxy_cipher) + 1;
+       *ptr++ = 0;
+        rmt_dlv_checked_write(fd, 'X', '1', big_buffer, ptr - big_buffer);
+       }
+
       if (addr->peercert)
        {
         ptr = big_buffer;
@@ -5031,6 +5033,7 @@ if (percent_hack_domains)
     address_item *new_parent = store_get(sizeof(address_item));
     *new_parent = *addr;
     addr->parent = new_parent;
+    new_parent->child_count = 1;
     addr->address = new_address;
     addr->unique = string_copy(new_address);
     addr->domain = deliver_domain;
@@ -5901,9 +5904,9 @@ else if (system_filter && process_recipients != RECIP_FAIL_TIMEOUT)
 
     while (p)
       {
-      if (parent->child_count == SHRT_MAX)
+      if (parent->child_count == USHRT_MAX)
         log_write(0, LOG_MAIN|LOG_PANIC_DIE, "system filter generated more "
-          "than %d delivery addresses", SHRT_MAX);
+          "than %d delivery addresses", USHRT_MAX);
       parent->child_count++;
       p->parent = parent;
 
@@ -7141,10 +7144,9 @@ for (addr_dsntmp = addr_succeed; addr_dsntmp; addr_dsntmp = addr_dsntmp->next)
      )
     {
     /* copy and relink address_item and send report with all of them at once later */
-    address_item *addr_next;
-    addr_next = addr_senddsn;
+    address_item * addr_next = addr_senddsn;
     addr_senddsn = store_get(sizeof(address_item));
-    memcpy(addr_senddsn, addr_dsntmp, sizeof(address_item));
+    *addr_senddsn = *addr_dsntmp;
     addr_senddsn->next = addr_next;
     }
   else