Patch imported from bugzilla 1031. Axel Rau.
[users/jgh/exim.git] / src / src / deliver.c
index d4ea2d868c2d45916a1048985c982f432b9107d6..1c3c4bafd392b002789fa57d625e0d2c8c4845e5 100644 (file)
@@ -885,6 +885,9 @@ if (result == OK)
   if(addr->p.srs_sender)
     s = string_append(s, &size, &ptr, 3, US" SRS=<", addr->p.srs_sender, US">");
   #endif
   if(addr->p.srs_sender)
     s = string_append(s, &size, &ptr, 3, US" SRS=<", addr->p.srs_sender, US">");
   #endif
+  #ifdef EXPERIMENTAL_DBL
+  dbl_delivery_ip = NULL;      /* presume no successful remote delivery */
+  #endif
 
   /* You might think that the return path must always be set for a successful
   delivery; indeed, I did for some time, until this statement crashed. The case
 
   /* You might think that the return path must always be set for a successful
   delivery; indeed, I did for some time, until this statement crashed. The case
@@ -930,8 +933,15 @@ if (result == OK)
           addr->host_used->port));
       if (continue_sequence > 1)
         s = string_cat(s, &size, &ptr, US"*", 1);
           addr->host_used->port));
       if (continue_sequence > 1)
         s = string_cat(s, &size, &ptr, US"*", 1);
+      #ifdef EXPERIMENTAL_DBL
+      dbl_delivery_ip = string_copy(addr->host_used->address);
+      dbl_delivery_port = addr->host_used->port;
+      dbl_delivery_fqdn = string_copy(addr->host_used->name);
+      dbl_delivery_local_part = string_copy(addr->local_part);
+      dbl_delivery_domain = string_copy(addr->domain);
+      dbl_delivery_confirmation = string_copy(addr->message);
+      #endif
       }
       }
-
     #ifdef SUPPORT_TLS
     if ((log_extra_selector & LX_tls_cipher) != 0 && addr->cipher != NULL)
       s = string_append(s, &size, &ptr, 2, US" X=", addr->cipher);
     #ifdef SUPPORT_TLS
     if ((log_extra_selector & LX_tls_cipher) != 0 && addr->cipher != NULL)
       s = string_append(s, &size, &ptr, 2, US" X=", addr->cipher);
@@ -981,6 +991,14 @@ if (result == OK)
 
   s[ptr] = 0;
   log_write(0, LOG_MAIN, "%s", s);
 
   s[ptr] = 0;
   log_write(0, LOG_MAIN, "%s", s);
+  #ifdef EXPERIMENTAL_DBL
+  DEBUG(D_deliver)
+    {
+    debug_printf("  DBL(Delivery): dbl_delivery_query=|%s| dbl_delivery_IP=%s\n", dbl_delivery_query, dbl_delivery_ip);
+       }
+  if (dbl_delivery_ip != NULL && dbl_delivery_query != NULL)
+       expand_string(dbl_delivery_query);
+  #endif
   store_reset(reset_point);
   }
 
   store_reset(reset_point);
   }