SOURCES: exim_462_dsn_1_2.patch (NEW) - DSN support for exim

arekm arekm at pld-linux.org
Thu May 18 08:42:15 CEST 2006


Author: arekm                        Date: Thu May 18 06:42:15 2006 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- DSN support for exim

---- Files affected:
SOURCES:
   exim_462_dsn_1_2.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/exim_462_dsn_1_2.patch
diff -u /dev/null SOURCES/exim_462_dsn_1_2.patch:1.1
--- /dev/null	Thu May 18 08:42:15 2006
+++ SOURCES/exim_462_dsn_1_2.patch	Thu May 18 08:42:10 2006
@@ -0,0 +1,1156 @@
+diff -urN exim-4.62-orig/README.DSN exim-4.62-dsn/README.DSN
+--- exim-4.62-orig/README.DSN	1970-01-01 01:00:00.000000000 +0100
++++ exim-4.62-dsn/README.DSN	2006-05-17 12:59:03.000000000 +0100
+@@ -0,0 +1,104 @@
++Exim DSN Patch (4.60)
++---------------------
++
++This patch is free software; you can redistribute it and/or modify
++it under the terms of the GNU General Public License as published by
++the Free Software Foundation; either version 2 of the License, or
++(at your option) any later version.
++
++This patch is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++GNU General Public License for more details.
++
++You should have received a copy of the GNU General Public License
++along with this patch; if not, write to the Free Software
++Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
++
++Install
++-------
++cd into the source tree for a vanilla exim
++
++patch -p1 </path/to/patch/file.patch
++
++Example :-
++[root at linuxbuild exim-4.60-test]# patch -p1 <../exim.dsn.patch.460
++
++Expected Output :-
++patching file README.DSN
++patching file src/config.h.defaults
++patching file src/deliver.c
++patching file src/exim.c
++patching file src/exim.h
++patching file src/globals.c
++patching file src/globals.h
++patching file src/local_scan.h
++patching file src/macros.h
++patching file src/readconf.c
++patching file src/route.c
++patching file src/smtp_in.c
++patching file src/spool_in.c
++patching file src/spool_out.c
++patching file src/structs.h
++patching file src/transport.c
++patching file src/transports/smtp.c
++
++
++This patch can be included / excluded from the compilation by use of the #define SUPPORT_DSN
++which gets added into src/config.h.defaults & src/EDITME by the patch.
++
++Use
++---
++
++The facility (once compiled in) can be turned on for a particular router via the
++dsn_process directive Eg :-
++
++dest_delivery_int:
++  driver = manualroute
++  domains = +relay_to_domains
++  condition = ${if eq {${lc:$sender_address_domain}}\
++                                 {domain.com}\
++                                 {yes}{no}\
++                       }
++  dsn_process
++  hide route_data = ${lc:${extract{mailHost}{$address_data}{$value}{}}}
++  transport = remote_smtp
++
++Exim will produce 1 of 2 DSN's back to the originator, or pass on the DSN request.
++The 2 DSN's will either contain (relayed via non "Remote SMTP" router) or
++(relayed to non-DSN-aware mailer) depending on if the delivery was VIA an SMTP
++transport or not.
++
++
++Credits
++-------
++
++The original work for the patch was done by Philip Hazel in Exim 3
++
++The extract was taken and re-applied to Exim 4 by the following :-
++Phil Bingham   (phil.bingham at cwipapps.net)
++Steve Falla    (steve.falla at cwipapps.net)
++Ray Edah       (ray.edah at cwipapps.net)
++Andrew Johnson (andrew.johnson at cwippaps.net)
++Adrian Hungate (adrian.hungate at cwipapps.net)
++
++Contributions
++-------------
++Andrey J. Melnikoff (TEMHOTA) (temnota at kmv.ru) 
++
++
++ChangeLog
++---------
++
++14-Apr-2006 : Changed subject to "Delivery Status Notification"
++
++17-May-2006 : debug_printf in spool-in.c were not wrapped with #ifndef COMPILE_UTILITY
++              thanks to Andrey J. Melnikoff for this information
++
++
++
++Support for this patch (limited though it is) will only be provided through the SourceForge
++project page (http://sourceforge.net/projects/eximdsn/)
++
++--
++Andrew Johnson Cable & Wireless
+diff -urN exim-4.62-orig/src/config.h.defaults exim-4.62-dsn/src/config.h.defaults
+--- exim-4.62-orig/src/config.h.defaults	2006-04-28 11:32:22.000000000 +0100
++++ exim-4.62-dsn/src/config.h.defaults	2006-05-17 12:59:03.000000000 +0100
+@@ -123,6 +123,7 @@
+ #define SUPPORT_MOVE_FROZEN_MESSAGES
+ #define SUPPORT_PAM
+ #define SUPPORT_TLS
++#define SUPPORT_DSN
+ #define SUPPORT_TRANSLATE_IP_ADDRESS
+ 
+ #define SYSLOG_LOG_PID
+diff -urN exim-4.62-orig/src/deliver.c exim-4.62-dsn/src/deliver.c
+--- exim-4.62-orig/src/deliver.c	2006-04-28 11:32:22.000000000 +0100
++++ exim-4.62-dsn/src/deliver.c	2006-05-17 12:59:03.000000000 +0100
+@@ -65,6 +65,9 @@
+ static address_item *addr_remote = NULL;
+ static address_item *addr_route = NULL;
+ static address_item *addr_succeed = NULL;
++#ifdef SUPPORT_DSN
++static address_item *addr_dsntmp = NULL;
++#endif
+ 
+ static FILE *message_log = NULL;
+ static BOOL update_spool;
+@@ -2859,6 +2862,15 @@
+     break;
+     #endif
+ 
++    #ifdef SUPPORT_DSN
++    case 'D':
++    if (addr == NULL) break;
++    addr->dsn_aware = (*ptr)? string_copy(ptr) : string_copy(" ");
++    while (*ptr++);
++    DEBUG(D_deliver) debug_printf("DSN read: addr->dsn_aware = %s\n", addr->dsn_aware);
++    break;
++    #endif
++
+     case 'A':
+     if (addr == NULL)
+       {
+@@ -3928,6 +3940,15 @@
+         }
+       #endif
+ 
++      #ifdef SUPPORT_DSN
++      if (addr->dsn_aware == NULL)
++        addr->dsn_aware = string_copy(" ");
++      DEBUG(D_deliver) debug_printf("DSN write: addr->dsn_aware = %s\n", addr->dsn_aware);     
++      sprintf(big_buffer, "D%s", addr->dsn_aware);
++      DEBUG(D_deliver) debug_printf("DSN write: big_buffer = %s (%d)\n", big_buffer, strlen(big_buffer)+1);
++      write(fd, big_buffer, strlen(big_buffer)+1);
++      #endif
++
+       /* Retry information: for most success cases this will be null. */
+ 
+       for (r = addr->retries; r != NULL; r = r->next)
+@@ -5068,6 +5089,14 @@
+       if (r->pno >= 0)
+         new->onetime_parent = recipients_list[r->pno].address;
+ 
++      #ifdef SUPPORT_DSN
++      /* If DSN support is enabled, set the dsn flags and the original receipt 
++         to be passed on to other DSN enabled MTAs */
++      new->dsn_flags = r->dsn_flags & rf_dsnflags;
++      new->dsn_orcpt = r->orcpt;
++      debug_printf("DSN (deliver): orcpt: %s  flags: %d\n", new->dsn_orcpt, new->dsn_flags);	 
++      #endif
++
+       switch (process_recipients)
+         {
+         /* RECIP_DEFER is set when a system filter freezes a message. */
+@@ -5992,6 +6021,12 @@
+     regex_must_compile(US"\\n250[\\s\\-]STARTTLS(\\s|\\n|$)", FALSE, TRUE);
+   #endif
+ 
++  #ifdef SUPPORT_DSN
++  /* Set the regex to check for DSN support on remote MTA */
++  if (regex_DSN == NULL) regex_DSN  =
++    regex_must_compile(US"\\n250[\\s\\-]DSN(\\s|\\n|$)", FALSE, TRUE);
++  #endif
++
+   /* Now sort the addresses if required, and do the deliveries. The yield of
+   do_remote_deliveries is FALSE when mua_wrapper is set and all addresses
+   cannot be delivered in one transaction. */
+@@ -6096,6 +6131,179 @@
+ 
+ else if (!dont_deliver) retry_update(&addr_defer, &addr_failed, &addr_succeed);
+ 
++#ifdef SUPPORT_DSN
++/* ********** philb - Send DSN for successful messages */
++
++addr_dsntmp = addr_succeed;
++
++while(addr_dsntmp != NULL)
++{
++   BOOL dsn_sendmessage = FALSE;
++   uschar dsnmsgbuf[4096];
++ 
++   DEBUG(D_deliver)
++      debug_printf("DSN: processing router : %s\n", addr_dsntmp->router->name);
++
++   DEBUG(D_deliver)
++      debug_printf("DSN: processing successful delivery address: %s\n", addr_dsntmp->address);
++  
++   if (testflag(addr_dsntmp, af_ignore_error))
++   {   
++      DEBUG(D_deliver)
++         debug_printf("DSN: Ignore error for: %s\n", addr_dsntmp->address);
++   }
++   else
++   {
++     DEBUG(D_deliver) debug_printf("DSN: Checking Flag\n");	 
++     if (addr_dsntmp->dsn_aware == NULL) {
++         DEBUG(D_deliver) debug_printf("DSN: dsn_aware was NULL, setting to space at %s %d\n", __FILE__, __LINE__);
++         addr_dsntmp->dsn_aware = string_copy(" ");
++     }
++     DEBUG(D_deliver) debug_printf("DSN: Sender_address: %s\n", sender_address);	 
++     DEBUG(D_deliver) debug_printf("DSN: orcpt: %s  flags: %d\n", addr_dsntmp->dsn_orcpt, addr_dsntmp->dsn_flags);	 
++     DEBUG(D_deliver) debug_printf("DSN: envid: %s  ret: %d\n", dsn_envid, dsn_ret);	 
++     DEBUG(D_deliver) debug_printf("DSN: Remote SMTP server supports DSN: %s\n", addr_dsntmp->dsn_aware);	 
++      	
++      /* Process the flags */
++     if((addr_dsntmp->dsn_flags & rf_dsnflags) != 0) 
++     {
++         /* We've got at least one flag set */
++
++	 /* set flag so we don't send bounces */
++	 setflag(addr_dsntmp, af_ignore_error);
++
++	 if((addr_dsntmp->dsn_flags & rf_notify_never) != 0)
++         {
++            DEBUG(D_deliver) debug_printf("DSN: NEVER FLAG\n");
++
++            /* nothing to do here */
++         }
++         
++         if((addr_dsntmp->dsn_flags & rf_notify_success) != 0)
++         {
++            DEBUG(D_deliver) debug_printf("DSN: SUCCESS FLAG\n");
++
++            dsn_sendmessage = TRUE;
++         }
++
++         if((addr_dsntmp->dsn_flags & rf_notify_failure) != 0)
++         {
++            DEBUG(D_deliver) debug_printf("DSN: FAILURE FLAG\n");
++
++            /* allow bounce messages */
++            clearflag(addr_dsntmp, af_ignore_error);
++         }
++
++         if((addr_dsntmp->dsn_flags & rf_notify_delay) != 0)
++         {
++            DEBUG(D_deliver) debug_printf("DSN: DELAY FLAG\n");
++
++            /* hmm, what to do here? */
++         }
++      }
++
++      if ((addr_dsntmp->dsn_aware != 0) && (addr_dsntmp->dsn_aware[0] != 'Y') && (dsn_sendmessage == TRUE) && (addr_dsntmp->router->dsn_process == TRUE))
++      {
++         pid_t pid;
++         int fd;
++      
++	 /* remote MTA does not support DSN, so we need to send message */
++	 
++	 /* create exim process to send message */ 	 
++	 pid = child_open_exim(&fd);
++
++         DEBUG(D_deliver) debug_printf("DSN: child_open_exim returns: %d\n", pid);
++	 
++	 if (pid < 0)  /* Creation of child failed */
++	 {
++	    log_write(0, LOG_MAIN|LOG_PANIC_DIE, "Process %d (parent %d) failed to "
++               "create child process to send failure message: %s", getpid(),
++               getppid(), strerror(errno));
++
++             DEBUG(D_deliver) debug_printf("DSN: child_open_exim failed\n");
++
++         }	 
++	 else  /* Creation of child succeeded */
++	 {
++           FILE *f = fdopen(fd, "wb");
++	   int topt = topt_add_return_path;
++	   uschar boundaryStr[64];
++	   
++           DEBUG(D_deliver) debug_printf("sending error message to: %s\n", sender_address);
++      
++           /* build unique id for MIME boundary */
++           snprintf(boundaryStr, 63, "%d-cwdsn-%d", pid, rand());      
++           DEBUG(D_deliver) debug_printf("DSN: MIME boundary: %s\n", boundaryStr);
++      
++           /* if the sender doesn't want the whole message returned, don't send the body */
++           if (dsn_ret != dsn_ret_full) topt |= topt_no_body;
++      
++           if (errors_reply_to != NULL) fprintf(f,"Reply-To: %s\n", errors_reply_to);
++     
++	   fprintf(f,"Auto-Submitted: auto-generated\n");
++	   fprintf(f,"From: Mail Delivery System <Mailer-Daemon@%s>\n", qualify_domain_sender);
++	   fprintf(f,"To: %s\n", sender_address);
++	   fprintf(f,"Subject: Delivery Status Notification\n");
++	   fprintf(f,"Content-Type: multipart/report; report-type=delivery-status; boundary=%s\n", boundaryStr);
++           fprintf(f,"MIME-Version: 1.0\n\n");
++
++           fprintf(f,"--%s\n", boundaryStr);
++	   fprintf(f,"Content-type: text/plain; charset=us-ascii\n\n");
++	   
++	   fprintf(f,"This message was created automatically by mail delivery software.\n");
++	   fprintf(f," ----- The following addresses had successful delivery notifications -----\n");
++/* AH: added specific message for non "Remote SMTP" situations */
++           if (addr_dsntmp->dsn_aware[0] == 'N') {
++	     fprintf(f,"<%s> (relayed to non-DSN-aware mailer)\n\n", addr_dsntmp->address);
++           } else {
++	     fprintf(f,"<%s> (relayed via non \"Remote SMTP\" router)\n\n", addr_dsntmp->address);
++           }
++
++	   fprintf(f,"--%s\n", boundaryStr);
++	   fprintf(f,"Content-type: message/delivery-status\n\n");
++	   
++           if (dsn_envid) { /* Test for NULL added by GC */
++               fprintf(f,"Original-Envelope-Id: %s\n", dsn_envid);
++           }
++	   fprintf(f,"Reporting-MTA: dns; %s\n", qualify_domain_sender);
++           if (addr_dsntmp->dsn_orcpt) { /* Test for NULL added by GC */
++               fprintf(f,"Original-Recipient: %s\n", addr_dsntmp->dsn_orcpt);
++           }
++	   fprintf(f,"Action: delivered\n\n");
++	   
++	   fprintf(f,"--%s\n", boundaryStr);
++	   fprintf(f,"Content-type: message/rfc822\n\n");
++	   
++	   fflush(f);
++	   transport_filter_argv = NULL;   /* Just in case */
++           return_path = sender_address;   /* In case not previously set */
++	   
++	   /* Write the original email out */
++	   transport_write_message(NULL, fileno(f), topt, 2048, NULL, NULL, NULL, NULL, NULL, 0);	   
++	   fflush(f);
++	      
++	   fprintf(f,"\n");	   
++	   fprintf(f,"--%s--\n", boundaryStr);
++	   
++	   fflush(f);	   	   
++	   fclose(f);
++           rc = child_close(pid, 0);     /* Waits for child to close, no timeout */
++	}
++      }
++      else
++      {  if (addr_dsntmp->router->dsn_process == TRUE)
++	 DEBUG(D_deliver) debug_printf("DSN: *** NOT SENDING DSN SUCCESS Message ***\n"); 
++         if (addr_dsntmp->router->dsn_process == FALSE)
++	 DEBUG(D_deliver) debug_printf("DSN: *** NOT SENDING DSN SUCCESS Message (gagged) ***\n"); 
++      }
++   }
++
++   addr_dsntmp = addr_dsntmp->next;
++}
++
++/* ********** philb - end of mod */
++#endif
++
+ /* If any addresses failed, we must send a message to somebody, unless
+ af_ignore_error is set, in which case no action is taken. It is possible for
+ several messages to get sent if there are addresses with different
+diff -urN exim-4.62-orig/src/exim.c exim-4.62-dsn/src/exim.c
+--- exim-4.62-orig/src/exim.c	2006-04-28 11:32:22.000000000 +0100
++++ exim-4.62-dsn/src/exim.c	2006-05-17 13:12:24.000000000 +0100
+@@ -920,6 +920,9 @@
+ #ifdef EXPERIMENTAL_DOMAINKEYS
+   fprintf(f, " Experimental_DomainKeys");
+ #endif
++#ifdef SUPPORT_DSN
++  fprintf(f, " C&W_DSN_1.2");
++#endif
+ fprintf(f, "\n");
+ 
+ fprintf(f, "Lookups:");
+@@ -2184,6 +2187,16 @@
+       break;
+       }
+ 
++    #ifdef SUPPORT_DSN
++    /* -MCD: set the smtp_use_dsn flag; this indicates that the host
++       that exim is connected to supports the esmtp extension DSN */
++    else if (strcmp(argrest, "CD") == 0)
++      {
++      smtp_use_dsn = TRUE;
++      break;
++      }
++    #endif
++
+     /* -MCP: set the smtp_use_pipelining flag; this is useful only when
+     it preceded -MC (see above) */
+ 
+diff -urN exim-4.62-orig/src/globals.c exim-4.62-dsn/src/globals.c
+--- exim-4.62-orig/src/globals.c	2006-04-28 11:32:22.000000000 +0100
++++ exim-4.62-dsn/src/globals.c	2006-05-17 12:59:03.000000000 +0100
+@@ -121,6 +121,13 @@
+ uschar *tls_verify_hosts       = NULL;
+ #endif
+ 
++#ifdef SUPPORT_DSN
++BOOL   dsn                    = TRUE;
++uschar  *dsn_envid            = NULL;
++int    dsn_ret                = 0;
++const pcre  *regex_DSN        = NULL;
++BOOL   smtp_use_dsn           = FALSE;
++#endif
+ 
+ /* Input-reading functions for messages, so we can use special ones for
+ incoming TCP/IP. The defaults use stdin. We never need these for any
+@@ -267,6 +274,11 @@
+   NULL,                 /* cipher */
+   NULL,                 /* peerdn */
+   #endif
++  #ifdef SUPPORT_DSN
++  NULL,                 /* dsn_orcpt */
++  0,                    /* dsn_flags */
++  NULL,                 /* dsn_aware */
++  #endif
+   (uid_t)(-1),          /* uid */
+   (gid_t)(-1),          /* gid */
+   0,                    /* flags */
+@@ -949,6 +961,9 @@
+     TRUE,                      /* verify_sender */
+     FALSE,                     /* uid_set */
+     FALSE,                     /* unseen */
++#ifdef SUPPORT_DSN
++    FALSE,                     /* dsn_process */
++#endif
+ 
+     self_freeze,               /* self_code */
+     (uid_t)(-1),               /* uid */
+@@ -958,6 +973,7 @@
+     NULL,                      /* transport instance */
+     NULL,                      /* pass_router */
+     NULL                       /* redirect_router */
++
+ };
+ 
+ ip_address_item *running_interfaces = NULL;
+diff -urN exim-4.62-orig/src/globals.h exim-4.62-dsn/src/globals.h
+--- exim-4.62-orig/src/globals.h	2006-04-28 11:32:22.000000000 +0100
++++ exim-4.62-dsn/src/globals.h	2006-05-17 12:59:03.000000000 +0100
+@@ -85,6 +85,13 @@
+ extern uschar *tls_verify_hosts;       /* Mandatory client verification */
+ #endif
+ 
++#ifdef SUPPORT_DSN
++extern BOOL   dsn;                    /* FALSE if DSN not to be used */
++extern uschar  *dsn_envid;            /* DSN envid string */
++extern int    dsn_ret;                /* DSN ret type*/
++extern const pcre  *regex_DSN;        /* For recognizing DSN settings */
++extern BOOL   smtp_use_dsn;           /* Global for passed connections */
++#endif
+ 
+ /* Input-reading functions for messages, so we can use special ones for
+ incoming TCP/IP. */
+diff -urN exim-4.62-orig/src/local_scan.h exim-4.62-dsn/src/local_scan.h
+--- exim-4.62-orig/src/local_scan.h	2006-04-28 11:32:22.000000000 +0100
++++ exim-4.62-dsn/src/local_scan.h	2006-05-17 12:59:03.000000000 +0100
+@@ -123,9 +123,13 @@
+ field is always NULL except for one_time aliases that had errors_to on the
+ routers that generated them. */
+ 
++/* Added the dsn attributes orcpt and dsn_flags for DSN support*/
++
+ typedef struct recipient_item {
+   uschar *address;              /* the recipient address */
+   int     pno;                  /* parent number for "one_time" alias, or -1 */
++  uschar *orcpt;                /* DSN orcpt */
++  int    dsn_flags;             /* DSN flags */
+   uschar *errors_to;            /* the errors_to address or NULL */
+ #ifdef EXPERIMENTAL_BRIGHTMAIL
+   uschar *bmi_optin;
+diff -urN exim-4.62-orig/src/macros.h exim-4.62-dsn/src/macros.h
+--- exim-4.62-orig/src/macros.h	2006-04-28 11:32:22.000000000 +0100
++++ exim-4.62-dsn/src/macros.h	2006-05-17 12:59:03.000000000 +0100
+@@ -733,6 +733,22 @@
+ #define topt_no_body            0x040  /* Omit body */
+ #define topt_escape_headers     0x080  /* Apply escape check to headers */
+ 
++/* Flags for recipient_block, used in DSN support */
++
++#define rf_onetime              0x01  /* A one-time alias */
++#define rf_notify_never         0x02  /* NOTIFY= settings */
++#define rf_notify_success       0x04
++#define rf_notify_failure       0x08
++#define rf_notify_delay         0x10
++
++#define rf_dsnflags  (rf_notify_never | rf_notify_success | \
++                      rf_notify_failure | rf_notify_delay)
++
++/* DSN RET types */
++
++#define dsn_ret_full            1
++#define dsn_ret_hdrs            2
++
+ /* Codes for the host_find_failed option. */
+ 
+ #define hff_freeze   0
+diff -urN exim-4.62-orig/src/readconf.c exim-4.62-dsn/src/readconf.c
+--- exim-4.62-orig/src/readconf.c	2006-04-28 11:32:22.000000000 +0100
++++ exim-4.62-dsn/src/readconf.c	2006-05-17 12:59:03.000000000 +0100
+@@ -202,6 +202,9 @@
+   { "dns_ipv4_lookup",          opt_stringptr,   &dns_ipv4_lookup },
+   { "dns_retrans",              opt_time,        &dns_retrans },
+   { "dns_retry",                opt_int,         &dns_retry },
++#ifdef SUPPORT_DSN
++  { "dsn",                      opt_bool,        &dsn },
++#endif
+  /* This option is now a no-op, retained for compability */
+   { "drop_cr",                  opt_bool,        &drop_cr },
+ /*********************************************************/
+diff -urN exim-4.62-orig/src/receive.c exim-4.62-dsn/src/receive.c
+--- exim-4.62-orig/src/receive.c	2006-04-28 11:32:22.000000000 +0100
++++ exim-4.62-dsn/src/receive.c	2006-05-17 12:59:03.000000000 +0100
+@@ -474,6 +474,8 @@
+     memcpy(recipients_list, oldlist, oldmax * sizeof(recipient_item));
+   }
+ 
++/* memset added by GC to blank dsn records, etc. */
++memset(&recipients_list[recipients_count], 0, sizeof(recipient_item));
+ recipients_list[recipients_count].address = recipient;
+ recipients_list[recipients_count].pno = pno;
+ #ifdef EXPERIMENTAL_BRIGHTMAIL
+diff -urN exim-4.62-orig/src/route.c exim-4.62-dsn/src/route.c
+--- exim-4.62-orig/src/route.c	2006-04-28 11:32:22.000000000 +0100
++++ exim-4.62-dsn/src/route.c	2006-05-17 12:59:03.000000000 +0100
+@@ -60,6 +60,10 @@
+                  (void *)offsetof(router_instance, domains) },
+   { "driver",             opt_stringptr|opt_public,
+                  (void *)offsetof(router_instance, driver_name) },
++  #ifdef SUPPORT_DSN
++  { "dsn_process",        opt_bool|opt_public,
++                 (void *)offsetof(router_instance, dsn_process) },
++  #endif
+   { "errors_to",          opt_stringptr|opt_public,
+                  (void *)(offsetof(router_instance, errors_to)) },
+   { "expn",               opt_bool|opt_public,
+@@ -272,6 +276,13 @@
+ 
+   if (r->pass_router_name != NULL)
+     set_router(r, r->pass_router_name, &(r->pass_router), TRUE);
++
++  #ifdef SUPPORT_DSN
++    if (r->dsn_process == FALSE)
++      DEBUG(D_route) debug_printf("%s router skipping DSN - add dsn_process to router\n", r->name);
++    if (r->dsn_process == TRUE)
++      DEBUG(D_route) debug_printf("%s router performing DSN \n", r->name);
++  #endif
+   }
+ }
+ 
+@@ -1391,7 +1402,10 @@
+ 
+ copyflag(new, addr, af_propagate);
+ new->p.address_data = addr->p.address_data;
+-
++#ifdef SUPPORT_DSN
++  new->dsn_flags = addr->dsn_flags;
++  new->dsn_orcpt = addr->dsn_orcpt;
++#endif
+ 
+ /* As it has turned out, we haven't set headers_add or headers_remove for the
+  * clone. Thinking about it, it isn't entirely clear whether they should be
+diff -urN exim-4.62-orig/src/smtp_in.c exim-4.62-dsn/src/smtp_in.c
+--- exim-4.62-orig/src/smtp_in.c	2006-04-28 11:32:23.000000000 +0100
++++ exim-4.62-dsn/src/smtp_in.c	2006-05-17 13:02:48.000000000 +0100
+@@ -832,6 +832,13 @@
+ sender_verified_list = NULL;        /* No senders verified */
+ memset(sender_address_cache, 0, sizeof(sender_address_cache));
+ memset(sender_domain_cache, 0, sizeof(sender_domain_cache));
++
++#ifdef SUPPORT_DSN
++/* Reset the DSN flags */
++dsn_ret = 0;
++dsn_envid = NULL;
++#endif
++
+ authenticated_sender = NULL;
+ #ifdef EXPERIMENTAL_BRIGHTMAIL
+ bmi_run = 0;
<<Diff was trimmed, longer than 597 lines>>


More information about the pld-cvs-commit mailing list