Gentoo Archives: gentoo-commits

From: "Anthony G. Basile" <blueness@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/musl:master commit in: mail-mta/exim/, mail-mta/exim/files/
Date: Wed, 25 Nov 2015 00:08:29
Message-Id: 1448410514.6abd1d66aceb4f0679372d2e63447f879967f2c1.blueness@gentoo
1 commit: 6abd1d66aceb4f0679372d2e63447f879967f2c1
2 Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
3 AuthorDate: Wed Nov 25 00:15:14 2015 +0000
4 Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
5 CommitDate: Wed Nov 25 00:15:14 2015 +0000
6 URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=6abd1d66
7
8 mail-mta/exim: version bump.
9
10 Package-Manager: portage-2.2.20.1
11 RepoMan-Options: --force
12
13 mail-mta/exim/Manifest | 9 +-
14 .../{exim-4.84-r99.ebuild => exim-4.85-r99.ebuild} | 16 +-
15 mail-mta/exim/files/exim-4.76-dsn.patch | 18 -
16 .../exim/files/exim-4.77-makefile-freebsd.patch | 48 -
17 mail-mta/exim/files/exim_482_dsn_1_3.patch | 1212 --------------------
18 5 files changed, 11 insertions(+), 1292 deletions(-)
19
20 diff --git a/mail-mta/exim/Manifest b/mail-mta/exim/Manifest
21 index 2a37072..9e3aa95 100644
22 --- a/mail-mta/exim/Manifest
23 +++ b/mail-mta/exim/Manifest
24 @@ -5,9 +5,7 @@ AUX exim-4.69-r1.27021.patch 1447 SHA256 dc81115be1324cf2d61ff2e2393462bd31aa635
25 AUX exim-4.74-localscan_dlopen.patch 9280 SHA256 dcd44f552e9b9b79facc988c9efad3ab1609a4e4209e9276323f49d1ea00e462 SHA512 bfd35b8fcc7b8bd50a28b2bb7865d358ed1af3978b057da1c83a0be38ba30a737d983b6b5cf829559ba8c490709d28bdb7d679eb825fe7e24798ec223bedc94e WHIRLPOOL 7140c45782d8611638f3aecc960f890963b1d34fd1cca7a5b78058a616607d10c1a50d4110498e9c3d700ca04df8797c184ce816bfd1cab8931bd4eb9ef3aa8a
26 AUX exim-4.74-radius-db-ENV-clash.patch 667 SHA256 a4150c9b73203dd284faa646a67e39f431d07c6a378af8fabc97a4ad9e078437 SHA512 040bbdb2259df882569a428b7fef03f89c3685428654ac29e93360a4791bdabe66e52d33d14f0822461fac119295bd31aad5998f63d59d4af057bd26b310a568 WHIRLPOOL 3ef9641fc821be5d7477ccc41f8656f987a896e883a7aa3a627b92e64e2663a87f345bd0fc46ae1b4b9f6ac09a560c951c0396dd135305c97821374d8aa08806
27 AUX exim-4.76-crosscompile.patch 462 SHA256 25ba013858b0fc239e24166554c1e28832d3d25801b53ca633f289bc4ae72b8e SHA512 d4fd4417c1ce727f139999c399795312cdbbb9735d0793d68f8e3150240bc53b31277cb26f9946ba549b34c661fc0a61147d376bda09aa6763cab55d80d62343 WHIRLPOOL 22026d355888efb2f823842c596fb670f0821076fe6faaae9d0a6ecf57a4a6de52af9f720e784e8d7bbcf681494a020f22e75f4a2aa079d30880f5c9af759405
28 -AUX exim-4.76-dsn.patch 822 SHA256 2b36099285ff271f1c6db189435ebe3c2d3f3e8407ac11a041c7ea21b1997463 SHA512 b25324ca0bb9d5d9fd6b4604c5fb4f601ed793d409f75c008e7638a2d8ac5435bccc300b95999fe34ff167275c7a19a0af7ebc8eb15627243b3cbcddb3fa4f04 WHIRLPOOL d49305b97a43686436c12453366a71bd6730e4593566d340f73a02f08db94ff6b9b8c473993e5ec5ec699425aee5f50f4ba90bc14168f9e8876a0b4a91ee0ddd
29 AUX exim-4.77-as-needed-ldflags.patch 5954 SHA256 3960f6883f7c3b44110ca5916ad8fa63f829516624c011a807cda00972b4dffd SHA512 716cac89116b66df645a6d49c88369ed062e3d3cf158fb50420984fe1fd2c1d3f56ad3a59ba36bb5d88dc9f8194f5fa105340baa82120b63298a245c6aaaaca2 WHIRLPOOL 8e321d3abf5a2d55af93d7cc865a33b1b8f13ba19af8ce6b17c29ba7b4003b4cc7acb4789ab941e8dc0b475d8568c0934e8da2c429dec9099901e85b966830d0
30 -AUX exim-4.77-makefile-freebsd.patch 1124 SHA256 50108e7f26ca2acb594d3d9a57c25ad041f32ada729b604da7378e9376b3ac7c SHA512 99dd86a5aedb6505356e3c5614b065a68d4bbae69502cd5c0a780038c231fb1047e21a2f0b8757a65d6b1a6dcdf8a7f7416a299edc1c85adeec4e362b992f321 WHIRLPOOL 33a4d49572cb3beafe2680b742fe68ceb6d7098be4244677c3ae2ea23dfed8af1be4ef91f0247e5d69adec5679dd02cb3dc71233ba4cb3418f93c70e717727fa
31 AUX exim-4.80-spool-mail-group.patch 946 SHA256 4f013e30f6f96360baa7d5d7818eaf5247984ab0eb43b8b5ba8d1bd8704b811b SHA512 24f30e9a9d90dc0f1fe8b3db26f8bc2649182b4e78110dc28a9c0f3a3feb7589f923144a4f1c54a1c46ff8cfe40826a1f2212787753be752f4d15a72d54a143b WHIRLPOOL aa34f4e721fda796ebeb091514ec35ffcf153e813b7760245d25da5d6f27590734d28032498a0ffb2262e170355b0a99b53947818e669d1f79bd0393ae85a2d6
32 AUX exim-4.82-makefile-freebsd.patch 1252 SHA256 c407ea37ff8125f20f535ddb02793d5242a12582b9ab388d2ba956f932af2f3d SHA512 fb440ad3e46b90d4c2e4826841944f4006390ccebee08154a39e46f6854be15edd7d0b028333b41451a0511f886ad3a30cb4b86e7ba8be99f12616a137f09d56 WHIRLPOOL 72132bdce44ba23fb162a5afaed33ea72ef2c917d020f5ddf920ce16991f02411c0bbcb23526b0e09753ab84cf2f258108aa2283ce5f9529810844497df29501
33 AUX exim-submission.socket 161 SHA256 d3bb58f0fbeaaa33c812a823708664bbcd828da7d24e2a098f84a15aee443fee SHA512 4a233761793e3510e9efa5aad3a6098c41b757f13133a7ea825680f2b393aba8d7935f16bf1dd065dde884fe7ba45639a8d398333a7d9bf0a6b72f88c8f2a09d WHIRLPOOL 7fe2a157ae3361440d8a85c8eca44a97a289be1689261efda943076c9a76ab74ef9d5f01ec0eecdde940ae30ccb46530c95d7223cf62b78e8eb2bde5268288e2
34 @@ -18,10 +16,9 @@ AUX exim.rc8 755 SHA256 8ebeb8d406690918c6d4e9b87fd2fd44053055130091671e49ce7d77
35 AUX exim.rc9 1236 SHA256 e541e950313a4057e3cd13cabac26db924485c54607410e0dcb3a2c348bf2fab SHA512 2032f27ecb23dc9dcc7154d959dd60f9e24316415a78a993ce1ed7511753a99f12774c649698aec1a92bd641c3254c6b81a9a42f2a424dd43ff10813e1aad2f5 WHIRLPOOL ebbdda159ddd609a3524dfc2b79d482fc30a0b11dbaed11c4687fd781ed8231982cb61e2dfc5bc830f8ef281f0d02db84f18535660034ef8e0dbdc5ee960a578
36 AUX exim.service 229 SHA256 6e5372338d93b75d96bf571d892b167ac812378bcf978dcd3f3324d7e612463a SHA512 a071e9fb74b5fc2fdf0c73ad64ddfbc3954d8f7095d6a363dacf8c75d72a479fbf6821822ec5c8f3846d7687342e1bd447b97f91ca7b0582e5c98008aac30cca WHIRLPOOL 5f2ccd6898c95599f8e801aa111c53dbb50b7ec9f6ba6552fe195ad07d41efdcbff765cba1d696df6acb564bca29830d0bf61bcda9a244a3b48354318914bbd5
37 AUX exim.socket 139 SHA256 3e3d8b6be2741d2587a496196c08b3f2ffa05b5803b2bf9fb49359cef3a98d26 SHA512 db621116907ceb573e6f34581f47c91f751bff593054d7ddc32397b34c7f2405bec184bdb0589d2ac457fa3a61bcba072761e3a6293a99c9c764d2d9fd6069ae WHIRLPOOL 6ddceaa1bf31d995afa2dc49ab4d8e1068321ab12b158e075f6ea3f2cc4dff35c2052da2a85fe998813354755e574670086880ef7e42e2a02877d4f766706d3c
38 -AUX exim_482_dsn_1_3.patch 41505 SHA256 4e00069a4b2e2deb414f05ea33f29b3f007d9ebff17cfc16998800b21b8e0ef5 SHA512 5f184d903300851dba46f4c3d46e70269111ff335fc71e9d14b04f40462c163411521f6fd60e1d703dfab3a173911225a209133369bb3c26d83455499261e777 WHIRLPOOL 842040f5009ad43b40ceff4935510b06a0f7496bfb7e7a13db8f3eeb6fec63d7c7b38e4ed31b2d8de543ddaf7e8af8becef334c88d1365910e783c8c0ad5a7ff
39 AUX exim_at.service 140 SHA256 faad96dadbb2750faa5652d830f10d5a14be487a42e8db1cec797164acf14b73 SHA512 11c8133ee15b3e5193c9b1c59aed66c81b6e045dd23310bede9fcde6c88905db5ef08afdb798b53b75a7465915ea1247e980edf95db07a7f9b7bb58ce95fbb5a WHIRLPOOL 78f0c825526ae890458c4e71df2bd724d77d508081c6d6c2e3493732f11576ffeed755968dd2f3bcfb1cc6e0b0d61ea9fc175cd71340d908646f1a9ccbc7406e
40 -DIST exim-4.84.tar.bz2 1761790 SHA256 78ea22be87fb6df880e7fd482f3bec9ef6ceca0c9dedd50f8a26cae0b38b9e9c SHA512 3cd41af6d57e5f0377fc93367753eae6cb6bf835803e8608c44e1da5acefce1ed8886f4fe7536950de072bfed6e927afe1536c1e6466cf3121dd352b69a68039 WHIRLPOOL 9e840aa6afa0db68455b4ab458706eedd7ea57b084999c9e85eaaec0530ed93958731d934ff1d7830d9b5cd086e36cb56dc8a2f78dad85bdba9ae6573510e840
41 -DIST exim-html-4.84.tar.bz2 465281 SHA256 7ee7e9015b853915604b7806be93d56e9ba1fb915b63f0d6828c47f2228fd45b SHA512 7de8513476b6abcdfd36b0121a2a9d6decf1ccf94ef51b8363e544066cc05670e6f2b4d03d5fbc49071b1431183dfd9badde5cbcc65f51d55ec6b25ebcb070b9 WHIRLPOOL 88c376fd399e17b2bc06d2d0fad19f8c6485807118a81e0c200f6c39defe7155fa920489481a8b82e629951766ce0222b85956f387d22d22549303bd3dff7f82
42 +DIST exim-4.85.tar.bz2 1784150 SHA256 13211f2bbc5400d095a9b4be075eb1347e0d98676fdfe4be8a3b4d56281daaa4 SHA512 2c5846528ee98e4aff5dbabe49dfa5ba6753fa64154b9671a7849db8a17773917fe13bcb9e5f732c43d7479debfadd8012b8650823eb12504a6b1b28be456161 WHIRLPOOL 4057cd745f12ff62e956838406544060d3d2d7383027959f3c1ca12eff43bddb9be63e284767245b271e53bef92596c1241f5e90e9ed611d02e95b7a30adc7c8
43 +DIST exim-html-4.85.tar.bz2 467069 SHA256 fd91946369626e74842a0799b93d0d9e4a201fe640af84e1b5349fe6ff204167 SHA512 8214576300827f79c0880e2d2163f71d7f1b3fe2aff714b591a011e48816965de5a773c3509137b085fec3d4d2128931f8398768c24dad6c92b7df27cbcafe74 WHIRLPOOL a7edffd7124c4920708616d3e59c0db5159dee5f7e4fd62ce29fdba769d39781a3826d4e3e39cdc97669941bb9a5c977defe280feb73cbe159b23df4cb6fe95f
44 DIST system_filter.exim.gz 3075 SHA256 3a3471b486a09e0a0153f7b520e1eaf26d21b97d73ea8348bdc593c00eb1e437 SHA512 cb358d3ce2499a0bb5920d962a06f2af8486e55ec90c8c928bd8e3aefb279aa57f5f960d5adfcef68bd94110b405eaa144e9629cfe6014a529c79c544600bbf3 WHIRLPOOL ce68d9c18b24eca3ef97ea810964cc1ada5f85b795a7c432ad39b5788188a16419101c92fb52b418738d760e1d658f7a41485e5561079a667d84d276c71be5a4
45 -EBUILD exim-4.84-r99.ebuild 12405 SHA256 c62882bcabceff343d0384e3ddb34dbdce36af3594bbd00dd2f21cf985b97f51 SHA512 2198d439730ed2429ef113a7898bcf69d131a81bcc0e612bfc67f4b7f34ac09df561304f8c27bee1640c784f1718cd527e1cac236e2a401994421b4acc51af90 WHIRLPOOL 6eb6d0e1ba489623779c13bc43ba88e97b383b518eefd51319ec9ef8c61fbb15eddc8bdd2d1fa70ba4ef10265df41629c9c36ec6c6160ba6c484d4b5e12f707b
46 +EBUILD exim-4.85-r99.ebuild 12277 SHA256 9320f7b93c2565386839054b3804a16125c078e744d6cc551e8e579f4aa35a85 SHA512 b98a3721fcf0d144ada88ab9a3761fe85cf19ffc04259f678d28822cb9c2f94c4b2271265f60db59919b3e547e88848797d172088d820f75c1107ee182c78c0c WHIRLPOOL 3fdea090d6f61748fdf86036377682d675b7e18dd92f096e9eca7f503f491184ddec5f3475d80077d9cde8697b0fb30c8505795d32d3e00e3182f169558986b0
47 MISC metadata.xml 2299 SHA256 a2985b24eb4e06b72f5c3a77403fd36e511112d789c584c391f344f547b21bcf SHA512 a7d4c9faf6240b5795e1da7df99f918bf438b1bf93fbe9ce12269b0f48000beb622dfad2489337f35b42c342605cd19359edf4e581794fc33f76a4cb0d035568 WHIRLPOOL 7eb7ade4038826e0947df620a65044acd2167b32126963c3f28336050680b05e4dca211588b722e7fb8273e13e171690a5ba0114182047e0690c43fdf244b71f
48
49 diff --git a/mail-mta/exim/exim-4.84-r99.ebuild b/mail-mta/exim/exim-4.85-r99.ebuild
50 similarity index 96%
51 rename from mail-mta/exim/exim-4.84-r99.ebuild
52 rename to mail-mta/exim/exim-4.85-r99.ebuild
53 index e160456..20a63f2 100644
54 --- a/mail-mta/exim/exim-4.84-r99.ebuild
55 +++ b/mail-mta/exim/exim-4.85-r99.ebuild
56 @@ -1,6 +1,6 @@
57 # Copyright 1999-2015 Gentoo Foundation
58 # Distributed under the terms of the GNU General Public License v2
59 -# $Header: /var/cvsroot/gentoo-x86/mail-mta/exim/exim-4.84.ebuild,v 1.17 2015/03/21 21:18:34 jlec Exp $
60 +# $Id$
61
62 EAPI="5"
63
64 @@ -19,7 +19,7 @@ HOMEPAGE="http://www.exim.org/"
65
66 SLOT="0"
67 LICENSE="GPL-2"
68 -KEYWORDS="amd64 ppc ~mips x86"
69 +KEYWORDS="amd64 ppc x86"
70
71 COMMON_DEPEND=">=sys-apps/sed-4.0.5
72 >=sys-libs/db-3.2
73 @@ -117,7 +117,6 @@ src_configure() {
74
75 if use elibc_musl; then
76 sed -e 's/^LIBS = -lnsl/LIBS =/g' \
77 - -e 's/^HAVE_ICONV=yes/#HAVE_ICONV=yes/' \
78 -i OS/Makefile-Linux
79 fi
80
81 @@ -127,6 +126,7 @@ src_configure() {
82 INFO_DIRECTORY=${EPREFIX}/usr/share/info
83 PID_FILE_PATH=${EPREFIX}/run/exim.pid
84 SPOOL_DIRECTORY=${EPREFIX}/var/spool/exim
85 + HAVE_ICONV=yes
86 EOC
87
88 # if we use libiconv, now is the time to tell so
89 @@ -349,7 +349,7 @@ src_configure() {
90 # Transport post-delivery actions
91 if use tpda; then
92 cat >> Makefile <<- EOC
93 - EXPERIMENTAL_TPDA=yes
94 + EXPERIMENTAL_EVENT=yes
95 EOC
96 fi
97
98 @@ -469,14 +469,14 @@ src_install () {
99 insinto /etc/logrotate.d
100 newins "${FILESDIR}/exim.logrotate" exim
101
102 - newinitd "${FILESDIR}"/exim.rc8 exim
103 + newinitd "${FILESDIR}"/exim.rc9 exim
104 newconfd "${FILESDIR}"/exim.confd exim
105
106 systemd_dounit "${FILESDIR}"/{exim.service,exim.socket,exim-submission.socket}
107 systemd_newunit "${FILESDIR}"/exim_at.service 'exim@.service'
108 systemd_newunit "${FILESDIR}"/exim-submission_at.service 'exim-submission@.service'
109
110 - DIROPTIONS="-m 0750 -o ${MAILUSER} -g ${MAILGROUP}"
111 + diropts -m 0750 -o ${MAILUSER} -g ${MAILGROUP}
112 dodir /var/log/${PN}
113 }
114
115 @@ -498,13 +498,13 @@ pkg_postinst() {
116 einfo "configure DMARC, for usage see the documentation at "
117 einfo "experimental-spec.txt."
118 fi
119 - use tpda && einfo "TPDA support is experimental"
120 + use tpda && einfo "TPDA/EVENT support is experimental"
121 use proxy && einfo "proxy support is experimental"
122 if use dsn ; then
123 einfo "Starting from Exim 4.83, DSN support comes from upstream."
124 einfo "DSN support is an experimental feature. If you used DSN"
125 einfo "support prior to 4.83, make sure to remove all dsn_process"
126 - einfo "switches from your routers, see http://bugs.gentoo.org/511818"
127 + einfo "switches from your routers, see https://bugs.gentoo.org/511818"
128 fi
129 einfo "Exim maintains some db files under its spool directory that need"
130 einfo "cleaning from time to time. (${EROOT}var/spool/exim/db)"
131
132 diff --git a/mail-mta/exim/files/exim-4.76-dsn.patch b/mail-mta/exim/files/exim-4.76-dsn.patch
133 deleted file mode 100644
134 index 8a608ba..0000000
135 --- a/mail-mta/exim/files/exim-4.76-dsn.patch
136 +++ /dev/null
137 @@ -1,18 +0,0 @@
138 -http://bugs.gentoo.org/show_bug.cgi?id=366835
139 -https://sourceforge.net/tracker/?func=detail&aid=3300653&group_id=121058&atid=689120
140 -
141 ---- exim_469_dsn_1_3.patch
142 -+++ exim_469_dsn_1_3.patch
143 -@@ -524,10 +524,10 @@
144 - diff -urN exim-4.69-orig/src/readconf.c exim-4.69-dsn/src/readconf.c
145 - --- exim-4.69-orig/src/readconf.c 2007-08-23 12:01:49.000000000 +0100
146 - +++ exim-4.69-dsn/src/readconf.c 2008-07-28 09:52:55.000000000 +0100
147 --@@ -207,6 +207,9 @@
148 -- { "dns_ipv4_lookup", opt_stringptr, &dns_ipv4_lookup },
149 -+@@ -219,6 +219,9 @@
150 - { "dns_retrans", opt_time, &dns_retrans },
151 - { "dns_retry", opt_int, &dns_retry },
152 -+ { "dns_use_edns0", opt_int, &dns_use_edns0 },
153 - +#ifdef SUPPORT_DSN
154 - + { "dsn", opt_bool, &dsn },
155 - +#endif
156
157 diff --git a/mail-mta/exim/files/exim-4.77-makefile-freebsd.patch b/mail-mta/exim/files/exim-4.77-makefile-freebsd.patch
158 deleted file mode 100644
159 index f3c0332..0000000
160 --- a/mail-mta/exim/files/exim-4.77-makefile-freebsd.patch
161 +++ /dev/null
162 @@ -1,48 +0,0 @@
163 ---- OS/Makefile-FreeBSD
164 -+++ OS/Makefile-FreeBSD
165 -@@ -1,12 +1,10 @@
166 --# Exim: OS-specific make file for FreeBSD
167 --# There's no setting of CFLAGS here, to allow the system default
168 --# for "make" to be the default.
169 --
170 --PORTOBJFORMAT!= test -x /usr/bin/objformat && /usr/bin/objformat || echo aout
171 --
172 --CHOWN_COMMAND=/usr/sbin/chown
173 --STRIP_COMMAND=/usr/bin/strip
174 --CHMOD_COMMAND=/bin/chmod
175 -+# Exim: OS-specific FreeBSD make file, modified for Gentoo Prefix
176 -+
177 -+
178 -+BASENAME_COMMAND=look_for_it
179 -+CHOWN_COMMAND=look_for_it
180 -+CHGRP_COMMAND=look_for_it
181 -+CHMOD_COMMAND=look_for_it
182 -
183 - HAVE_SA_LEN=YES
184 -
185 -@@ -18,23 +16,12 @@
186 - # Dynamicly loaded modules need to be built with -fPIC
187 - CFLAGS_DYNAMIC=-shared -rdynamic -fPIC
188 -
189 --# FreeBSD always ships with Berkeley DB
190 -+DBMLIB = -ldb
191 - USE_DB=yes
192 -
193 --# This code for building outside ports suggested by Richard Clayton
194 --.ifdef X11BASE
195 --X11=${X11BASE}
196 --.elifdef LOCALBASE
197 --X11=$(LOCALBASE)
198 --.else
199 --X11=/usr/local
200 --.endif
201 --
202 -+X11=/usr/X11R6
203 - XINCLUDE=-I$(X11)/include
204 - XLFLAGS=-L$(X11)/lib
205 --.if ${PORTOBJFORMAT} == "elf"
206 --XLFLAGS+=-Wl,-rpath,${X11}/lib
207 --.endif
208 - X11_LD_LIB=$(X11)/lib
209 -
210 - EXIWHAT_PS_ARG=-ax
211
212 diff --git a/mail-mta/exim/files/exim_482_dsn_1_3.patch b/mail-mta/exim/files/exim_482_dsn_1_3.patch
213 deleted file mode 100644
214 index c300699..0000000
215 --- a/mail-mta/exim/files/exim_482_dsn_1_3.patch
216 +++ /dev/null
217 @@ -1,1212 +0,0 @@
218 -Modified for 4.82 by Gentoo -- not the official patch from
219 -http://sourceforge.net/projects/eximdsn/
220 -
221 -diff -Naur exim-4.82_RC5.orig/README.DSN exim-4.82_RC5/README.DSN
222 ---- exim-4.82_RC5.orig/README.DSN 1970-01-01 01:00:00.000000000 +0100
223 -+++ exim-4.82_RC5/README.DSN 2013-10-27 21:47:32.000000000 +0100
224 -@@ -0,0 +1,118 @@
225 -+Exim DSN Patch (4.76)
226 -+---------------------
227 -+
228 -+This patch is free software; you can redistribute it and/or modify
229 -+it under the terms of the GNU General Public License as published by
230 -+the Free Software Foundation; either version 2 of the License, or
231 -+(at your option) any later version.
232 -+
233 -+This patch is distributed in the hope that it will be useful,
234 -+but WITHOUT ANY WARRANTY; without even the implied warranty of
235 -+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
236 -+GNU General Public License for more details.
237 -+
238 -+You should have received a copy of the GNU General Public License
239 -+along with this patch; if not, write to the Free Software
240 -+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
241 -+
242 -+Install
243 -+-------
244 -+cd into the source tree for a vanilla exim
245 -+
246 -+patch -p1 </path/to/patch/file.patch
247 -+
248 -+Example :-
249 -+[root@linuxbuild exim-4.72-test]# patch -p1 <../exim.dsn.patch-472
250 -+
251 -+Expected Output :-
252 -+patching file README.DSN
253 -+patching file src/config.h.defaults
254 -+patching file src/deliver.c
255 -+patching file src/exim.c
256 -+patching file src/exim.h
257 -+patching file src/globals.c
258 -+patching file src/globals.h
259 -+patching file src/local_scan.h
260 -+patching file src/macros.h
261 -+patching file src/readconf.c
262 -+patching file src/route.c
263 -+patching file src/smtp_in.c
264 -+patching file src/spool_in.c
265 -+patching file src/spool_out.c
266 -+patching file src/structs.h
267 -+patching file src/transport.c
268 -+patching file src/transports/smtp.c
269 -+
270 -+
271 -+This patch can be included / excluded from the compilation by use of the #define SUPPORT_DSN
272 -+which gets added into src/config.h.defaults & src/EDITME by the patch.
273 -+
274 -+Use
275 -+---
276 -+
277 -+The facility (once compiled in) can be turned on for a particular router via the
278 -+dsn_process directive Eg :-
279 -+
280 -+dest_delivery_int:
281 -+ driver = manualroute
282 -+ domains = +relay_to_domains
283 -+ condition = ${if eq {${lc:$sender_address_domain}}\
284 -+ {domain.com}\
285 -+ {yes}{no}\
286 -+ }
287 -+ dsn_process
288 -+ hide route_data = ${lc:${extract{mailHost}{$address_data}{$value}{}}}
289 -+ transport = remote_smtp
290 -+
291 -+Exim will produce 1 of 2 DSN's back to the originator, or pass on the DSN request.
292 -+The 2 DSN's will either contain (relayed via non "Remote SMTP" router) or
293 -+(relayed to non-DSN-aware mailer) depending on if the delivery was VIA an SMTP
294 -+transport or not.
295 -+
296 -+
297 -+Credits
298 -+-------
299 -+
300 -+The original work for the patch was done by Philip Hazel in Exim 3
301 -+
302 -+The extract was taken and re-applied to Exim 4 by the following :-
303 -+Phil Bingham (phil.bingham@××××××××.net)
304 -+Steve Falla (steve.falla@××××××××.net)
305 -+Ray Edah (ray.edah@××××××××.net)
306 -+Andrew Johnson (andrew.johnson@××××××××.net)
307 -+Adrian Hungate (adrian.hungate@××××××××.net)
308 -+
309 -+Now Primarily maintained by :-
310 -+Andrew Johnson (andrew.johnson@××××××××.net)
311 -+
312 -+Contributions
313 -+-------------
314 -+Andrey J. Melnikoff (TEMHOTA) (temnota@×××.ru)
315 -+
316 -+
317 -+ChangeLog
318 -+---------
319 -+
320 -+14-Apr-2006 : Changed subject to "Delivery Status Notification"
321 -+
322 -+17-May-2006 : debug_printf in spool-in.c were not wrapped with #ifndef COMPILE_UTILITY
323 -+ thanks to Andrey J. Melnikoff for this information
324 -+
325 -+12-Sep-2006 : Now supports Exim 4.63
326 -+
327 -+12-Sep-2006 : src/EDITME did not include the #define SUPPORT_DSN as stated
328 -+ in the documentation, this has now been corrected
329 -+ thanks to Robert Kehl for this information
330 -+
331 -+28-Jul-2008 : New version for exim 4.69 released.
332 -+
333 -+02-Jul-2010 : New version for exim 4.72 released.
334 -+
335 -+20-May-2011 : New version for exim 4.76 released.
336 -+
337 -+
338 -+Support for this patch (limited though it is) will only be provided through the SourceForge
339 -+project page (http://sourceforge.net/projects/eximdsn/)
340 -+
341 -+--
342 -+Andrew Johnson Cable & Wireless
343 -diff -Naur exim-4.82_RC5.orig/src/config.h.defaults exim-4.82_RC5/src/config.h.defaults
344 ---- exim-4.82_RC5.orig/src/config.h.defaults 2013-10-27 21:46:25.000000000 +0100
345 -+++ exim-4.82_RC5/src/config.h.defaults 2013-10-27 21:47:32.000000000 +0100
346 -@@ -136,6 +136,7 @@
347 - #define SUPPORT_MOVE_FROZEN_MESSAGES
348 - #define SUPPORT_PAM
349 - #define SUPPORT_TLS
350 -+#define SUPPORT_DSN
351 - #define SUPPORT_TRANSLATE_IP_ADDRESS
352 -
353 - #define SYSLOG_LOG_PID
354 -diff -Naur exim-4.82_RC5.orig/src/deliver.c exim-4.82_RC5/src/deliver.c
355 ---- exim-4.82_RC5.orig/src/deliver.c 2013-10-27 21:46:25.000000000 +0100
356 -+++ exim-4.82_RC5/src/deliver.c 2013-10-27 21:47:32.000000000 +0100
357 -@@ -63,6 +63,9 @@
358 - static address_item *addr_remote = NULL;
359 - static address_item *addr_route = NULL;
360 - static address_item *addr_succeed = NULL;
361 -+#ifdef SUPPORT_DSN
362 -+static address_item *addr_dsntmp = NULL;
363 -+#endif
364 -
365 - static FILE *message_log = NULL;
366 - static BOOL update_spool;
367 -@@ -2966,6 +2969,15 @@
368 - addr->flags |= af_prdr_used; break;
369 - #endif
370 -
371 -+ #ifdef SUPPORT_DSN
372 -+ case 'D':
373 -+ if (addr == NULL) break;
374 -+ addr->dsn_aware = (*ptr)? string_copy(ptr) : string_copy(" ");
375 -+ while (*ptr++);
376 -+ DEBUG(D_deliver) debug_printf("DSN read: addr->dsn_aware = %s\n", addr->dsn_aware);
377 -+ break;
378 -+ #endif
379 -+
380 - case 'A':
381 - if (addr == NULL)
382 - {
383 -@@ -4074,6 +4086,15 @@
384 - if (addr->flags & af_prdr_used) rmt_dlv_checked_write(fd, "P", 1);
385 - #endif
386 -
387 -+ #ifdef SUPPORT_DSN
388 -+ if (addr->dsn_aware == NULL)
389 -+ addr->dsn_aware = string_copy(" ");
390 -+ DEBUG(D_deliver) debug_printf("DSN write: addr->dsn_aware = %s\n", addr->dsn_aware);
391 -+ sprintf(big_buffer, "D%s", addr->dsn_aware);
392 -+ DEBUG(D_deliver) debug_printf("DSN write: big_buffer = %s (%d)\n", big_buffer, strlen(big_buffer)+1);
393 -+ write(fd, big_buffer, strlen(big_buffer)+1);
394 -+ #endif
395 -+
396 - /* Retry information: for most success cases this will be null. */
397 -
398 - for (r = addr->retries; r != NULL; r = r->next)
399 -@@ -5219,6 +5240,14 @@
400 - if (r->pno >= 0)
401 - new->onetime_parent = recipients_list[r->pno].address;
402 -
403 -+ #ifdef SUPPORT_DSN
404 -+ /* If DSN support is enabled, set the dsn flags and the original receipt
405 -+ to be passed on to other DSN enabled MTAs */
406 -+ new->dsn_flags = r->dsn_flags & rf_dsnflags;
407 -+ new->dsn_orcpt = r->orcpt;
408 -+ debug_printf("DSN (deliver): orcpt: %s flags: %d\n", new->dsn_orcpt, new->dsn_flags);
409 -+ #endif
410 -+
411 - switch (process_recipients)
412 - {
413 - /* RECIP_DEFER is set when a system filter freezes a message. */
414 -@@ -6163,6 +6192,12 @@
415 - regex_must_compile(US"\\n250[\\s\\-]PRDR(\\s|\\n|$)", FALSE, TRUE);
416 - #endif
417 -
418 -+ #ifdef SUPPORT_DSN
419 -+ /* Set the regex to check for DSN support on remote MTA */
420 -+ if (regex_DSN == NULL) regex_DSN =
421 -+ regex_must_compile(US"\\n250[\\s\\-]DSN(\\s|\\n|$)", FALSE, TRUE);
422 -+ #endif
423 -+
424 - /* Now sort the addresses if required, and do the deliveries. The yield of
425 - do_remote_deliveries is FALSE when mua_wrapper is set and all addresses
426 - cannot be delivered in one transaction. */
427 -@@ -6267,6 +6302,179 @@
428 -
429 - else if (!dont_deliver) retry_update(&addr_defer, &addr_failed, &addr_succeed);
430 -
431 -+#ifdef SUPPORT_DSN
432 -+/* ********** philb - Send DSN for successful messages */
433 -+
434 -+addr_dsntmp = addr_succeed;
435 -+
436 -+while(addr_dsntmp != NULL)
437 -+{
438 -+ BOOL dsn_sendmessage = FALSE;
439 -+ uschar dsnmsgbuf[4096];
440 -+
441 -+ DEBUG(D_deliver)
442 -+ debug_printf("DSN: processing router : %s\n", addr_dsntmp->router->name);
443 -+
444 -+ DEBUG(D_deliver)
445 -+ debug_printf("DSN: processing successful delivery address: %s\n", addr_dsntmp->address);
446 -+
447 -+ if (testflag(addr_dsntmp, af_ignore_error))
448 -+ {
449 -+ DEBUG(D_deliver)
450 -+ debug_printf("DSN: Ignore error for: %s\n", addr_dsntmp->address);
451 -+ }
452 -+ else
453 -+ {
454 -+ DEBUG(D_deliver) debug_printf("DSN: Checking Flag\n");
455 -+ if (addr_dsntmp->dsn_aware == NULL) {
456 -+ DEBUG(D_deliver) debug_printf("DSN: dsn_aware was NULL, setting to space at %s %d\n", __FILE__, __LINE__);
457 -+ addr_dsntmp->dsn_aware = string_copy(" ");
458 -+ }
459 -+ DEBUG(D_deliver) debug_printf("DSN: Sender_address: %s\n", sender_address);
460 -+ DEBUG(D_deliver) debug_printf("DSN: orcpt: %s flags: %d\n", addr_dsntmp->dsn_orcpt, addr_dsntmp->dsn_flags);
461 -+ DEBUG(D_deliver) debug_printf("DSN: envid: %s ret: %d\n", dsn_envid, dsn_ret);
462 -+ DEBUG(D_deliver) debug_printf("DSN: Remote SMTP server supports DSN: %s\n", addr_dsntmp->dsn_aware);
463 -+
464 -+ /* Process the flags */
465 -+ if((addr_dsntmp->dsn_flags & rf_dsnflags) != 0)
466 -+ {
467 -+ /* We've got at least one flag set */
468 -+
469 -+ /* set flag so we don't send bounces */
470 -+ setflag(addr_dsntmp, af_ignore_error);
471 -+
472 -+ if((addr_dsntmp->dsn_flags & rf_notify_never) != 0)
473 -+ {
474 -+ DEBUG(D_deliver) debug_printf("DSN: NEVER FLAG\n");
475 -+
476 -+ /* nothing to do here */
477 -+ }
478 -+
479 -+ if((addr_dsntmp->dsn_flags & rf_notify_success) != 0)
480 -+ {
481 -+ DEBUG(D_deliver) debug_printf("DSN: SUCCESS FLAG\n");
482 -+
483 -+ dsn_sendmessage = TRUE;
484 -+ }
485 -+
486 -+ if((addr_dsntmp->dsn_flags & rf_notify_failure) != 0)
487 -+ {
488 -+ DEBUG(D_deliver) debug_printf("DSN: FAILURE FLAG\n");
489 -+
490 -+ /* allow bounce messages */
491 -+ clearflag(addr_dsntmp, af_ignore_error);
492 -+ }
493 -+
494 -+ if((addr_dsntmp->dsn_flags & rf_notify_delay) != 0)
495 -+ {
496 -+ DEBUG(D_deliver) debug_printf("DSN: DELAY FLAG\n");
497 -+
498 -+ /* hmm, what to do here? */
499 -+ }
500 -+ }
501 -+
502 -+ if ((addr_dsntmp->dsn_aware != 0) && (addr_dsntmp->dsn_aware[0] != 'Y') && (dsn_sendmessage == TRUE) && (addr_dsntmp->router->dsn_process == TRUE))
503 -+ {
504 -+ pid_t pid;
505 -+ int fd;
506 -+
507 -+ /* remote MTA does not support DSN, so we need to send message */
508 -+
509 -+ /* create exim process to send message */
510 -+ pid = child_open_exim(&fd);
511 -+
512 -+ DEBUG(D_deliver) debug_printf("DSN: child_open_exim returns: %d\n", pid);
513 -+
514 -+ if (pid < 0) /* Creation of child failed */
515 -+ {
516 -+ log_write(0, LOG_MAIN|LOG_PANIC_DIE, "Process %d (parent %d) failed to "
517 -+ "create child process to send failure message: %s", getpid(),
518 -+ getppid(), strerror(errno));
519 -+
520 -+ DEBUG(D_deliver) debug_printf("DSN: child_open_exim failed\n");
521 -+
522 -+ }
523 -+ else /* Creation of child succeeded */
524 -+ {
525 -+ FILE *f = fdopen(fd, "wb");
526 -+ int topt = topt_add_return_path;
527 -+ uschar boundaryStr[64];
528 -+
529 -+ DEBUG(D_deliver) debug_printf("sending error message to: %s\n", sender_address);
530 -+
531 -+ /* build unique id for MIME boundary */
532 -+ snprintf(boundaryStr, 63, "%d-cwdsn-%d", pid, rand());
533 -+ DEBUG(D_deliver) debug_printf("DSN: MIME boundary: %s\n", boundaryStr);
534 -+
535 -+ /* if the sender doesn't want the whole message returned, don't send the body */
536 -+ if (dsn_ret != dsn_ret_full) topt |= topt_no_body;
537 -+
538 -+ if (errors_reply_to != NULL) fprintf(f,"Reply-To: %s\n", errors_reply_to);
539 -+
540 -+ fprintf(f,"Auto-Submitted: auto-generated\n");
541 -+ fprintf(f,"From: Mail Delivery System <Mailer-Daemon@%s>\n", qualify_domain_sender);
542 -+ fprintf(f,"To: %s\n", sender_address);
543 -+ fprintf(f,"Subject: Delivery Status Notification\n");
544 -+ fprintf(f,"Content-Type: multipart/report; report-type=delivery-status; boundary=%s\n", boundaryStr);
545 -+ fprintf(f,"MIME-Version: 1.0\n\n");
546 -+
547 -+ fprintf(f,"--%s\n", boundaryStr);
548 -+ fprintf(f,"Content-type: text/plain; charset=us-ascii\n\n");
549 -+
550 -+ fprintf(f,"This message was created automatically by mail delivery software.\n");
551 -+ fprintf(f," ----- The following addresses had successful delivery notifications -----\n");
552 -+/* AH: added specific message for non "Remote SMTP" situations */
553 -+ if (addr_dsntmp->dsn_aware[0] == 'N') {
554 -+ fprintf(f,"<%s> (relayed to non-DSN-aware mailer)\n\n", addr_dsntmp->address);
555 -+ } else {
556 -+ fprintf(f,"<%s> (relayed via non \"Remote SMTP\" router)\n\n", addr_dsntmp->address);
557 -+ }
558 -+
559 -+ fprintf(f,"--%s\n", boundaryStr);
560 -+ fprintf(f,"Content-type: message/delivery-status\n\n");
561 -+
562 -+ if (dsn_envid) { /* Test for NULL added by GC */
563 -+ fprintf(f,"Original-Envelope-Id: %s\n", dsn_envid);
564 -+ }
565 -+ fprintf(f,"Reporting-MTA: dns; %s\n", qualify_domain_sender);
566 -+ if (addr_dsntmp->dsn_orcpt) { /* Test for NULL added by GC */
567 -+ fprintf(f,"Original-Recipient: %s\n", addr_dsntmp->dsn_orcpt);
568 -+ }
569 -+ fprintf(f,"Action: delivered\n\n");
570 -+
571 -+ fprintf(f,"--%s\n", boundaryStr);
572 -+ fprintf(f,"Content-type: message/rfc822\n\n");
573 -+
574 -+ fflush(f);
575 -+ transport_filter_argv = NULL; /* Just in case */
576 -+ return_path = sender_address; /* In case not previously set */
577 -+
578 -+ /* Write the original email out */
579 -+ transport_write_message(NULL, fileno(f), topt, 2048, NULL, NULL, NULL, NULL, NULL, 0);
580 -+ fflush(f);
581 -+
582 -+ fprintf(f,"\n");
583 -+ fprintf(f,"--%s--\n", boundaryStr);
584 -+
585 -+ fflush(f);
586 -+ fclose(f);
587 -+ rc = child_close(pid, 0); /* Waits for child to close, no timeout */
588 -+ }
589 -+ }
590 -+ else
591 -+ { if (addr_dsntmp->router->dsn_process == TRUE)
592 -+ DEBUG(D_deliver) debug_printf("DSN: *** NOT SENDING DSN SUCCESS Message ***\n");
593 -+ if (addr_dsntmp->router->dsn_process == FALSE)
594 -+ DEBUG(D_deliver) debug_printf("DSN: *** NOT SENDING DSN SUCCESS Message (gagged) ***\n");
595 -+ }
596 -+ }
597 -+
598 -+ addr_dsntmp = addr_dsntmp->next;
599 -+}
600 -+
601 -+/* ********** philb - end of mod */
602 -+#endif
603 -+
604 - /* If any addresses failed, we must send a message to somebody, unless
605 - af_ignore_error is set, in which case no action is taken. It is possible for
606 - several messages to get sent if there are addresses with different
607 -diff -Naur exim-4.82_RC5.orig/src/EDITME exim-4.82_RC5/src/EDITME
608 ---- exim-4.82_RC5.orig/src/EDITME 2013-10-27 21:46:25.000000000 +0100
609 -+++ exim-4.82_RC5/src/EDITME 2013-10-27 21:47:32.000000000 +0100
610 -@@ -192,6 +192,8 @@
611 - # least one type of lookup. You should consider whether you want to build
612 - # the Exim monitor or not.
613 -
614 -+# Support DSN
615 -+SUPPORT_DSN=yes
616 -
617 - #------------------------------------------------------------------------------
618 - # These settings determine which individual router drivers are included in the
619 -diff -Naur exim-4.82_RC5.orig/src/exim.c exim-4.82_RC5/src/exim.c
620 ---- exim-4.82_RC5.orig/src/exim.c 2013-10-27 21:46:25.000000000 +0100
621 -+++ exim-4.82_RC5/src/exim.c 2013-10-27 21:47:32.000000000 +0100
622 -@@ -831,6 +831,9 @@
623 - #ifdef EXPERIMENTAL_REDIS
624 - fprintf(f, " Experimental_Redis");
625 - #endif
626 -+#ifdef SUPPORT_DSN
627 -+ fprintf(f, " C&W_DSN_1.3");
628 -+#endif
629 - fprintf(f, "\n");
630 -
631 - fprintf(f, "Lookups (built-in):");
632 -@@ -2653,6 +2656,16 @@
633 - break;
634 - }
635 -
636 -+ #ifdef SUPPORT_DSN
637 -+ /* -MCD: set the smtp_use_dsn flag; this indicates that the host
638 -+ that exim is connected to supports the esmtp extension DSN */
639 -+ else if (strcmp(argrest, "CD") == 0)
640 -+ {
641 -+ smtp_use_dsn = TRUE;
642 -+ break;
643 -+ }
644 -+ #endif
645 -+
646 - /* -MCP: set the smtp_use_pipelining flag; this is useful only when
647 - it preceded -MC (see above) */
648 -
649 -diff -Naur exim-4.82_RC5.orig/src/globals.c exim-4.82_RC5/src/globals.c
650 ---- exim-4.82_RC5.orig/src/globals.c 2013-10-27 21:46:25.000000000 +0100
651 -+++ exim-4.82_RC5/src/globals.c 2013-10-27 21:47:32.000000000 +0100
652 -@@ -124,6 +124,13 @@
653 - uschar *local_scan_path = NULL;
654 - #endif
655 -
656 -+#ifdef SUPPORT_DSN
657 -+BOOL dsn = TRUE;
658 -+uschar *dsn_envid = NULL;
659 -+int dsn_ret = 0;
660 -+const pcre *regex_DSN = NULL;
661 -+BOOL smtp_use_dsn = FALSE;
662 -+#endif
663 -
664 - #ifdef SUPPORT_TLS
665 - BOOL gnutls_compat_mode = FALSE;
666 -@@ -341,6 +348,11 @@
667 - NULL, /* authenticator */
668 - NULL, /* auth_id */
669 - NULL, /* auth_sndr */
670 -+ #ifdef SUPPORT_DSN
671 -+ NULL, /* dsn_orcpt */
672 -+ 0, /* dsn_flags */
673 -+ NULL, /* dsn_aware */
674 -+ #endif
675 - (uid_t)(-1), /* uid */
676 - (gid_t)(-1), /* gid */
677 - 0, /* flags */
678 -@@ -1096,6 +1108,9 @@
679 - TRUE, /* verify_sender */
680 - FALSE, /* uid_set */
681 - FALSE, /* unseen */
682 -+#ifdef SUPPORT_DSN
683 -+ FALSE, /* dsn_process */
684 -+#endif
685 -
686 - self_freeze, /* self_code */
687 - (uid_t)(-1), /* uid */
688 -@@ -1105,6 +1120,7 @@
689 - NULL, /* transport instance */
690 - NULL, /* pass_router */
691 - NULL /* redirect_router */
692 -+
693 - };
694 -
695 - uschar *router_name = NULL;
696 -diff -Naur exim-4.82_RC5.orig/src/globals.h exim-4.82_RC5/src/globals.h
697 ---- exim-4.82_RC5.orig/src/globals.h 2013-10-27 21:46:25.000000000 +0100
698 -+++ exim-4.82_RC5/src/globals.h 2013-10-27 21:47:32.000000000 +0100
699 -@@ -130,6 +130,13 @@
700 - extern int (*receive_ferror)(void);
701 - extern BOOL (*receive_smtp_buffered)(void);
702 -
703 -+#ifdef SUPPORT_DSN
704 -+extern BOOL dsn; /* FALSE if DSN not to be used */
705 -+extern uschar *dsn_envid; /* DSN envid string */
706 -+extern int dsn_ret; /* DSN ret type*/
707 -+extern const pcre *regex_DSN; /* For recognizing DSN settings */
708 -+extern BOOL smtp_use_dsn; /* Global for passed connections */
709 -+#endif
710 -
711 - /* For clearing, saving, restoring address expansion variables. We have to have
712 - the size of this vector set explicitly, because it is referenced from more than
713 -diff -Naur exim-4.82_RC5.orig/src/local_scan.h exim-4.82_RC5/src/local_scan.h
714 ---- exim-4.82_RC5.orig/src/local_scan.h 2013-10-27 21:46:25.000000000 +0100
715 -+++ exim-4.82_RC5/src/local_scan.h 2013-10-27 21:47:32.000000000 +0100
716 -@@ -124,9 +124,13 @@
717 - field is always NULL except for one_time aliases that had errors_to on the
718 - routers that generated them. */
719 -
720 -+/* Added the dsn attributes orcpt and dsn_flags for DSN support*/
721 -+
722 - typedef struct recipient_item {
723 - uschar *address; /* the recipient address */
724 - int pno; /* parent number for "one_time" alias, or -1 */
725 -+ uschar *orcpt; /* DSN orcpt */
726 -+ int dsn_flags; /* DSN flags */
727 - uschar *errors_to; /* the errors_to address or NULL */
728 - #ifdef EXPERIMENTAL_BRIGHTMAIL
729 - uschar *bmi_optin;
730 -diff -Naur exim-4.82_RC5.orig/src/macros.h exim-4.82_RC5/src/macros.h
731 ---- exim-4.82_RC5.orig/src/macros.h 2013-10-27 21:46:25.000000000 +0100
732 -+++ exim-4.82_RC5/src/macros.h 2013-10-27 21:47:32.000000000 +0100
733 -@@ -778,6 +778,22 @@
734 - #define topt_no_body 0x040 /* Omit body */
735 - #define topt_escape_headers 0x080 /* Apply escape check to headers */
736 -
737 -+ /* Flags for recipient_block, used in DSN support */
738 -+
739 -+ #define rf_onetime 0x01 /* A one-time alias */
740 -+ #define rf_notify_never 0x02 /* NOTIFY= settings */
741 -+ #define rf_notify_success 0x04
742 -+ #define rf_notify_failure 0x08
743 -+ #define rf_notify_delay 0x10
744 -+
745 -+ #define rf_dsnflags (rf_notify_never | rf_notify_success | \
746 -+ rf_notify_failure | rf_notify_delay)
747 -+
748 -+ /* DSN RET types */
749 -+
750 -+ #define dsn_ret_full 1
751 -+ #define dsn_ret_hdrs 2
752 -+
753 - /* Codes for the host_find_failed and host_all_ignored options. */
754 -
755 - #define hff_freeze 0
756 -diff -Naur exim-4.82_RC5.orig/src/readconf.c exim-4.82_RC5/src/readconf.c
757 ---- exim-4.82_RC5.orig/src/readconf.c 2013-10-27 21:46:25.000000000 +0100
758 -+++ exim-4.82_RC5/src/readconf.c 2013-10-27 21:49:15.000000000 +0100
759 -@@ -229,6 +229,9 @@
760 - /* This option is now a no-op, retained for compability */
761 - { "drop_cr", opt_bool, &drop_cr },
762 - /*********************************************************/
763 -+#ifdef SUPPORT_DSN
764 -+ { "dsn", opt_bool, &dsn },
765 -+#endif
766 - { "dsn_from", opt_stringptr, &dsn_from },
767 - { "envelope_to_remove", opt_bool, &envelope_to_remove },
768 - { "errors_copy", opt_stringptr, &errors_copy },
769 -diff -Naur exim-4.82_RC5.orig/src/receive.c exim-4.82_RC5/src/receive.c
770 ---- exim-4.82_RC5.orig/src/receive.c 2013-10-27 21:46:25.000000000 +0100
771 -+++ exim-4.82_RC5/src/receive.c 2013-10-27 21:47:32.000000000 +0100
772 -@@ -490,6 +490,8 @@
773 - memcpy(recipients_list, oldlist, oldmax * sizeof(recipient_item));
774 - }
775 -
776 -+/* memset added by GC to blank dsn records, etc. */
777 -+memset(&recipients_list[recipients_count], 0, sizeof(recipient_item));
778 - recipients_list[recipients_count].address = recipient;
779 - recipients_list[recipients_count].pno = pno;
780 - #ifdef EXPERIMENTAL_BRIGHTMAIL
781 -diff -Naur exim-4.82_RC5.orig/src/route.c exim-4.82_RC5/src/route.c
782 ---- exim-4.82_RC5.orig/src/route.c 2013-10-27 21:46:25.000000000 +0100
783 -+++ exim-4.82_RC5/src/route.c 2013-10-27 21:47:32.000000000 +0100
784 -@@ -58,6 +58,10 @@
785 - (void *)offsetof(router_instance, domains) },
786 - { "driver", opt_stringptr|opt_public,
787 - (void *)offsetof(router_instance, driver_name) },
788 -+ #ifdef SUPPORT_DSN
789 -+ { "dsn_process", opt_bool|opt_public,
790 -+ (void *)offsetof(router_instance, dsn_process) },
791 -+ #endif
792 - { "errors_to", opt_stringptr|opt_public,
793 - (void *)(offsetof(router_instance, errors_to)) },
794 - { "expn", opt_bool|opt_public,
795 -@@ -270,6 +274,13 @@
796 -
797 - if (r->pass_router_name != NULL)
798 - set_router(r, r->pass_router_name, &(r->pass_router), TRUE);
799 -+
800 -+ #ifdef SUPPORT_DSN
801 -+ if (r->dsn_process == FALSE)
802 -+ DEBUG(D_route) debug_printf("%s router skipping DSN - add dsn_process to router\n", r->name);
803 -+ if (r->dsn_process == TRUE)
804 -+ DEBUG(D_route) debug_printf("%s router performing DSN \n", r->name);
805 -+ #endif
806 - }
807 - }
808 -
809 -@@ -1412,7 +1423,10 @@
810 -
811 - copyflag(new, addr, af_propagate);
812 - new->p.address_data = addr->p.address_data;
813 --
814 -+#ifdef SUPPORT_DSN
815 -+ new->dsn_flags = addr->dsn_flags;
816 -+ new->dsn_orcpt = addr->dsn_orcpt;
817 -+#endif
818 -
819 - /* As it has turned out, we haven't set headers_add or headers_remove for the
820 - * clone. Thinking about it, it isn't entirely clear whether they should be
821 -diff -Naur exim-4.82_RC5.orig/src/smtp_in.c exim-4.82_RC5/src/smtp_in.c
822 ---- exim-4.82_RC5.orig/src/smtp_in.c 2013-10-27 21:46:25.000000000 +0100
823 -+++ exim-4.82_RC5/src/smtp_in.c 2013-10-27 21:47:32.000000000 +0100
824 -@@ -213,6 +213,9 @@
825 - #ifdef EXPERIMENTAL_PRDR
826 - ENV_MAIL_OPT_PRDR,
827 - #endif
828 -+#ifdef SUPPORT_DSN
829 -+ ENV_MAIL_OPT_RET, ENV_MAIL_OPT_ENVID,
830 -+#endif
831 - ENV_MAIL_OPT_NULL
832 - };
833 - typedef struct {
834 -@@ -228,6 +231,10 @@
835 - #ifdef EXPERIMENTAL_PRDR
836 - { US"PRDR", ENV_MAIL_OPT_PRDR, FALSE },
837 - #endif
838 -+#ifdef SUPPORT_DSN
839 -+ { US"RET", ENV_MAIL_OPT_RET, FALSE },
840 -+ { US"ENVID", ENV_MAIL_OPT_ENVID, FALSE },
841 -+#endif
842 - { US"NULL", ENV_MAIL_OPT_NULL, FALSE }
843 - };
844 -
845 -@@ -1073,6 +1080,13 @@
846 - sender_verified_list = NULL; /* No senders verified */
847 - memset(sender_address_cache, 0, sizeof(sender_address_cache));
848 - memset(sender_domain_cache, 0, sizeof(sender_domain_cache));
849 -+
850 -+#ifdef SUPPORT_DSN
851 -+/* Reset the DSN flags */
852 -+dsn_ret = 0;
853 -+dsn_envid = NULL;
854 -+#endif
855 -+
856 - authenticated_sender = NULL;
857 - #ifdef EXPERIMENTAL_BRIGHTMAIL
858 - bmi_run = 0;
859 -@@ -2679,6 +2693,10 @@
860 - int ptr, size, rc;
861 - int c, i;
862 - auth_instance *au;
863 -+#ifdef SUPPORT_DSN
864 -+ uschar *orcpt = NULL;
865 -+ int flags;
866 -+#endif
867 -
868 - switch(smtp_read_command(TRUE))
869 - {
870 -@@ -3106,6 +3124,12 @@
871 - s = string_cat(s, &size, &ptr, US"-8BITMIME\r\n", 11);
872 - }
873 -
874 -+ #ifdef SUPPORT_DSN
875 -+ /* Advertise DSN support if configured to do so. */
876 -+ if (dsn)
877 -+ s = string_cat(s, &size, &ptr, US"250-DSN\r\n", 9);
878 -+ #endif
879 -+
880 - /* Advertise ETRN if there's an ACL checking whether a host is
881 - permitted to issue it; a check is made when any host actually tries. */
882 -
883 -@@ -3360,6 +3384,42 @@
884 - arg_error = TRUE;
885 - break;
886 -
887 -+#ifdef SUPPORT_DSN
888 -+
889 -+ /* Handle the two DSN options, but only if configured to do so
890 -+ * (which will have caused "DSN" to be given in the EHLO
891 -+ * response). The code itself is included only if configured in
892 -+ * at build time. */
893 -+
894 -+ case ENV_MAIL_OPT_RET:
895 -+ /* Check if RET has already been set */
896 -+ if (dsn_ret > 0) {
897 -+ synprot_error(L_smtp_syntax_error, 501, NULL,
898 -+ US"RET can be specified once only");
899 -+ goto COMMAND_LOOP;
900 -+ }
901 -+ dsn_ret = (strcmpic(value, US"HDRS") == 0)? dsn_ret_hdrs :
902 -+ (strcmpic(value, US"FULL") == 0)? dsn_ret_full : 0;
903 -+ DEBUG(D_receive) debug_printf("DSN_RET: %d\n", dsn_ret);
904 -+ /* Check for invalid invalid value, and exit with error */
905 -+ if (dsn_ret == 0) {
906 -+ synprot_error(L_smtp_syntax_error, 501, NULL,
907 -+ US"Value for RET is invalid");
908 -+ goto COMMAND_LOOP;
909 -+ }
910 -+ break;
911 -+ case ENV_MAIL_OPT_ENVID:
912 -+ /* Check if the dsn envid has been already set */
913 -+ if (dsn_envid != NULL) {
914 -+ synprot_error(L_smtp_syntax_error, 501, NULL,
915 -+ US"ENVID can be specified once only");
916 -+ goto COMMAND_LOOP;
917 -+ }
918 -+ dsn_envid = string_copy(value);
919 -+ DEBUG(D_receive) debug_printf("DSN_ENVID: %s\n", dsn_envid);
920 -+ break;
921 -+#endif
922 -+
923 - /* Handle the AUTH extension. If the value given is not "<>" and either
924 - the ACL says "yes" or there is no ACL but the sending host is
925 - authenticated, we set it up as the authenticated sender. However, if the
926 -@@ -3633,6 +3693,89 @@
927 - rcpt_fail_count++;
928 - break;
929 - }
930 -+
931 -+ #ifdef SUPPORT_DSN
932 -+ /* Set the DSN flags orcpt and dsn_flags from the session*/
933 -+ orcpt = NULL;
934 -+ flags = 0;
935 -+
936 -+ if (esmtp) for(;;)
937 -+ {
938 -+ uschar *name, *value, *end;
939 -+ int size;
940 -+
941 -+ if (!extract_option(&name, &value))
942 -+ {
943 -+ break;
944 -+ }
945 -+
946 -+ if (strcmpic(name, US"ORCPT") == 0)
947 -+ {
948 -+ /* Check whether orcpt has been already set */
949 -+ if (orcpt != NULL) {
950 -+ synprot_error(L_smtp_syntax_error, 501, NULL,
951 -+ US"ORCPT can be specified once only");
952 -+ goto COMMAND_LOOP;
953 -+ }
954 -+ orcpt = string_copy(value);
955 -+ DEBUG(D_receive) debug_printf("DSN orcpt: %s\n", orcpt);
956 -+ }
957 -+
958 -+ else if (strcmpic(name, US"NOTIFY") == 0)
959 -+ {
960 -+ /* Check if the notify flags have been already set */
961 -+ if (flags > 0)
962 -+ {
963 -+ synprot_error(L_smtp_syntax_error, 501, NULL,
964 -+ US"NOTIFY can be specified once only");
965 -+ goto COMMAND_LOOP;
966 -+ }
967 -+ if (strcmpic(value, US"NEVER") == 0) flags |= rf_notify_never; else
968 -+ {
969 -+ uschar *p = value;
970 -+ while (*p != 0)
971 -+ {
972 -+ uschar *pp = p;
973 -+ while (*pp != 0 && *pp != ',') pp++;
974 -+ if (*pp == ',') *pp++ = 0;
975 -+ if (strcmpic(p, US"SUCCESS") == 0) {
976 -+ DEBUG(D_receive) debug_printf("GC: Setting notify success\n");
977 -+ flags |= rf_notify_success;
978 -+ }
979 -+ else if (strcmpic(p, US"FAILURE") == 0) {
980 -+ DEBUG(D_receive) debug_printf("GC: Setting notify failure\n");
981 -+ flags |= rf_notify_failure;
982 -+ }
983 -+ else if (strcmpic(p, US"DELAY") == 0) {
984 -+ DEBUG(D_receive) debug_printf("GC: Setting notify delay\n");
985 -+ flags |= rf_notify_delay;
986 -+ }
987 -+ else
988 -+ {
989 -+ /* Catch any strange values */
990 -+ synprot_error(L_smtp_syntax_error, 501, NULL,
991 -+ US"Invalid value for NOTIFY parameter");
992 -+ goto COMMAND_LOOP;
993 -+ }
994 -+ p = pp;
995 -+ }
996 -+ DEBUG(D_receive) debug_printf("DSN Flags: %x\n", flags);
997 -+ }
998 -+ }
999 -+
1000 -+ /* Unknown option. Stick back the terminator characters and break
1001 -+ the loop. An error for a malformed address will occur. */
1002 -+
1003 -+ else
1004 -+ {
1005 -+ DEBUG(D_receive) debug_printf("Invalid dsn command: %s : %s\n", name, value);
1006 -+ name[-1] = ' ';
1007 -+ value[-1] = '=';
1008 -+ break;
1009 -+ }
1010 -+ }
1011 -+ #endif
1012 -+
1013 -
1014 - /* Apply SMTP rewriting then extract the working address. Don't allow "<>"
1015 - as a recipient address */
1016 -@@ -3747,6 +3890,24 @@
1017 - if (user_msg == NULL) smtp_printf("250 Accepted\r\n");
1018 - else smtp_user_msg(US"250", user_msg);
1019 - receive_add_recipient(recipient, -1);
1020 -+
1021 -+ #ifdef SUPPORT_DSN
1022 -+
1023 -+ /* Set the dsn flags in the recipients_list */
1024 -+ if (orcpt != NULL)
1025 -+ recipients_list[recipients_count-1].orcpt = orcpt;
1026 -+ else
1027 -+ recipients_list[recipients_count-1].orcpt = NULL;
1028 -+
1029 -+ if (flags != 0)
1030 -+ recipients_list[recipients_count-1].dsn_flags = flags;
1031 -+ else
1032 -+ recipients_list[recipients_count-1].dsn_flags = 0;
1033 -+ debug_printf("DSN-AJ(smtp-in): orcpt: %s flags: %d\n", recipients_list[recipients_count-1].orcpt, recipients_list[recipients_count-1].dsn_flags);
1034 -+
1035 -+
1036 -+ #endif
1037 -+
1038 - }
1039 -
1040 - /* The recipient was discarded */
1041 -diff -Naur exim-4.82_RC5.orig/src/spool_in.c exim-4.82_RC5/src/spool_in.c
1042 ---- exim-4.82_RC5.orig/src/spool_in.c 2013-10-27 21:46:25.000000000 +0100
1043 -+++ exim-4.82_RC5/src/spool_in.c 2013-10-27 21:47:32.000000000 +0100
1044 -@@ -293,6 +293,13 @@
1045 - spam_score_int = NULL;
1046 - #endif
1047 -
1048 -+#ifdef SUPPORT_DSN
1049 -+#ifndef COMPILE_UTILITY
1050 -+dsn_ret = 0;
1051 -+dsn_envid = NULL;
1052 -+#endif /* COMPILE_UTILITY */
1053 -+#endif
1054 -+
1055 - /* Generate the full name and open the file. If message_subdir is already
1056 - set, just look in the given directory. Otherwise, look in both the split
1057 - and unsplit directories, as for the data file above. */
1058 -@@ -467,6 +474,19 @@
1059 - case 'd':
1060 - if (Ustrcmp(p, "eliver_firsttime") == 0)
1061 - deliver_firsttime = TRUE;
1062 -+ #ifdef SUPPORT_DSN
1063 -+ #ifndef COMPILE_UTILITY
1064 -+ /* Check if the dsn flags have been set in the header file */
1065 -+ else if (Ustrncmp(p, "sn_ret", 6) == 0)
1066 -+ {
1067 -+ dsn_ret= atoi(big_buffer + 8);
1068 -+ }
1069 -+ else if (Ustrncmp(p, "sn_envid", 8) == 0)
1070 -+ {
1071 -+ dsn_envid = string_copy(big_buffer + 11);
1072 -+ }
1073 -+ #endif /* COMPILE_UTILITY */
1074 -+ #endif
1075 - break;
1076 -
1077 - case 'f':
1078 -@@ -554,7 +574,7 @@
1079 - tls_in.sni = string_unprinting(string_copy(big_buffer + 9));
1080 - break;
1081 - #endif
1082 --
1083 -+
1084 - default: /* Present because some compilers complain if all */
1085 - break; /* possibilities are not covered. */
1086 - }
1087 -@@ -604,6 +624,10 @@
1088 - {
1089 - int nn;
1090 - int pno = -1;
1091 -+ #ifdef SUPPORT_DSN
1092 -+ int dsn_flags = 0;
1093 -+ uschar *orcpt = NULL;
1094 -+ #endif
1095 - uschar *errors_to = NULL;
1096 - uschar *p;
1097 -
1098 -@@ -672,10 +696,19 @@
1099 - }
1100 -
1101 - /* Handle current format Exim 4 spool files */
1102 -+ /* Spool file is modified if DSN is supported
1103 -+ Original was "address errors_to len(errors_to),pno
1104 -+ New for DSN support is now:
1105 -+ "address errors_to orcpt len(errors_to),len(orcpt),pno,dsn_flags */
1106 -
1107 - else if (*p == '#')
1108 - {
1109 - int flags;
1110 -+
1111 -+ #ifndef COMPILE_UTILITY
1112 -+ DEBUG(D_deliver) debug_printf("**** SPOOL_IN - Exim 4 standard format spoolfile\n");
1113 -+ #endif /* COMPILE_UTILITY */
1114 -+
1115 - (void)sscanf(CS p+1, "%d", &flags);
1116 -
1117 - if ((flags & 0x01) != 0) /* one_time data exists */
1118 -@@ -688,15 +721,82 @@
1119 - {
1120 - p -= len;
1121 - errors_to = string_copy(p);
1122 -+ }
1123 -+ }
1124 -+
1125 -+ *(--p) = 0; /* Terminate address */
1126 -+ }
1127 -+ #ifdef SUPPORT_DSN
1128 -+ else if (*p == '!') /* Handle Exim4 + DSN spool files */
1129 -+ {
1130 -+ int flags;
1131 -+ int temp_dsn_flags;
1132 -+
1133 -+ #ifndef COMPILE_UTILITY
1134 -+ DEBUG(D_deliver) debug_printf("**** SPOOL_IN - C&W DSN format spoolfile\n");
1135 -+ #endif /* COMPILE_UTILITY */
1136 -+
1137 -+ sscanf(CS p+1, "%d,%d", &flags, &temp_dsn_flags);
1138 -+
1139 -+ if (((flags & 0x01) != 0) || (temp_dsn_flags > 0)) /* one_time data or dsn_flags exist */
1140 -+ {
1141 -+ int len;
1142 -+ int len_orcpt;
1143 -+
1144 -+ #ifndef COMPILE_UTILITY
1145 -+ DEBUG(D_deliver) debug_printf("**** spool_in dsn_flags = 0\n");
1146 -+ #endif /* COMPILE_UTILITY */
1147 -+
1148 -+ dsn_flags = 0;
1149 -+
1150 -+ while (isdigit(*(--p)) || *p == ',' || *p == '-');
1151 -+ sscanf(CS p+1, "%d,%d,%d,%d", &len, &len_orcpt, &pno, &dsn_flags);
1152 -+
1153 -+ *p = 0;
1154 -+ if (len_orcpt > 0)
1155 -+ {
1156 -+ p -= len_orcpt;
1157 -+ orcpt = string_copy(p);
1158 - }
1159 -+ *(--p) = 0; /* change the space to a NULL */
1160 -+
1161 -+ if (len > 0)
1162 -+ {
1163 -+ p -= len;
1164 -+ errors_to = string_copy(p);
1165 -+ }
1166 - }
1167 -
1168 - *(--p) = 0; /* Terminate address */
1169 - }
1170 -+ #endif
1171 -+ #ifndef COMPILE_UTILITY
1172 -+ else
1173 -+ {
1174 -+ DEBUG(D_deliver) debug_printf("**** SPOOL_IN - No additional fields\n");
1175 -+ }
1176 -+ #endif /* COMPILE_UTILITY */
1177 -+
1178 -+ #ifdef SUPPORT_DSN
1179 -+ #ifndef COMPILE_UTILITY
1180 -+ DEBUG(D_deliver) debug_printf("**** SPOOL_IN - address: |%s| errorsto: |%s| orcpt: |%s| dsn_flags: %d\n",
1181 -+ big_buffer, errors_to, orcpt, dsn_flags);
1182 -+ #endif /* COMPILE_UTILITY */
1183 -+ #endif
1184 -+ #ifndef SUPPORT_DSN
1185 -+ #ifndef COMPILE_UTILITY
1186 -+ DEBUG(D_deliver) debug_printf("**** SPOOL_IN - address: |%s| errorsto: |%s|\n",
1187 -+ big_buffer, errors_to);
1188 -+ #endif /* COMPILE_UTILITY */
1189 -+ #endif
1190 -
1191 - recipients_list[recipients_count].address = string_copy(big_buffer);
1192 - recipients_list[recipients_count].pno = pno;
1193 - recipients_list[recipients_count].errors_to = errors_to;
1194 -+ #ifdef SUPPORT_DSN
1195 -+ recipients_list[recipients_count].orcpt = orcpt;
1196 -+ recipients_list[recipients_count].dsn_flags = dsn_flags;
1197 -+ #endif
1198 - }
1199 -
1200 - /* The remainder of the spool header file contains the headers for the message,
1201 -diff -Naur exim-4.82_RC5.orig/src/spool_out.c exim-4.82_RC5/src/spool_out.c
1202 ---- exim-4.82_RC5.orig/src/spool_out.c 2013-10-27 21:46:25.000000000 +0100
1203 -+++ exim-4.82_RC5/src/spool_out.c 2013-10-27 21:47:32.000000000 +0100
1204 -@@ -234,6 +234,15 @@
1205 - if (tls_in.sni != NULL) fprintf(f, "-tls_sni %s\n", string_printing(tls_in.sni));
1206 - #endif
1207 -
1208 -+#ifdef SUPPORT_DSN
1209 -+/* Write the dsn flags to the spool header file */
1210 -+DEBUG(D_deliver) debug_printf("DSN: Write SPOOL :-dsn_envid %s\n", dsn_envid);
1211 -+if (dsn_envid != NULL) fprintf(f, "-dsn_envid %s\n", dsn_envid);
1212 -+DEBUG(D_deliver) debug_printf("DSN: Write SPOOL :-dsn_ret %d\n", dsn_ret);
1213 -+if (dsn_ret != 0) fprintf(f, "-dsn_ret %d\n", dsn_ret);
1214 -+#endif
1215 -+
1216 -+
1217 - /* To complete the envelope, write out the tree of non-recipients, followed by
1218 - the list of recipients. These won't be disjoint the first time, when no
1219 - checking has been done. If a recipient is a "one-time" alias, it is followed by
1220 -@@ -244,14 +253,36 @@
1221 - for (i = 0; i < recipients_count; i++)
1222 - {
1223 - recipient_item *r = recipients_list + i;
1224 -- if (r->pno < 0 && r->errors_to == NULL)
1225 -+#ifdef SUPPORT_DSN
1226 -+DEBUG(D_deliver) debug_printf("DSN: Flags :%d\n", r->dsn_flags);
1227 -+#endif
1228 -+ if (r->pno < 0 && r->errors_to == NULL
1229 -+ #ifdef SUPPORT_DSN
1230 -+ && r->dsn_flags == 0
1231 -+ #endif
1232 -+ )
1233 - fprintf(f, "%s\n", r->address);
1234 - else
1235 - {
1236 - uschar *errors_to = (r->errors_to == NULL)? US"" : r->errors_to;
1237 -+ #ifdef SUPPORT_DSN
1238 -+ uschar *orcpt = (r->orcpt == NULL)? US"" : r->orcpt;
1239 -+ fprintf(f, "%s %s %s %d,%d,%d,%d!1\n", r->address, errors_to, orcpt,
1240 -+ Ustrlen(errors_to), Ustrlen(orcpt), r->pno, r->dsn_flags);
1241 -+ #else
1242 - fprintf(f, "%s %s %d,%d#1\n", r->address, errors_to,
1243 - Ustrlen(errors_to), r->pno);
1244 -+ #endif
1245 - }
1246 -+
1247 -+ #ifdef SUPPORT_DSN
1248 -+ DEBUG(D_deliver) debug_printf("DSN :**** SPOOL_OUT - address: |%s| errorsto: |%s| orcpt: |%s| dsn_flags: %d\n",
1249 -+ r->address, r->errors_to, r->orcpt, r->dsn_flags);
1250 -+ #endif
1251 -+ #ifndef SUPPORT_DSN
1252 -+ DEBUG(D_deliver) debug_printf("**** SPOOL_OUT - address: |%s| errorsto: |%s|\n",
1253 -+ r->address, r->errors_to);
1254 -+ #endif
1255 - }
1256 -
1257 - /* Put a blank line before the headers */
1258 -diff -Naur exim-4.82_RC5.orig/src/structs.h exim-4.82_RC5/src/structs.h
1259 ---- exim-4.82_RC5.orig/src/structs.h 2013-10-27 21:46:25.000000000 +0100
1260 -+++ exim-4.82_RC5/src/structs.h 2013-10-27 21:47:32.000000000 +0100
1261 -@@ -282,7 +282,9 @@
1262 - BOOL verify_sender; /* Use this router when verifying a sender */
1263 - BOOL uid_set; /* Flag to indicate uid is set */
1264 - BOOL unseen; /* If TRUE carry on, even after success */
1265 --
1266 -+#ifdef SUPPORT_DSN
1267 -+ BOOL dsn_process; /* If TRUE, activate DSN for this router */
1268 -+#endif
1269 - int self_code; /* Encoded version of "self" */
1270 - uid_t uid; /* Fixed uid value */
1271 - gid_t gid; /* Fixed gid value */
1272 -@@ -547,6 +549,12 @@
1273 - uschar *auth_id; /* auth "login" name used by transport */
1274 - uschar *auth_sndr; /* AUTH arg to SMTP MAIL, used by transport */
1275 -
1276 -+ #ifdef SUPPORT_DSN
1277 -+ uschar *dsn_orcpt; /* DSN orcpt value */
1278 -+ int dsn_flags; /* DSN flags */
1279 -+ uschar *dsn_aware; /* DSN aware flag */
1280 -+ #endif
1281 -+
1282 - uid_t uid; /* uid for transporting */
1283 - gid_t gid; /* gid for transporting */
1284 -
1285 -diff -Naur exim-4.82_RC5.orig/src/transport.c exim-4.82_RC5/src/transport.c
1286 ---- exim-4.82_RC5.orig/src/transport.c 2013-10-27 21:46:25.000000000 +0100
1287 -+++ exim-4.82_RC5/src/transport.c 2013-10-27 21:47:32.000000000 +0100
1288 -@@ -1802,6 +1802,11 @@
1289 -
1290 - argv = child_exec_exim(CEE_RETURN_ARGV, TRUE, &i, FALSE, 0);
1291 -
1292 -+ #ifdef SUPPORT_DSN
1293 -+ /* Call with the dsn flag */
1294 -+ if (smtp_use_dsn) argv[i++] = US"-MCD";
1295 -+ #endif
1296 -+
1297 - if (smtp_authenticated) argv[i++] = US"-MCA";
1298 -
1299 - #ifdef SUPPORT_TLS
1300 -diff -Naur exim-4.82_RC5.orig/src/transports/smtp.c exim-4.82_RC5/src/transports/smtp.c
1301 ---- exim-4.82_RC5.orig/src/transports/smtp.c 2013-10-27 21:46:25.000000000 +0100
1302 -+++ exim-4.82_RC5/src/transports/smtp.c 2013-10-27 21:47:32.000000000 +0100
1303 -@@ -242,6 +242,16 @@
1304 - #endif
1305 - };
1306 -
1307 -+#ifdef SUPPORT_DSN
1308 -+/* some DSN flags for use later */
1309 -+
1310 -+static int rf_list[] = {rf_notify_never, rf_notify_success,
1311 -+ rf_notify_failure, rf_notify_delay };
1312 -+
1313 -+static uschar *rf_names[] = { "NEVER", "SUCCESS", "FAILURE", "DELAY" };
1314 -+#endif
1315 -+
1316 -+
1317 -
1318 - /* Local statics */
1319 -
1320 -@@ -1079,6 +1089,27 @@
1321 - else if (new[0] != 0) local_authenticated_sender = new;
1322 - }
1323 -
1324 -+#ifdef SUPPORT_DSN
1325 -+/* Add any DSN flags to the mail command */
1326 -+
1327 -+if (smtp_use_dsn)
1328 -+ {
1329 -+ uschar *p = buffer;
1330 -+ if (dsn_ret == dsn_ret_hdrs)
1331 -+ {
1332 -+ strcpy(p, " RET=HDRS");
1333 -+ while (*p) p++;
1334 -+ }
1335 -+ else if (dsn_ret == dsn_ret_full)
1336 -+ {
1337 -+ strcpy(p, " RET=FULL");
1338 -+ while (*p) p++;
1339 -+ }
1340 -+ if (dsn_envid != NULL)
1341 -+ string_format(p, sizeof(buffer) - (p-buffer), " ENVID=%s", dsn_envid);
1342 -+ }
1343 -+#endif
1344 -+
1345 - /* Add the authenticated sender address if present */
1346 -
1347 - if ((smtp_authenticated || ob->authenticated_sender_force) &&
1348 -@@ -1587,6 +1618,14 @@
1349 - {DEBUG(D_transport) debug_printf("PRDR usable\n");}
1350 - #endif
1351 -
1352 -+ #ifdef SUPPORT_DSN
1353 -+ /* Note if the server supports DSN */
1354 -+ smtp_use_dsn = dsn &&
1355 -+ esmtp && pcre_exec(regex_DSN, NULL, CS buffer, (int)Ustrlen(CS buffer), 0,
1356 -+ PCRE_EOPT, NULL, 0) >= 0;
1357 -+ DEBUG(D_transport) debug_printf("use_dsn=%d\n", smtp_use_dsn);
1358 -+ #endif
1359 -+
1360 - /* Note if the response to EHLO specifies support for the AUTH extension.
1361 - If it has, check that this host is one we want to authenticate to, and do
1362 - the business. The host name and address must be available when the
1363 -@@ -1746,18 +1785,66 @@
1364 - int count;
1365 - BOOL no_flush;
1366 -
1367 -+ #ifdef SUPPORT_DSN
1368 -+ /* philb - set dsn_aware flag for this recipient */
1369 -+ if(smtp_use_dsn)
1370 -+ addr->dsn_aware = string_copy("Y");
1371 -+ else
1372 -+ addr->dsn_aware = string_copy("N");
1373 -+ #endif
1374 -+
1375 - if (addr->transport_return != PENDING_DEFER) continue;
1376 -
1377 - address_count++;
1378 - no_flush = smtp_use_pipelining && (!mua_wrapper || addr->next != NULL);
1379 -
1380 -+ #ifdef SUPPORT_DSN
1381 -+ /* Add any DSN flags to the rcpt command and add to the sent string */
1382 -+
1383 -+ p = buffer;
1384 -+ *p = 0;
1385 -+
1386 -+ if (smtp_use_dsn)
1387 -+ {
1388 -+ if ((addr->dsn_flags & rf_dsnflags) != 0)
1389 -+ {
1390 -+ int i;
1391 -+ BOOL first = TRUE;
1392 -+ strcpy(p, " NOTIFY=");
1393 -+ while (*p) p++;
1394 -+ for (i = 0; i < 4; i++)
1395 -+ {
1396 -+ if ((addr->dsn_flags & rf_list[i]) != 0)
1397 -+ {
1398 -+ if (!first) *p++ = ',';
1399 -+ first = FALSE;
1400 -+ strcpy(p, rf_names[i]);
1401 -+ while (*p) p++;
1402 -+ }
1403 -+ }
1404 -+ }
1405 -+
1406 -+ if (addr->dsn_orcpt != NULL)
1407 -+ string_format(p, sizeof(buffer) - (p-buffer), " ORCPT=%s",
1408 -+ addr->dsn_orcpt);
1409 -+ }
1410 -+
1411 -+ #endif
1412 -+
1413 -+
1414 - /* Now send the RCPT command, and process outstanding responses when
1415 - necessary. After a timeout on RCPT, we just end the function, leaving the
1416 - yield as OK, because this error can often mean that there is a problem with
1417 - just one address, so we don't want to delay the host. */
1418 -
1419 -+ #ifdef SUPPORT_DSN
1420 -+ count = smtp_write_command(&outblock, no_flush, "RCPT TO:<%s>%s%s\r\n",
1421 -+ transport_rcpt_address(addr, tblock->rcpt_include_affixes), igquotstr, buffer);
1422 -+ #else
1423 - count = smtp_write_command(&outblock, no_flush, "RCPT TO:<%s>%s\r\n",
1424 - transport_rcpt_address(addr, tblock->rcpt_include_affixes), igquotstr);
1425 -+ #endif
1426 -+
1427 - if (count < 0) goto SEND_FAILED;
1428 - if (count > 0)
1429 - {