Gentoo Archives: gentoo-commits

From: Fabian Groffen <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: mail-mta/exim/files/, mail-mta/exim/
Date: Wed, 13 May 2020 17:20:35
Message-Id: 1589390397.4b998533b5bae4ff911d11eb2ece787fd4a9e4c8.grobian@gentoo
1 commit: 4b998533b5bae4ff911d11eb2ece787fd4a9e4c8
2 Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
3 AuthorDate: Wed May 13 17:19:39 2020 +0000
4 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
5 CommitDate: Wed May 13 17:19:57 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4b998533
7
8 mail-mta/exim: security cleanup
9
10 Bug: https://bugs.gentoo.org/722484
11 Package-Manager: Portage-2.3.89, Repoman-2.3.20
12 Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
13
14 mail-mta/exim/Manifest | 2 -
15 mail-mta/exim/exim-4.92.3.ebuild | 581 ---------------------
16 .../exim/files/exim-4.82-makefile-freebsd.patch | 45 --
17 .../exim/files/exim-4.89-as-needed-ldflags.patch | 145 -----
18 .../files/exim-4.92-fix-eval-expansion-32bit.patch | 51 --
19 .../exim/files/exim-4.92-localscan_dlopen.patch | 267 ----------
20 6 files changed, 1091 deletions(-)
21
22 diff --git a/mail-mta/exim/Manifest b/mail-mta/exim/Manifest
23 index e8a899771de..e08c0096757 100644
24 --- a/mail-mta/exim/Manifest
25 +++ b/mail-mta/exim/Manifest
26 @@ -1,5 +1,3 @@
27 -DIST exim-4.92.3.tar.xz 1773156 BLAKE2B 7866c23c862f5b5aadac709279f9ed376e526e90e8ca09d41c1789041ec0a3ecd48f8d2237e4d462e547efa2178babd5942d3142fef7419e16d1707fe23fa226 SHA512 ca6d6f50653502345511b683859b33aa02faa48454fb2100ff89fed3dcb8af8933e7bce68939365fdee42f96eec0c3b135cf748f4581e92a62be0f0ab093868a
28 DIST exim-4.93.0.4.tar.xz 1804696 BLAKE2B 721336101104d9c71b3bb6f432e382c28ad17d80cdb50d04213989e65a719d906caf8eb95639bfaf7a1bfdd62c7000d9df14484953446ecfca901fd7c708514e SHA512 84951849b69399d6f187d2801760dc0cb9e61c88c7c88aaca4e07e48120199a6be94b2236d058ffeacb8d611dd84056b610d480353c301a3ad5799768dd39d96
29 -DIST exim-pdf-4.92.3.tar.xz 2039436 BLAKE2B 8d20e7f0ebfcb573d08b490737923afc2cd2d5837f5c91bd2f3e6b5e637d86a5d5a59123c57ba9219ead675c72bfc46351d5b705d9533fab80bedeeca8bdd580 SHA512 3245a627a924db92e5a50e842e096731d08284f757274b5083ea234707c493abd6f27a3b34a2025e3acff167260df0f4ebe68b9f5832920c5f22c258143ab43f
30 DIST exim-pdf-4.93.0.4.tar.xz 2069744 BLAKE2B 28730134293d87b16d672df66119ff97aaf2d796cf28842bb5bf6831a0be6a186a5cce503200b9fc985aaa14386053ca83c259625949634c5a28937b285247ca SHA512 929b4198a3e8764a64478e7ff5a9c7398ad1990114206b68494b1f1f563c23405c7b440e2f21a9f777e9e3cd3a3398d6faea3b882407f731ef3a767c27fd9361
31 DIST system_filter.exim.gz 3075 BLAKE2B d05e872b5cef377d29126cda03fc0a74c8777b2119b76ff43da6e8de808035eb9bfcb034a85d81824f135d484e864bfc0629fc1af2c228a7277d5ee7cf9cde79 SHA512 cb358d3ce2499a0bb5920d962a06f2af8486e55ec90c8c928bd8e3aefb279aa57f5f960d5adfcef68bd94110b405eaa144e9629cfe6014a529c79c544600bbf3
32
33 diff --git a/mail-mta/exim/exim-4.92.3.ebuild b/mail-mta/exim/exim-4.92.3.ebuild
34 deleted file mode 100644
35 index 03bdaab227c..00000000000
36 --- a/mail-mta/exim/exim-4.92.3.ebuild
37 +++ /dev/null
38 @@ -1,581 +0,0 @@
39 -# Copyright 1999-2020 Gentoo Authors
40 -# Distributed under the terms of the GNU General Public License v2
41 -
42 -EAPI="7"
43 -
44 -inherit db-use toolchain-funcs multilib pam systemd
45 -
46 -IUSE="arc dane dcc +dkim dlfunc dmarc +dnsdb doc dovecot-sasl dsn elibc_glibc exiscan-acl gnutls idn ipv6 ldap libressl lmtp maildir mbx mysql nis pam perl pkcs11 postgres +prdr proxy radius redis sasl selinux spf sqlite srs ssl syslog tcpd +tpda X"
47 -REQUIRED_USE="
48 - arc? ( dkim spf )
49 - dane? ( ssl !gnutls )
50 - dmarc? ( dkim spf )
51 - gnutls? ( ssl )
52 - pkcs11? ( ssl )
53 - spf? ( exiscan-acl )
54 - srs? ( exiscan-acl )
55 - !ssl? ( !dkim )
56 -"
57 -# NOTE on USE="gnutls dane", gnutls[dane] is masked in base, unmasked
58 -# for x86 and amd64 only, due to this, repoman won't allow depending on
59 -# gnutls[dane] for all else. Because we cannot express USE=dane when
60 -# USE=gnutls is in effect only in package.use.mask, the only option we
61 -# have left is to a) ignore the dependency (but that results in bug
62 -# #661164) or b) mask the usage of USE=dane with USE=gnutls. Both are
63 -# incorrect, but b) is the only "correct" view from repoman.
64 -
65 -COMM_URI="https://downloads.exim.org/exim4$([[ ${PV} == *_rc* ]] && echo /test)"
66 -
67 -DESCRIPTION="A highly configurable, drop-in replacement for sendmail"
68 -SRC_URI="${COMM_URI}/${P//rc/RC}.tar.xz
69 - mirror://gentoo/system_filter.exim.gz
70 - doc? ( ${COMM_URI}/${PN}-pdf-${PV//rc/RC}.tar.xz )"
71 -HOMEPAGE="https://www.exim.org/"
72 -
73 -SLOT="0"
74 -LICENSE="GPL-2"
75 -KEYWORDS="~alpha amd64 arm ~hppa ~ia64 ppc ppc64 sparc x86 ~x86-solaris"
76 -
77 -COMMON_DEPEND=">=sys-apps/sed-4.0.5
78 - ( >=sys-libs/db-3.2:= <sys-libs/db-6:= )
79 - dev-libs/libpcre
80 - idn? ( net-dns/libidn:= net-dns/libidn2:= )
81 - perl? ( dev-lang/perl:= )
82 - pam? ( sys-libs/pam )
83 - tcpd? ( sys-apps/tcp-wrappers )
84 - ssl? (
85 - !libressl? ( dev-libs/openssl:0= )
86 - libressl? ( dev-libs/libressl:= )
87 - )
88 - gnutls? (
89 - net-libs/gnutls:0=[pkcs11?]
90 - dev-libs/libtasn1
91 - )
92 - ldap? ( >=net-nds/openldap-2.0.7 )
93 - nis? (
94 - elibc_glibc? (
95 - net-libs/libtirpc
96 - >=net-libs/libnsl-1:=
97 - )
98 - )
99 - mysql? ( dev-db/mysql-connector-c:= )
100 - postgres? ( dev-db/postgresql:= )
101 - sasl? ( >=dev-libs/cyrus-sasl-2.1.26-r2 )
102 - redis? ( dev-libs/hiredis )
103 - spf? ( >=mail-filter/libspf2-1.2.5-r1 )
104 - dmarc? ( mail-filter/opendmarc )
105 - srs? ( mail-filter/libsrs_alt )
106 - X? (
107 - x11-libs/libX11
108 - x11-libs/libXmu
109 - x11-libs/libXt
110 - x11-libs/libXaw
111 - )
112 - sqlite? ( dev-db/sqlite )
113 - radius? ( net-dialup/freeradius-client )
114 - virtual/libiconv
115 - elibc_glibc? ( net-libs/libnsl )
116 - "
117 - # added X check for #57206
118 -BDEPEND="virtual/pkgconfig"
119 -DEPEND="${COMMON_DEPEND}"
120 -RDEPEND="${COMMON_DEPEND}
121 - !mail-mta/courier
122 - !mail-mta/esmtp
123 - !mail-mta/mini-qmail
124 - !<mail-mta/msmtp-1.4.19-r1
125 - !>=mail-mta/msmtp-1.4.19-r1[mta]
126 - !mail-mta/netqmail
127 - !mail-mta/nullmailer
128 - !mail-mta/postfix
129 - !mail-mta/qmail-ldap
130 - !mail-mta/sendmail
131 - !mail-mta/opensmtpd
132 - !<mail-mta/ssmtp-2.64-r2
133 - !>=mail-mta/ssmtp-2.64-r2[mta]
134 - !net-mail/mailwrapper
135 - >=net-mail/mailbase-0.00-r5
136 - virtual/logger
137 - dcc? ( mail-filter/dcc )
138 - selinux? ( sec-policy/selinux-exim )
139 - "
140 -
141 -PATCHES=(
142 - "${FILESDIR}"/exim-4.69-r1.27021.patch
143 - "${FILESDIR}"/exim-4.92-localscan_dlopen.patch
144 -)
145 -
146 -S=${WORKDIR}/${P//rc/RC}
147 -
148 -src_prepare() {
149 - # Legacy patches which need a respin for -p1
150 - eapply -p0 "${FILESDIR}"/exim-4.14-tail.patch
151 - eapply -p0 "${FILESDIR}"/exim-4.74-radius-db-ENV-clash.patch # 287426
152 - eapply -p0 "${FILESDIR}"/exim-4.82-makefile-freebsd.patch # 235785
153 - eapply -p0 "${FILESDIR}"/exim-4.89-as-needed-ldflags.patch # 352265, 391279
154 - eapply -p0 "${FILESDIR}"/exim-4.76-crosscompile.patch # 266591
155 - eapply -p2 "${FILESDIR}"/exim-4.92-fix-eval-expansion-32bit.patch #687554
156 -
157 - if use maildir ; then
158 - eapply "${FILESDIR}"/exim-4.20-maildir.patch
159 - else
160 - eapply -p0 "${FILESDIR}"/exim-4.80-spool-mail-group.patch # 438606
161 - fi
162 -
163 - default
164 -
165 - # user Exim believes it should be
166 - MAILUSER=mail
167 - MAILGROUP=mail
168 - if use prefix && [[ ${EUID} != 0 ]] ; then
169 - MAILUSER=$(id -un)
170 - MAILGROUP=$(id -gn)
171 - fi
172 -}
173 -
174 -src_configure() {
175 - # general config and paths
176 -
177 - local aliases="${EPREFIX}/etc/mail/aliases"
178 - sed -i \
179 - -e "/SYSTEM_ALIASES_FILE/s'SYSTEM_ALIASES_FILE'${aliases}'" \
180 - src/configure.default || die
181 -
182 - sed -i -e 's/^buildname=.*/buildname=exim-gentoo/' Makefile || die
183 -
184 - if use elibc_musl; then
185 - sed -i -e 's/^LIBS = -lnsl/LIBS =/g' OS/Makefile-Linux || die
186 - fi
187 -
188 - local conffile="${EPREFIX}/etc/exim/exim.conf"
189 - sed -e "48i\CFLAGS=${CFLAGS}" \
190 - -e "s:BIN_DIRECTORY=/usr/exim/bin:BIN_DIRECTORY=${EPREFIX}/usr/sbin:" \
191 - -e "s:EXIM_USER=:EXIM_USER=${MAILUSER}:" \
192 - -e "s:CONFIGURE_FILE=.*$:CONFIGURE_FILE=${conffile}:" \
193 - -e "s:ZCAT_COMMAND=.*$:ZCAT_COMMAND=${EPREFIX}/bin/zcat:" \
194 - -e "s:COMPRESS_COMMAND=.*$:COMPRESS_COMMAND=${EPREFIX}/bin/gzip:" \
195 - src/EDITME > Local/Makefile || die
196 -
197 - # work on Local/Makefile from now on
198 - cd Local
199 -
200 - cat >> Makefile <<- EOC
201 - INFO_DIRECTORY=${EPREFIX}/usr/share/info
202 - PID_FILE_PATH=${EPREFIX}/run/exim.pid
203 - SPOOL_DIRECTORY=${EPREFIX}/var/spool/exim
204 - HAVE_ICONV=yes
205 - EOC
206 -
207 - # if we use libiconv, now is the time to tell so
208 - use !elibc_glibc && use !elibc_musl && \
209 - echo "EXTRALIBS_EXIM=-liconv" >> Makefile
210 -
211 - # support for IPv6
212 - if use ipv6; then
213 - cat >> Makefile <<- EOC
214 - HAVE_IPV6=YES
215 - EOC
216 - fi
217 -
218 - # support i18n/IDNA
219 - if use idn; then
220 - cat >> Makefile <<- EOC
221 - SUPPORT_I18N=yes
222 - SUPPORT_I18N_2008=yes
223 - EXTRALIBS_EXIM += -lidn -lidn2
224 - EOC
225 - fi
226 -
227 - #
228 - # mail storage formats
229 - #
230 -
231 - # mailstore is Exim's traditional storage format
232 - cat >> Makefile <<- EOC
233 - SUPPORT_MAILSTORE=yes
234 - EOC
235 -
236 - # mbox
237 - if use mbx; then
238 - cat >> Makefile <<- EOC
239 - SUPPORT_MBX=yes
240 - EOC
241 - fi
242 -
243 - # maildir
244 - if use maildir; then
245 - cat >> Makefile <<- EOC
246 - SUPPORT_MAILDIR=yes
247 - EOC
248 - fi
249 -
250 - #
251 - # lookup methods
252 -
253 - # use the "native" interfaces to the DBM and CDB libraries, support
254 - # passwd and directory lookups by default
255 - local DB_VERS="5.3 5.1 4.8 4.7 4.6 4.5 4.4 4.3 4.2 3.2"
256 - cat >> Makefile <<- EOC
257 - USE_DB=yes
258 - CFLAGS+=-I$(db_includedir ${DB_VERS})
259 - DBMLIB=-l$(db_libname ${DB_VERS})
260 - LOOKUP_CDB=yes
261 - LOOKUP_PASSWD=yes
262 - LOOKUP_DSEARCH=yes
263 - EOC
264 -
265 - if ! use dnsdb; then
266 - # DNSDB lookup is enabled by default
267 - sed -i -e 's:^LOOKUP_DNSDB=yes:# LOOKUP_DNSDB=yes:' Makefile || die
268 - fi
269 -
270 - if use ldap; then
271 - cat >> Makefile <<- EOC
272 - LOOKUP_LDAP=yes
273 - LDAP_LIB_TYPE=OPENLDAP2
274 - LOOKUP_INCLUDE += -I"${EPREFIX}"/usr/include/ldap
275 - LOOKUP_LIBS += -lldap -llber
276 - EOC
277 - fi
278 -
279 - if use mysql; then
280 - cat >> Makefile <<- EOC
281 - LOOKUP_MYSQL=yes
282 - LOOKUP_INCLUDE += $(mysql_config --include)
283 - LOOKUP_LIBS += $(mysql_config --libs)
284 - EOC
285 - fi
286 -
287 - if use nis; then
288 - cat >> Makefile <<- EOC
289 - LOOKUP_NIS=yes
290 - LOOKUP_NISPLUS=yes
291 - EOC
292 - if use elibc_glibc ; then
293 - cat >> Makefile <<- EOC
294 - CFLAGS += -I"${EPREFIX}"/usr/include/tirpc
295 - EOC
296 - fi
297 - fi
298 -
299 - if use postgres; then
300 - cat >> Makefile <<- EOC
301 - LOOKUP_PGSQL=yes
302 - LOOKUP_INCLUDE += -I$(pg_config --includedir)
303 - LOOKUP_LIBS += -L$(pg_config --libdir) -lpq
304 - EOC
305 - fi
306 -
307 - if use sqlite; then
308 - cat >> Makefile <<- EOC
309 - LOOKUP_SQLITE=yes
310 - LOOKUP_SQLITE_PC=sqlite3
311 - EOC
312 - fi
313 -
314 - if use redis; then
315 - cat >> Makefile <<- EOC
316 - LOOKUP_REDIS=yes
317 - LOOKUP_LIBS += -lhiredis
318 - EOC
319 - fi
320 -
321 - # Exim monitor, enabled by default, controlled via X USE-flag,
322 - # disable if not requested, bug #46778
323 - if use X; then
324 - cp ../exim_monitor/EDITME eximon.conf || die
325 - else
326 - sed -i -e '/^EXIM_MONITOR=/s/^/# /' Makefile || die
327 - fi
328 -
329 - #
330 - # features
331 - #
332 -
333 - # content scanning support
334 - if use exiscan-acl; then
335 - cat >> Makefile <<- EOC
336 - WITH_CONTENT_SCAN=yes
337 - EOC
338 - fi
339 -
340 - # DomainKeys Identified Mail, RFC4871
341 - if ! use dkim; then
342 - # DKIM is enabled by default
343 - cat >> Makefile <<- EOC
344 - DISABLE_DKIM=yes
345 - EOC
346 - fi
347 -
348 - # Per-Recipient-Data-Response
349 - if ! use prdr; then
350 - # PRDR is enabled by default
351 - cat >> Makefile <<- EOC
352 - DISABLE_PRDR=yes
353 - EOC
354 - fi
355 -
356 - # Transport post-delivery actions
357 - if use !tpda && use !dane; then
358 - # EVENT is enabled by default
359 - cat >> Makefile <<- EOC
360 - DISABLE_EVENT=yes
361 - EOC
362 - fi
363 -
364 - # log to syslog
365 - if use syslog; then
366 - local eximlog="${EPREFIX}/var/log/exim/exim_%s.log"
367 - sed -i \
368 - -e "s:LOG_FILE_PATH=${eximlog}:LOG_FILE_PATH=syslog:" \
369 - Makefile || die
370 - cat >> Makefile <<- EOC
371 - LOG_FILE_PATH=syslog
372 - EOC
373 - else
374 - cat >> Makefile <<- EOC
375 - LOG_FILE_PATH=${EPREFIX}/var/log/exim/exim_%s.log
376 - EOC
377 - fi
378 -
379 - # starttls support (ssl)
380 - if use ssl; then
381 - echo "SUPPORT_TLS=yes" >> Makefile
382 - if use gnutls; then
383 - echo "USE_GNUTLS=yes" >> Makefile
384 - echo "USE_GNUTLS_PC=gnutls" >> Makefile
385 - use pkcs11 || echo "AVOID_GNUTLS_PKCS11=yes" >> Makefile
386 - else
387 - echo "USE_OPENSSL_PC=openssl" >> Makefile
388 - fi
389 - fi
390 -
391 - # TCP wrappers
392 - if use tcpd; then
393 - cat >> Makefile <<- EOC
394 - USE_TCP_WRAPPERS=yes
395 - EXTRALIBS_EXIM += -lwrap
396 - EOC
397 - fi
398 -
399 - # Light Mail Transport Protocol
400 - if use lmtp; then
401 - cat >> Makefile <<- EOC
402 - TRANSPORT_LMTP=yes
403 - EOC
404 - fi
405 -
406 - # embedded Perl
407 - if use perl; then
408 - cat >> Makefile <<- EOC
409 - EXIM_PERL=perl.o
410 - EOC
411 - fi
412 -
413 - # dlfunc
414 - if use dlfunc; then
415 - cat >> Makefile <<- EOC
416 - EXPAND_DLFUNC=yes
417 - HAVE_LOCAL_SCAN=yes
418 - DLOPEN_LOCAL_SCAN=yes
419 - EOC
420 - fi
421 -
422 - # Proxy Protocol
423 - if use proxy; then
424 - cat >> Makefile <<- EOC
425 - SUPPORT_PROXY=yes
426 - EOC
427 - fi
428 -
429 - # DANE
430 - if use dane; then
431 - cat >> Makefile <<- EOC
432 - SUPPORT_DANE=yes
433 - EOC
434 - fi
435 -
436 - # Sender Policy Framework
437 - if use spf; then
438 - cat >> Makefile <<- EOC
439 - SUPPORT_SPF=yes
440 - EXTRALIBS_EXIM += -lspf2
441 - EOC
442 - fi
443 -
444 - #
445 - # experimental features
446 - #
447 -
448 - # Authenticated Receive Chain
449 - if use arc; then
450 - echo "EXPERIMENTAL_ARC=yes">> Makefile
451 - fi
452 -
453 - # Distributed Checksum Clearinghouse
454 - if use dcc; then
455 - echo "EXPERIMENTAL_DCC=yes">> Makefile
456 - fi
457 -
458 - # Sender Rewriting Scheme
459 - if use srs; then
460 - cat >> Makefile <<- EOC
461 - EXPERIMENTAL_SRS=yes
462 - EXTRALIBS_EXIM += -lsrs_alt
463 - EOC
464 - fi
465 -
466 - # DMARC
467 - if use dmarc; then
468 - cat >> Makefile <<- EOC
469 - EXPERIMENTAL_DMARC=yes
470 - EXTRALIBS_EXIM += -lopendmarc
471 - EOC
472 - fi
473 -
474 - # Delivery Sender Notifications extra information in fail message
475 - if use dsn; then
476 - cat >> Makefile <<- EOC
477 - EXPERIMENTAL_DSN_INFO=yes
478 - EOC
479 - fi
480 -
481 - #
482 - # authentication (SMTP AUTH)
483 - #
484 -
485 - # standard bits
486 - cat >> Makefile <<- EOC
487 - AUTH_SPA=yes
488 - AUTH_CRAM_MD5=yes
489 - AUTH_PLAINTEXT=yes
490 - EOC
491 -
492 - # Cyrus SASL
493 - if use sasl; then
494 - cat >> Makefile <<- EOC
495 - CYRUS_SASLAUTHD_SOCKET=${EPREFIX}/run/saslauthd/mux
496 - AUTH_CYRUS_SASL=yes
497 - AUTH_LIBS += -lsasl2
498 - EOC
499 - fi
500 -
501 - # Dovecot
502 - if use dovecot-sasl; then
503 - cat >> Makefile <<- EOC
504 - AUTH_DOVECOT=yes
505 - EOC
506 - fi
507 -
508 - # Pluggable Authentication Modules
509 - if use pam; then
510 - cat >> Makefile <<- EOC
511 - SUPPORT_PAM=yes
512 - AUTH_LIBS += -lpam
513 - EOC
514 - fi
515 -
516 - # Radius
517 - if use radius; then
518 - cat >> Makefile <<- EOC
519 - RADIUS_CONFIG_FILE=${EPREFIX}/etc/radiusclient/radiusclient.conf
520 - RADIUS_LIB_TYPE=RADIUSCLIENTNEW
521 - AUTH_LIBS += -lfreeradius-client
522 - EOC
523 - fi
524 -}
525 -
526 -src_compile() {
527 - emake CC="$(tc-getCC)" HOSTCC="$(tc-getBUILD_CC)" \
528 - AR="$(tc-getAR) cq" RANLIB="$(tc-getRANLIB)" FULLECHO=''
529 -}
530 -
531 -src_install() {
532 - cd "${S}"/build-exim-gentoo || die
533 - dosbin exim
534 - if use X; then
535 - dosbin eximon.bin
536 - dosbin eximon
537 - fi
538 - fperms 4755 /usr/sbin/exim
539 -
540 - dosym exim /usr/sbin/sendmail
541 - dosym exim /usr/sbin/rsmtp
542 - dosym exim /usr/sbin/rmail
543 - dosym ../sbin/exim /usr/bin/mailq
544 - dosym ../sbin/exim /usr/bin/newaliases
545 - dosym ../sbin/sendmail /usr/lib/sendmail
546 -
547 - for i in exicyclog exim_dbmbuild exim_dumpdb exim_fixdb exim_lock \
548 - exim_tidydb exinext exiwhat exigrep eximstats exiqsumm exiqgrep \
549 - convert4r3 convert4r4 exipick
550 - do
551 - dosbin $i
552 - done
553 -
554 - dodoc -r "${S}"/doc/.
555 - doman "${S}"/doc/exim.8
556 - use dsn && dodoc "${S}"/README.DSN
557 - use doc && dodoc "${WORKDIR}"/${PN}-pdf-${PV//rc/RC}/doc/*.pdf
558 -
559 - # conf files
560 - insinto /etc/exim
561 - newins "${S}"/src/configure.default exim.conf.dist
562 - if use exiscan-acl; then
563 - newins "${S}"/src/configure.default exim.conf.exiscan-acl
564 - fi
565 - doins "${WORKDIR}"/system_filter.exim
566 - doins "${FILESDIR}"/auth_conf.sub
567 -
568 - pamd_mimic system-auth exim auth account
569 -
570 - # headers, #436406
571 - if use dlfunc ; then
572 - # fixup includes so they actually can be found when including
573 - sed -i \
574 - -e '/#include "\(config\|store\|mytypes\).h"/s:"\(.\+\)":<exim/\1>:' \
575 - local_scan.h || die
576 - insinto /usr/include/exim
577 - doins {config,local_scan}.h ../src/{mytypes,store}.h
578 - fi
579 -
580 - insinto /etc/logrotate.d
581 - newins "${FILESDIR}/exim.logrotate" exim
582 -
583 - newinitd "${FILESDIR}"/exim.rc10 exim
584 - newconfd "${FILESDIR}"/exim.confd exim
585 -
586 - systemd_dounit \
587 - "${FILESDIR}"/{exim.service,exim.socket,exim-submission.socket}
588 - systemd_newunit \
589 - "${FILESDIR}"/exim_at.service 'exim@.service'
590 - systemd_newunit \
591 - "${FILESDIR}"/exim-submission_at.service 'exim-submission@.service'
592 -
593 - diropts -m 0750 -o ${MAILUSER} -g ${MAILGROUP}
594 - keepdir /var/log/${PN}
595 -}
596 -
597 -pkg_postinst() {
598 - if [[ ! -f ${EROOT}/etc/exim/exim.conf ]] ; then
599 - einfo "${EROOT}/etc/exim/system_filter.exim is a sample system_filter."
600 - einfo "${EROOT}/etc/exim/auth_conf.sub contains the configuration sub"
601 - einfo "for using smtp auth."
602 - einfo "Please create ${EROOT}/etc/exim/exim.conf from"
603 - einfo " ${EROOT}/etc/exim/exim.conf.dist."
604 - fi
605 - if use dcc ; then
606 - einfo "DCC support is experimental, you can find some limited"
607 - einfo "documentation at the bottom of this prerelease message:"
608 - einfo "http://article.gmane.org/gmane.mail.exim.devel/3579"
609 - fi
610 - use srs && einfo "SRS support is experimental"
611 - if use dmarc ; then
612 - einfo "DMARC support is experimental. See global settings to"
613 - einfo "configure DMARC, for usage see the documentation at "
614 - einfo "experimental-spec.txt."
615 - fi
616 - use dsn && einfo "extra information in fail DSN message is experimental"
617 - elog "The obsolete acl condition 'demime' is removed, the replacements"
618 - elog "are the ACLs acl_smtp_mime and acl_not_smtp_mime"
619 -}
620
621 diff --git a/mail-mta/exim/files/exim-4.82-makefile-freebsd.patch b/mail-mta/exim/files/exim-4.82-makefile-freebsd.patch
622 deleted file mode 100644
623 index 9693d4945ad..00000000000
624 --- a/mail-mta/exim/files/exim-4.82-makefile-freebsd.patch
625 +++ /dev/null
626 @@ -1,45 +0,0 @@
627 ---- OS/Makefile-FreeBSD.orig 2013-09-30 19:59:09.000000000 +0200
628 -+++ OS/Makefile-FreeBSD 2013-09-30 20:01:22.000000000 +0200
629 -@@ -1,10 +1,8 @@
630 --# Exim: OS-specific make file for FreeBSD
631 --# There's no setting of CFLAGS here, to allow the system default
632 --# for "make" to be the default.
633 --
634 --CHOWN_COMMAND=/usr/sbin/chown
635 --STRIP_COMMAND=/usr/bin/strip
636 --CHMOD_COMMAND=/bin/chmod
637 -+# Exim: OS-specific FreeBSD make file, modified for Gentoo Prefix
638 -+
639 -+CHOWN_COMMAND=look_for_it
640 -+STRIP_COMMAND=
641 -+CHMOD_COMMAND=look_for_it
642 -
643 - HAVE_SA_LEN=YES
644 -
645 -@@ -15,17 +13,9 @@
646 - CFLAGS_DYNAMIC=-shared -rdynamic -fPIC
647 -
648 - # FreeBSD always ships with Berkeley DB
649 -+DBMLIB = -ldb
650 - USE_DB=yes
651 -
652 --# This code for building outside ports suggested by Richard Clayton
653 --.ifdef X11BASE
654 --X11=${X11BASE}
655 --.elifdef LOCALBASE
656 --X11=$(LOCALBASE)
657 --.else
658 --X11=/usr/local
659 --.endif
660 --
661 - # nb: FreeBSD is entirely elf; objformat was removed prior to FreeBSD 7
662 - # http://www.freebsd.org/cgi/cvsweb.cgi/src/usr.bin/objformat/Attic/objformat.c
663 - # deleted Jan 2007.
664 -@@ -37,6 +27,7 @@
665 - # switch to default to ELF came with FreeBSD 3. elf(5) claims ELF support
666 - # introduced in FreeBSD 2.2.6.
667 - #
668 -+X11=/usr/X11R6
669 - XINCLUDE=-I$(X11)/include
670 - XLFLAGS=-L$(X11)/lib -Wl,-rpath,${X11}/lib
671 - X11_LD_LIB=$(X11)/lib
672
673 diff --git a/mail-mta/exim/files/exim-4.89-as-needed-ldflags.patch b/mail-mta/exim/files/exim-4.89-as-needed-ldflags.patch
674 deleted file mode 100644
675 index 49e430939fc..00000000000
676 --- a/mail-mta/exim/files/exim-4.89-as-needed-ldflags.patch
677 +++ /dev/null
678 @@ -1,145 +0,0 @@
679 -https://bugs.gentoo.org/show_bug.cgi?id=352265
680 -
681 -Make sure LDFLAGS comes first, such that all libraries are considered,
682 -and not discarded when --as-needed is in effect.
683 -
684 -https://bugs.gentoo.org/show_bug.cgi?id=391279
685 -
686 -Use LDFLAGS for all targets, not just the exim binary, such that
687 ---as-needed works as well.
688 -
689 -
690 ---- OS/Makefile-Base
691 -+++ OS/Makefile-Base
692 -@@ -346,12 +346,12 @@
693 - buildrouters buildtransports \
694 - $(OBJ_EXIM) version.o
695 - @echo "$(LNCC) -o exim"
696 -- $(FE)$(PURIFY) $(LNCC) -o exim $(LFLAGS) $(OBJ_EXIM) version.o \
697 -+ $(FE)$(PURIFY) $(LNCC) -o exim $(LDFLAGS) $(OBJ_EXIM) version.o \
698 - routers/routers.a transports/transports.a lookups/lookups.a \
699 - auths/auths.a pdkim/pdkim.a \
700 - $(LIBRESOLV) $(LIBS) $(LIBS_EXIM) $(IPV6_LIBS) $(EXTRALIBS) \
701 - $(EXTRALIBS_EXIM) $(DBMLIB) $(LOOKUP_LIBS) $(AUTH_LIBS) \
702 -- $(PERL_LIBS) $(TLS_LIBS) $(PCRE_LIBS) $(LDFLAGS)
703 -+ $(PERL_LIBS) $(TLS_LIBS) $(PCRE_LIBS) $(LFLAGS)
704 - @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
705 - echo $(STRIP_COMMAND) exim; \
706 - $(STRIP_COMMAND) exim; \
707 -@@ -367,8 +367,8 @@
708 -
709 - exim_dumpdb: $(OBJ_DUMPDB)
710 - @echo "$(LNCC) -o exim_dumpdb"
711 -- $(FE)$(LNCC) $(CFLAGS) $(INCLUDE) -o exim_dumpdb $(LFLAGS) $(OBJ_DUMPDB) \
712 -- $(LIBS) $(EXTRALIBS) $(DBMLIB)
713 -+ $(FE)$(LNCC) $(CFLAGS) $(INCLUDE) -o exim_dumpdb $(LDFLAGS) $(OBJ_DUMPDB) \
714 -+ $(LIBS) $(EXTRALIBS) $(DBMLIB) $(LFLAGS)
715 - @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
716 - echo $(STRIP_COMMAND) exim_dumpdb; \
717 - $(STRIP_COMMAND) exim_dumpdb; \
718 -@@ -382,8 +382,8 @@
719 -
720 - exim_fixdb: $(OBJ_FIXDB) buildauths
721 - @echo "$(LNCC) -o exim_fixdb"
722 -- $(FE)$(LNCC) $(CFLAGS) $(INCLUDE) -o exim_fixdb $(LFLAGS) $(OBJ_FIXDB) \
723 -- auths/auths.a $(LIBS) $(EXTRALIBS) $(DBMLIB)
724 -+ $(FE)$(LNCC) $(CFLAGS) $(INCLUDE) -o exim_fixdb $(LDFLAGS) $(OBJ_FIXDB) \
725 -+ auths/auths.a $(LIBS) $(EXTRALIBS) $(DBMLIB) $(LFLAGS)
726 - @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
727 - echo $(STRIP_COMMAND) exim_fixdb; \
728 - $(STRIP_COMMAND) exim_fixdb; \
729 -@@ -397,8 +397,8 @@
730 -
731 - exim_tidydb: $(OBJ_TIDYDB)
732 - @echo "$(LNCC) -o exim_tidydb"
733 -- $(FE)$(LNCC) $(CFLAGS) $(INCLUDE) -o exim_tidydb $(LFLAGS) $(OBJ_TIDYDB) \
734 -- $(LIBS) $(EXTRALIBS) $(DBMLIB)
735 -+ $(FE)$(LNCC) $(CFLAGS) $(INCLUDE) -o exim_tidydb $(LDFLAGS) $(OBJ_TIDYDB) \
736 -+ $(LIBS) $(EXTRALIBS) $(DBMLIB) $(LFLAGS)
737 - @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
738 - echo $(STRIP_COMMAND) exim_tidydb; \
739 - $(STRIP_COMMAND) exim_tidydb; \
740 -@@ -410,8 +410,8 @@
741 -
742 - exim_dbmbuild: exim_dbmbuild.o
743 - @echo "$(LNCC) -o exim_dbmbuild"
744 -- $(FE)$(LNCC) $(CFLAGS) $(INCLUDE) -o exim_dbmbuild $(LFLAGS) exim_dbmbuild.o \
745 -- $(LIBS) $(EXTRALIBS) $(DBMLIB)
746 -+ $(FE)$(LNCC) $(CFLAGS) $(INCLUDE) -o exim_dbmbuild $(LDFLAGS) exim_dbmbuild.o \
747 -+ $(LIBS) $(EXTRALIBS) $(DBMLIB) $(LFLAGS)
748 - @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
749 - echo $(STRIP_COMMAND) exim_dbmbuild; \
750 - $(STRIP_COMMAND) exim_dbmbuild; \
751 -@@ -425,8 +425,8 @@
752 - @echo "$(CC) exim_lock.c"
753 - $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) exim_lock.c
754 - @echo "$(LNCC) -o exim_lock"
755 -- $(FE)$(LNCC) -o exim_lock $(LFLAGS) exim_lock.o \
756 -- $(LIBS) $(EXTRALIBS)
757 -+ $(FE)$(LNCC) -o exim_lock $(LDFLAGS) exim_lock.o \
758 -+ $(LIBS) $(EXTRALIBS) $(LFLAGS)
759 - @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
760 - echo $(STRIP_COMMAND) exim_lock; \
761 - $(STRIP_COMMAND) exim_lock; \
762 -@@ -462,9 +462,9 @@
763 - $(FE)$(CC) -o em_version.o -c \
764 - $(CFLAGS) $(XINCLUDE) -I. ../exim_monitor/em_version.c
765 - @echo "$(LNCC) -o eximon.bin"
766 -- $(FE)$(PURIFY) $(LNCC) -o eximon.bin em_version.o $(LFLAGS) $(XLFLAGS) \
767 -+ $(FE)$(PURIFY) $(LNCC) -o eximon.bin em_version.o $(LDFLAGS) $(XLFLAGS) \
768 - $(OBJ_MONBIN) -lXaw -lXmu -lXt -lXext -lX11 $(PCRE_LIBS) \
769 -- $(LIBS) $(LIBS_EXIMON) $(EXTRALIBS) $(EXTRALIBS_EXIMON) -lc
770 -+ $(LIBS) $(LIBS_EXIMON) $(EXTRALIBS) $(EXTRALIBS_EXIMON) -lc $(LFLAGS)
771 - @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
772 - echo $(STRIP_COMMAND) eximon.bin; \
773 - $(STRIP_COMMAND) eximon.bin; \
774 -@@ -780,9 +780,9 @@
775 - string.o tod.o version.o utf8.o
776 - $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE dbfn.c
777 - $(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY store.c
778 -- $(LNCC) -o test_dbfn $(LFLAGS) dbfn.o \
779 -+ $(LNCC) -o test_dbfn $(LDFLAGS) dbfn.o \
780 - dummies.o sa-globals.o sa-os.o store.o string.o \
781 -- tod.o version.o utf8.o $(LIBS) $(DBMLIB) $(LDFLAGS)
782 -+ tod.o version.o utf8.o $(LIBS) $(DBMLIB) $(LFLAGS)
783 - rm -f dbfn.o store.o
784 -
785 - test_host: config.h child.c host.c dns.c dummies.c sa-globals.o os.o \
786 -@@ -790,29 +790,29 @@
787 - $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -DTEST_HOST host.c
788 - $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -DTEST_HOST dns.c
789 - $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -DTEST_HOST dummies.c
790 -- $(LNCC) -o test_host $(LFLAGS) \
791 -+ $(LNCC) -o test_host $(LDFLAGS) \
792 - host.o child.o dns.o dummies.o sa-globals.o os.o store.o string.o \
793 -- tod.o tree.o $(LIBS) $(LIBRESOLV)
794 -+ tod.o tree.o $(LIBS) $(LIBRESOLV) $(LFLAGS)
795 - rm -f child.o dummies.o host.o dns.o
796 -
797 - test_os: os.h os.c dummies.o sa-globals.o store.o string.o tod.o utf8.o
798 - $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE os.c
799 -- $(LNCC) -o test_os $(LFLAGS) os.o dummies.o \
800 -- sa-globals.o store.o string.o tod.o utf8.o $(LIBS) $(LDFLAGS)
801 -+ $(LNCC) -o test_os $(LDFLAGS) os.o dummies.o \
802 -+ sa-globals.o store.o string.o tod.o utf8.o $(LIBS) $(LFLAGS)
803 - rm -f os.o
804 -
805 - test_parse: config.h parse.c dummies.o sa-globals.o \
806 - store.o string.o tod.o version.o utf8.o
807 - $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE parse.c
808 -- $(LNCC) -o test_parse $(LFLAGS) parse.o \
809 -+ $(LNCC) -o test_parse $(LDFLAGS) parse.o \
810 - dummies.o sa-globals.o store.o string.o tod.o version.o \
811 -- utf8.o $(LDFLAGS)
812 -+ utf8.o $(LFLAGS)
813 - rm -f parse.o
814 -
815 - test_string: config.h string.c dummies.o sa-globals.o store.o tod.o utf8.o
816 - $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE string.c
817 -- $(LNCC) -o test_string $(LFLAGS) -DSTAND_ALONE string.o \
818 -- dummies.o sa-globals.o store.o tod.o utf8.o $(LIBS) $(LDFLAGS)
819 -+ $(LNCC) -o test_string $(LDFLAGS) -DSTAND_ALONE string.o \
820 -+ dummies.o sa-globals.o store.o tod.o utf8.o $(LIBS) $(LFLAGS)
821 - rm -f string.o
822 -
823 - # End
824
825 diff --git a/mail-mta/exim/files/exim-4.92-fix-eval-expansion-32bit.patch b/mail-mta/exim/files/exim-4.92-fix-eval-expansion-32bit.patch
826 deleted file mode 100644
827 index 17d7d21113d..00000000000
828 --- a/mail-mta/exim/files/exim-4.92-fix-eval-expansion-32bit.patch
829 +++ /dev/null
830 @@ -1,51 +0,0 @@
831 -Extract from complete patch from
832 -https://git.exim.org/exim.git/patch/26dd3aa007b3b77969610c031f59388e0953bd00
833 -to only take the buildconfig.c change because the git directory
834 -structure is different from a release tarball causing this patch to fail
835 -otherwise.
836 -
837 -From 26dd3aa007b3b77969610c031f59388e0953bd00 Mon Sep 17 00:00:00 2001
838 -From: Jeremy Harris <jgh146exb@×××××××.org>
839 -Date: Fri, 7 Jun 2019 11:54:10 +0100
840 -Subject: [PATCH] Fix detection of 32b platform at build time. Bug 2405
841 -
842 ----
843 - src/src/buildconfig.c | 12 +++++---
844 - test/scripts/0000-Basic/0002 | 72 +++++++++++++++++++++++---------------------
845 - test/stdout/0002 | 72 +++++++++++++++++++++++---------------------
846 - 3 files changed, 83 insertions(+), 73 deletions(-)
847 -
848 -diff --git a/src/src/buildconfig.c b/src/src/buildconfig.c
849 -index 71cf97b..a680b34 100644
850 ---- a/src/src/buildconfig.c
851 -+++ b/src/src/buildconfig.c
852 -@@ -111,6 +111,7 @@ unsigned long test_ulong_t = 0L;
853 - unsigned int test_uint_t = 0;
854 - #endif
855 - long test_long_t = 0;
856 -+long long test_longlong_t = 0;
857 - int test_int_t = 0;
858 - FILE *base;
859 - FILE *new;
860 -@@ -155,15 +156,16 @@ This assumption is known to be OK for the common operating systems. */
861 -
862 - fprintf(new, "#ifndef OFF_T_FMT\n");
863 - if (sizeof(test_off_t) > sizeof(test_long_t))
864 -- {
865 - fprintf(new, "# define OFF_T_FMT \"%%lld\"\n");
866 -- fprintf(new, "# define LONGLONG_T long long int\n");
867 -- }
868 - else
869 -- {
870 - fprintf(new, "# define OFF_T_FMT \"%%ld\"\n");
871 -+fprintf(new, "#endif\n\n");
872 -+
873 -+fprintf(new, "#ifndef LONGLONG_T\n");
874 -+if (sizeof(test_longlong_t) > sizeof(test_long_t))
875 -+ fprintf(new, "# define LONGLONG_T long long int\n");
876 -+else
877 - fprintf(new, "# define LONGLONG_T long int\n");
878 -- }
879 - fprintf(new, "#endif\n\n");
880 -
881 - /* Now do the same thing for time_t variables. If the length is greater than
882
883 diff --git a/mail-mta/exim/files/exim-4.92-localscan_dlopen.patch b/mail-mta/exim/files/exim-4.92-localscan_dlopen.patch
884 deleted file mode 100644
885 index 57363e56d50..00000000000
886 --- a/mail-mta/exim/files/exim-4.92-localscan_dlopen.patch
887 +++ /dev/null
888 @@ -1,267 +0,0 @@
889 -diff -ur exim-4.92.orig/src/config.h.defaults exim-4.92/src/config.h.defaults
890 ---- exim-4.92.orig/src/config.h.defaults 2019-01-30 14:59:52.000000000 +0100
891 -+++ exim-4.92/src/config.h.defaults 2019-02-16 18:17:24.547216157 +0100
892 -@@ -32,6 +32,8 @@
893 -
894 - #define AUTH_VARS 3
895 -
896 -+#define DLOPEN_LOCAL_SCAN
897 -+
898 - #define BIN_DIRECTORY
899 -
900 - #define CONFIGURE_FILE
901 -Only in exim-4.92/src: config.h.defaults.orig
902 -diff -ur exim-4.92.orig/src/EDITME exim-4.92/src/EDITME
903 ---- exim-4.92.orig/src/EDITME 2019-01-30 14:59:52.000000000 +0100
904 -+++ exim-4.92/src/EDITME 2019-02-16 18:17:24.547216157 +0100
905 -@@ -824,6 +824,24 @@
906 -
907 -
908 - #------------------------------------------------------------------------------
909 -+# On systems which support dynamic loading of shared libraries, Exim can
910 -+# load a local_scan function specified in its config file instead of having
911 -+# to be recompiled with the desired local_scan function. For a full
912 -+# description of the API to this function, see the Exim specification.
913 -+
914 -+#DLOPEN_LOCAL_SCAN=yes
915 -+
916 -+# If you set DLOPEN_LOCAL_SCAN, then you need to include -rdynamic in the
917 -+# linker flags. Without it, the loaded .so won't be able to access any
918 -+# functions from exim.
919 -+
920 -+LFLAGS = -rdynamic
921 -+ifeq ($(OSTYPE),Linux)
922 -+LFLAGS += -ldl
923 -+endif
924 -+
925 -+
926 -+#------------------------------------------------------------------------------
927 - # The default distribution of Exim contains only the plain text form of the
928 - # documentation. Other forms are available separately. If you want to install
929 - # the documentation in "info" format, first fetch the Texinfo documentation
930 -Only in exim-4.92/src: EDITME.orig
931 -diff -ur exim-4.92.orig/src/globals.c exim-4.92/src/globals.c
932 ---- exim-4.92.orig/src/globals.c 2019-01-30 14:59:52.000000000 +0100
933 -+++ exim-4.92/src/globals.c 2019-02-16 18:17:24.549216150 +0100
934 -@@ -41,6 +41,10 @@
935 -
936 - uschar *no_aliases = NULL;
937 -
938 -+#ifdef DLOPEN_LOCAL_SCAN
939 -+uschar *local_scan_path = NULL;
940 -+#endif
941 -+
942 -
943 - /* For comments on these variables, see globals.h. I'm too idle to
944 - duplicate them here... */
945 -Only in exim-4.92/src: globals.c.orig
946 -diff -ur exim-4.92.orig/src/globals.h exim-4.92/src/globals.h
947 ---- exim-4.92.orig/src/globals.h 2019-01-30 14:59:52.000000000 +0100
948 -+++ exim-4.92/src/globals.h 2019-02-16 18:17:24.549216150 +0100
949 -@@ -152,6 +152,9 @@
950 - extern int (*receive_ferror)(void);
951 - extern BOOL (*receive_smtp_buffered)(void);
952 -
953 -+#ifdef DLOPEN_LOCAL_SCAN
954 -+extern uschar *local_scan_path; /* Path to local_scan() library */
955 -+#endif
956 -
957 - /* For clearing, saving, restoring address expansion variables. We have to have
958 - the size of this vector set explicitly, because it is referenced from more than
959 -Only in exim-4.92/src: globals.h.orig
960 -diff -ur exim-4.92.orig/src/local_scan.c exim-4.92/src/local_scan.c
961 ---- exim-4.92.orig/src/local_scan.c 2019-01-30 14:59:52.000000000 +0100
962 -+++ exim-4.92/src/local_scan.c 2019-02-16 18:29:56.832732592 +0100
963 -@@ -5,61 +5,131 @@
964 - /* Copyright (c) University of Cambridge 1995 - 2009 */
965 - /* See the file NOTICE for conditions of use and distribution. */
966 -
967 -+#include "exim.h"
968 -
969 --/******************************************************************************
970 --This file contains a template local_scan() function that just returns ACCEPT.
971 --If you want to implement your own version, you should copy this file to, say
972 --Local/local_scan.c, and edit the copy. To use your version instead of the
973 --default, you must set
974 --
975 --HAVE_LOCAL_SCAN=yes
976 --LOCAL_SCAN_SOURCE=Local/local_scan.c
977 --
978 --in your Local/Makefile. This makes it easy to copy your version for use with
979 --subsequent Exim releases.
980 --
981 --For a full description of the API to this function, see the Exim specification.
982 --******************************************************************************/
983 --
984 --
985 --/* This is the only Exim header that you should include. The effect of
986 --including any other Exim header is not defined, and may change from release to
987 --release. Use only the documented interface! */
988 --
989 --#include "local_scan.h"
990 --
991 --
992 --/* This is a "do-nothing" version of a local_scan() function. The arguments
993 --are:
994 --
995 -- fd The file descriptor of the open -D file, which contains the
996 -- body of the message. The file is open for reading and
997 -- writing, but modifying it is dangerous and not recommended.
998 --
999 -- return_text A pointer to an unsigned char* variable which you can set in
1000 -- order to return a text string. It is initialized to NULL.
1001 --
1002 --The return values of this function are:
1003 --
1004 -- LOCAL_SCAN_ACCEPT
1005 -- The message is to be accepted. The return_text argument is
1006 -- saved in $local_scan_data.
1007 --
1008 -- LOCAL_SCAN_REJECT
1009 -- The message is to be rejected. The returned text is used
1010 -- in the rejection message.
1011 --
1012 -- LOCAL_SCAN_TEMPREJECT
1013 -- This specifies a temporary rejection. The returned text
1014 -- is used in the rejection message.
1015 --*/
1016 -+#ifdef DLOPEN_LOCAL_SCAN
1017 -+#include <dlfcn.h>
1018 -+static int (*local_scan_fn)(int fd, uschar **return_text) = NULL;
1019 -+static int load_local_scan_library(void);
1020 -+#endif
1021 -
1022 - int
1023 - local_scan(int fd, uschar **return_text)
1024 - {
1025 - fd = fd; /* Keep picky compilers happy */
1026 - return_text = return_text;
1027 --return LOCAL_SCAN_ACCEPT;
1028 -+#ifdef DLOPEN_LOCAL_SCAN
1029 -+/* local_scan_path is defined AND not the empty string */
1030 -+if (local_scan_path && *local_scan_path)
1031 -+ {
1032 -+ if (!local_scan_fn)
1033 -+ {
1034 -+ if (!load_local_scan_library())
1035 -+ {
1036 -+ char *base_msg , *error_msg , *final_msg ;
1037 -+ int final_length = -1 ;
1038 -+
1039 -+ base_msg=US"Local configuration error - local_scan() library failure\n";
1040 -+ error_msg = dlerror() ;
1041 -+
1042 -+ final_length = strlen(base_msg) + strlen(error_msg) + 1 ;
1043 -+ final_msg = (char*)malloc( final_length*sizeof(char) ) ;
1044 -+ *final_msg = '\0' ;
1045 -+
1046 -+ strcat( final_msg , base_msg ) ;
1047 -+ strcat( final_msg , error_msg ) ;
1048 -+
1049 -+ *return_text = final_msg ;
1050 -+ return LOCAL_SCAN_TEMPREJECT;
1051 -+ }
1052 -+ }
1053 -+ return local_scan_fn(fd, return_text);
1054 -+ }
1055 -+else
1056 -+#endif
1057 -+ return LOCAL_SCAN_ACCEPT;
1058 -+}
1059 -+
1060 -+#ifdef DLOPEN_LOCAL_SCAN
1061 -+
1062 -+static int load_local_scan_library(void)
1063 -+{
1064 -+/* No point in keeping local_scan_lib since we'll never dlclose() anyway */
1065 -+void *local_scan_lib = NULL;
1066 -+int (*local_scan_version_fn)(void);
1067 -+int vers_maj;
1068 -+int vers_min;
1069 -+
1070 -+local_scan_lib = dlopen(local_scan_path, RTLD_NOW);
1071 -+if (!local_scan_lib)
1072 -+ {
1073 -+ log_write(0, LOG_MAIN|LOG_REJECT, "local_scan() library open failed - "
1074 -+ "message temporarily rejected");
1075 -+ return FALSE;
1076 -+ }
1077 -+
1078 -+local_scan_version_fn = dlsym(local_scan_lib, "local_scan_version_major");
1079 -+if (!local_scan_version_fn)
1080 -+ {
1081 -+ dlclose(local_scan_lib);
1082 -+ log_write(0, LOG_MAIN|LOG_REJECT, "local_scan() library doesn't contain "
1083 -+ "local_scan_version_major() function - message temporarily rejected");
1084 -+ return FALSE;
1085 -+ }
1086 -+
1087 -+/* The major number is increased when the ABI is changed in a non
1088 -+ backward compatible way. */
1089 -+vers_maj = local_scan_version_fn();
1090 -+
1091 -+local_scan_version_fn = dlsym(local_scan_lib, "local_scan_version_minor");
1092 -+if (!local_scan_version_fn)
1093 -+ {
1094 -+ dlclose(local_scan_lib);
1095 -+ log_write(0, LOG_MAIN|LOG_REJECT, "local_scan() library doesn't contain "
1096 -+ "local_scan_version_minor() function - message temporarily rejected");
1097 -+ return FALSE;
1098 -+ }
1099 -+
1100 -+/* The minor number is increased each time a new feature is added (in a
1101 -+ way that doesn't break backward compatibility) -- Marc */
1102 -+vers_min = local_scan_version_fn();
1103 -+
1104 -+
1105 -+if (vers_maj != LOCAL_SCAN_ABI_VERSION_MAJOR)
1106 -+ {
1107 -+ dlclose(local_scan_lib);
1108 -+ local_scan_lib = NULL;
1109 -+ log_write(0, LOG_MAIN|LOG_REJECT, "local_scan() has an incompatible major"
1110 -+ "version number, you need to recompile your module for this version"
1111 -+ "of exim (The module was compiled for version %d.%d and this exim provides"
1112 -+ "ABI version %d.%d)", vers_maj, vers_min, LOCAL_SCAN_ABI_VERSION_MAJOR,
1113 -+ LOCAL_SCAN_ABI_VERSION_MINOR);
1114 -+ return FALSE;
1115 -+ }
1116 -+else if (vers_min > LOCAL_SCAN_ABI_VERSION_MINOR)
1117 -+ {
1118 -+ dlclose(local_scan_lib);
1119 -+ local_scan_lib = NULL;
1120 -+ log_write(0, LOG_MAIN|LOG_REJECT, "local_scan() has an incompatible minor"
1121 -+ "version number, you need to recompile your module for this version"
1122 -+ "of exim (The module was compiled for version %d.%d and this exim provides"
1123 -+ "ABI version %d.%d)", vers_maj, vers_min, LOCAL_SCAN_ABI_VERSION_MAJOR,
1124 -+ LOCAL_SCAN_ABI_VERSION_MINOR);
1125 -+ return FALSE;
1126 -+ }
1127 -+
1128 -+local_scan_fn = dlsym(local_scan_lib, "local_scan");
1129 -+if (!local_scan_fn)
1130 -+ {
1131 -+ dlclose(local_scan_lib);
1132 -+ log_write(0, LOG_MAIN|LOG_REJECT, "local_scan() library doesn't contain "
1133 -+ "local_scan() function - message temporarily rejected");
1134 -+ return FALSE;
1135 -+ }
1136 -+
1137 -+return TRUE;
1138 - }
1139 -
1140 -+#endif /* DLOPEN_LOCAL_SCAN */
1141 -+
1142 - /* End of local_scan.c */
1143 -diff -ur exim-4.92.orig/src/readconf.c exim-4.92/src/readconf.c
1144 ---- exim-4.92.orig/src/readconf.c 2019-01-30 14:59:52.000000000 +0100
1145 -+++ exim-4.92/src/readconf.c 2019-02-16 18:18:46.013947455 +0100
1146 -@@ -199,6 +199,9 @@
1147 - { "local_from_prefix", opt_stringptr, &local_from_prefix },
1148 - { "local_from_suffix", opt_stringptr, &local_from_suffix },
1149 - { "local_interfaces", opt_stringptr, &local_interfaces },
1150 -+#ifdef DLOPEN_LOCAL_SCAN
1151 -+ { "local_scan_path", opt_stringptr, &local_scan_path },
1152 -+#endif
1153 - #ifdef HAVE_LOCAL_SCAN
1154 - { "local_scan_timeout", opt_time, &local_scan_timeout },
1155 - #endif