diff -urN src.orig/expand.c src/expand.c --- src.orig/expand.c 2012-10-25 06:37:38.000000000 +0300 +++ src/expand.c 2013-09-10 02:35:00.000000000 +0300 @@ -446,6 +446,9 @@ { "dnslist_value", vtype_stringptr, &dnslist_value }, { "domain", vtype_stringptr, &deliver_domain }, { "domain_data", vtype_stringptr, &deliver_domain_data }, +#ifdef SUPPORT_DSN + { "dsn_flag", vtype_int, &dsn_flag }, +#endif { "exim_gid", vtype_gid, &exim_gid }, { "exim_path", vtype_stringptr, &exim_path }, { "exim_uid", vtype_uid, &exim_uid }, diff -urN src.orig/globals.c src/globals.c --- src.orig/globals.c 2012-10-25 06:37:38.000000000 +0300 +++ src/globals.c 2013-09-10 02:35:30.000000000 +0300 @@ -886,6 +886,9 @@ int rcpt_count = 0; int rcpt_fail_count = 0; int rcpt_defer_count = 0; +#ifdef SUPPORT_DSN +int dsn_flag = 0; +#endif gid_t real_gid; uid_t real_uid; BOOL really_exim = TRUE; diff -urN src.orig/globals.h src/globals.h --- src.orig/globals.h 2012-10-25 06:37:38.000000000 +0300 +++ src/globals.h 2013-09-10 02:35:56.000000000 +0300 @@ -590,6 +590,9 @@ extern int rcpt_count; /* Count of RCPT commands in a message */ extern int rcpt_fail_count; /* Those that got 5xx */ extern int rcpt_defer_count; /* Those that got 4xx */ +#ifdef SUPPORT_DSN +extern int dsn_flag; /* DSN flag */ +#endif extern gid_t real_gid; /* Real gid */ extern uid_t real_uid; /* Real user running program */ extern BOOL really_exim; /* FALSE in utilities */ diff -urN src.orig/smtp_in.c src/smtp_in.c --- src.orig/smtp_in.c 2013-09-10 02:32:45.000000000 +0300 +++ src/smtp_in.c 2013-09-10 02:36:43.000000000 +0300 @@ -1018,6 +1018,9 @@ recipients_list = NULL; rcpt_count = rcpt_defer_count = rcpt_fail_count = raw_recipients_count = recipients_count = recipients_list_max = 0; +#ifdef SUPPORT_DSN +dsn_flag = 0; +#endif message_linecount = 0; message_size = -1; acl_added_headers = NULL; @@ -3640,6 +3643,10 @@ there may be a delay in this, re-check for a synchronization error afterwards, unless pipelining was advertised. */ +#ifdef SUPPORT_DSN + dsn_flag = flags; +#endif + if (recipients_discarded) rc = DISCARD; else { rc = acl_check(ACL_WHERE_RCPT, recipient, acl_smtp_rcpt, &user_msg,