summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Morey <peitolm@gentoo.org>2005-07-13 21:09:02 +0000
committerColin Morey <peitolm@gentoo.org>2005-07-13 21:09:02 +0000
commitabcc7af8e4ce1fdff8545d90b87a225cab1ac258 (patch)
tree82bbed8dd413f3dfbd01c2501bde97486e177a3d /mail-mta
parentold (diff)
downloadhistorical-abcc7af8e4ce1fdff8545d90b87a225cab1ac258.tar.gz
historical-abcc7af8e4ce1fdff8545d90b87a225cab1ac258.tar.bz2
historical-abcc7af8e4ce1fdff8545d90b87a225cab1ac258.zip
bug fixes, see changelog
Package-Manager: portage-2.0.51.22-r1
Diffstat (limited to 'mail-mta')
-rw-r--r--mail-mta/exim/Manifest45
-rw-r--r--mail-mta/exim/exim-4.50-r2.ebuild282
-rw-r--r--mail-mta/exim/files/digest-exim-4.50-r21
-rw-r--r--mail-mta/exim/files/exim-4.50-srs_update-1.0.patch527
4 files changed, 829 insertions, 26 deletions
diff --git a/mail-mta/exim/Manifest b/mail-mta/exim/Manifest
index d43e4afb8809..062d1bae363a 100644
--- a/mail-mta/exim/Manifest
+++ b/mail-mta/exim/Manifest
@@ -1,35 +1,28 @@
------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
-
+MD5 21a21c26658637fab0d0f7d58d139ff8 ChangeLog 17228
MD5 f850af9bb97ec3801c5f27cc6d6c7930 exim-4.50.ebuild 7923
-MD5 c5d0c353ed73c403a957dc4f7ce88cf7 exim-4.50-r999.ebuild 7638
-MD5 b736c67bb1a5d294ee2df24413cf9100 exim-4.43-r2.ebuild 8033
+MD5 8adf036e967c40b83393f04dfdfc3b84 exim-4.50-r2.ebuild 8494
MD5 87c97e184e9ba99f8badec230f288397 exim-4.50-r1.ebuild 7961
-MD5 21a21c26658637fab0d0f7d58d139ff8 ChangeLog 17228
+MD5 b736c67bb1a5d294ee2df24413cf9100 exim-4.43-r2.ebuild 8033
+MD5 c5d0c353ed73c403a957dc4f7ce88cf7 exim-4.50-r999.ebuild 7638
MD5 3dcc3562423bb66d0c2ea93caf41a36a metadata.xml 994
-MD5 dec246086bc5cef333efaa95785a4d5e files/exim-4.43-r2-host_aton-buff.patch 6444
-MD5 4c0b8ee742360c08f0bc0b526fcaad10 files/system_filter.exim 8120
+MD5 68fc403ba2c98ccba281939085cb9052 files/auth_conf.sub 775
MD5 0cb2ffe88c81fd7ac8429b5a19d58b35 files/configure 16346
-MD5 369b42cafcbe5631c2d03cbbfd4aeddd files/exim-4.10-gentoo.diff 1889
-MD5 f442b68d435598831bab8536ade071b8 files/exim.confd 62
-MD5 5127f4b2ace5cf148e2ac21e101ac967 files/exim-4.33-r1-header-syntax.patch 1017
-MD5 1c2f7177e8deb2c85ee6bd4b6754cd2e files/digest-exim-4.50-r999 63
-MD5 f03fc637e154f9ca79d991e71eb063bf files/exim-4.30-conf.patch 887
+MD5 1c2f7177e8deb2c85ee6bd4b6754cd2e files/digest-exim-4.50-r2 63
+MD5 1c2f7177e8deb2c85ee6bd4b6754cd2e files/digest-exim-4.50 63
+MD5 dec246086bc5cef333efaa95785a4d5e files/exim-4.43-r2-host_aton-buff.patch 6444
MD5 f05ff505c7b77a17696736e2730ae8d1 files/digest-exim-4.43-r2 133
-MD5 1c2f7177e8deb2c85ee6bd4b6754cd2e files/digest-exim-4.50-r1 63
MD5 c76437104cbde9184f01eb0987bfd738 files/exim-4.43-r2-localscan_dlopen.patch 9236
-MD5 eb249c90af3ab11e5a4d307e184a75ac files/exiscan.conf 22113
-MD5 68fc403ba2c98ccba281939085cb9052 files/auth_conf.sub 775
+MD5 8609e97b73196813ddfc2b3de6a2bbac files/exim.rc6 565
+MD5 1c2f7177e8deb2c85ee6bd4b6754cd2e files/digest-exim-4.50-r1 63
+MD5 67d515cfd03abf9c207c28c997de4177 files/exim-4.50-srs_update-1.0.patch 18372
+MD5 1c2f7177e8deb2c85ee6bd4b6754cd2e files/digest-exim-4.50-r999 63
+MD5 369b42cafcbe5631c2d03cbbfd4aeddd files/exim-4.10-gentoo.diff 1889
+MD5 5d5aabea7d56a91803df1312c04d32c0 files/exim-4.14-tail.patch 446
MD5 622b726ea7b32aae93a8fe9f3c2af9cd files/exim-4.20-maildir.patch 478
+MD5 f03fc637e154f9ca79d991e71eb063bf files/exim-4.30-conf.patch 887
+MD5 5127f4b2ace5cf148e2ac21e101ac967 files/exim-4.33-r1-header-syntax.patch 1017
+MD5 f442b68d435598831bab8536ade071b8 files/exim.confd 62
+MD5 eb249c90af3ab11e5a4d307e184a75ac files/exiscan.conf 22113
MD5 49698cb738763bbaebbbe89470f914ef files/mailer.conf 169
-MD5 5d5aabea7d56a91803df1312c04d32c0 files/exim-4.14-tail.patch 446
MD5 d230e0fa45f2b65d5bc50c0879c40148 files/pam.d-exim 101
-MD5 8609e97b73196813ddfc2b3de6a2bbac files/exim.rc6 565
-MD5 1c2f7177e8deb2c85ee6bd4b6754cd2e files/digest-exim-4.50 63
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.1 (GNU/Linux)
-
-iD8DBQFC0c/RQlM6RnzZP+IRAjb2AKCuu/l6heRx7LEAZkfDefOfoKiqkQCcDiSH
-Egzz7HKPCRJ/DD+omZDustw=
-=m7F/
------END PGP SIGNATURE-----
+MD5 4c0b8ee742360c08f0bc0b526fcaad10 files/system_filter.exim 8120
diff --git a/mail-mta/exim/exim-4.50-r2.ebuild b/mail-mta/exim/exim-4.50-r2.ebuild
new file mode 100644
index 000000000000..83399a05e03e
--- /dev/null
+++ b/mail-mta/exim/exim-4.50-r2.ebuild
@@ -0,0 +1,282 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/mail-mta/exim/exim-4.50-r2.ebuild,v 1.1 2005/07/13 21:09:02 peitolm Exp $
+
+inherit eutils
+
+IUSE="tcpd ssl postgres mysql ldap pam exiscan-acl mailwrapper lmtp ipv6 sasl dnsdb perl mbox X exiscan nis syslog spf srs"
+
+DESCRIPTION="A highly configurable, drop-in replacement for sendmail"
+SRC_URI="ftp://ftp.exim.org/pub/exim/exim4/${P}.tar.bz2"
+HOMEPAGE="http://www.exim.org/"
+
+SLOT="0"
+LICENSE="GPL-2"
+KEYWORDS="~x86"
+
+PROVIDE="virtual/mta"
+DEPEND=">=sys-apps/sed-4.0.5
+ perl? ( sys-devel/libperl )
+ >=sys-libs/db-3.2
+ pam? ( >=sys-libs/pam-0.75 )
+ tcpd? ( sys-apps/tcp-wrappers )
+ ssl? ( >=dev-libs/openssl-0.9.6 )
+ ldap? ( >=net-nds/openldap-2.0.7 )
+ mysql? ( >=dev-db/mysql-3.23.28 )
+ postgres? ( >=dev-db/postgresql-7 )
+ sasl? ( >=dev-libs/cyrus-sasl-2.1.14 )
+ spf? ( mail-filter/libspf2 )
+ srs? ( mail-filter/libsrs_alt )
+ X? ( virtual/x11 )"
+ # added X check for #57206
+RDEPEND="${DEPEND}
+ mailwrapper? ( >=net-mail/mailwrapper-0.2 )
+ !mailwrapper? ( !virtual/mta )
+ >=net-mail/mailbase-0.00-r5"
+
+src_unpack() {
+ unpack ${A}
+ cd ${S}
+
+ local myconf
+
+ epatch ${FILESDIR}/exim-4.14-tail.patch
+ epatch ${FILESDIR}/exim-4.43-r2-localscan_dlopen.patch
+
+ if ! use mbox; then
+ einfo "Patching maildir support into exim.conf"
+ epatch ${FILESDIR}/exim-4.20-maildir.patch
+ fi
+
+ sed -i "/SYSTEM_ALIASES_FILE/ s'SYSTEM_ALIASES_FILE'/etc/mail/aliases'" ${S}/src/configure.default
+ cp ${S}/src/configure.default ${S}/src/configure.default.orig
+ epatch ${FILESDIR}/exim-4.30-conf.patch
+
+ # Includes Typo fix for bug 47106
+ sed -e "48i\CFLAGS=${CFLAGS}" \
+ -e "s:# AUTH_CRAM_MD5=yes:AUTH_CRAM_MD5=yes:" \
+ -e "s:# AUTH_PLAINTEXT=yes:AUTH_PLAINTEXT=yes:" \
+ -e "s:BIN_DIRECTORY=/usr/exim/bin:BIN_DIRECTORY=/usr/sbin:" \
+ -e "s:COMPRESS_COMMAND=/opt/gnu/bin/gzip:COMPRESS_COMMAND=/usr/bin/gzip:" \
+ -e "s:ZCAT_COMMAND=/opt/gnu/bin/zcat:ZCAT_COMMAND=/usr/bin/zcat:" \
+ -e "s:CONFIGURE_FILE=/usr/exim/configure:CONFIGURE_FILE=/etc/exim/exim.conf:" \
+ -e "s:EXIM_MONITOR=eximon.bin:# EXIM_MONITOR=eximon.bin:" \
+ -e "s:# INFO_DIRECTORY=/usr/local/info:INFO_DIRECTORY=/usr/share/info:" \
+ -e "s:# LOG_FILE_PATH=/var/log/exim_%slog:LOG_FILE_PATH=/var/log/exim/exim_%s.log:" \
+ -e "s:# PID_FILE_PATH=/var/lock/exim.pid:PID_FILE_PATH=/var/run/exim.pid:" \
+ -e "s:# SPOOL_DIRECTORY=/var/spool/exim:SPOOL_DIRECTORY=/var/spool/exim:" \
+ -e "s:# SUPPORT_MAILDIR=yes:SUPPORT_MAILDIR=yes:" \
+ -e "s:# SUPPORT_MAILSTORE=yes:SUPPORT_MAILSTORE=yes:" \
+ -e "s:EXIM_USER=:EXIM_USER=mail:" \
+ -e "s:# AUTH_SPA=yes:AUTH_SPA=yes:" \
+ -e "s:^ZCAT_COMMAND.*$:ZCAT_COMMAND=/bin/zcat:" \
+ -e "s:# LOOKUP_PASSWD=yes:LOOKUP_PASSWD=yes:" \
+ src/EDITME > Local/Makefile
+
+ # exiscan-acl is now integrated - enabled it when use-flag set
+ if use exiscan-acl; then
+ sed -i "s:# WITH_CONTENT_SCAN=yes:WITH_CONTENT_SCAN=yes:" Local/Makefile
+ sed -i "s:# WITH_OLD_DEMIME=yes:WITH_OLD_DEMIME=yes:" Local/Makefile
+ elif (use spf || use srs) then
+ eerror SPF and SRS support require exiscan-acl to be enabled, please add
+ eerror to your USE settings.
+ exit 1
+ fi
+ if use spf; then
+ myconf="${myconf} -lspf2"
+ sed -i "s:# EXPERIMENTAL_SPF=yes:EXPERIMENTAL_SPF=yes:" Local/Makefile
+ mycflags="${mycflags} -DEXPERIMENTAL_SPF"
+ fi
+ if use srs; then
+ myconf="${myconf} -lsrs_alt"
+ sed -i "s:# EXPERIMENTAL_SRS=yes:EXPERIMENTAL_SRS=yes:" Local/Makefile
+ epatch ${FILESDIR}/exim-4.50-srs_update-1.0.patch
+ fi
+
+ cd Local
+ # enable optional exim_monitor support via X use flag bug #46778
+ if use X; then
+ einfo "Configuring eximon"
+ cp ../exim_monitor/EDITME eximon.conf
+ sed -i "s:# EXIM_MONITOR=eximon.bin:EXIM_MONITOR=eximon.bin:" Makefile
+ fi
+ #These next two should resolve 37964
+ if use perl; then
+ sed -i "s:# EXIM_PERL=perl.o:EXIM_PERL=perl.o:" Makefile
+ fi
+ if use mbox; then
+ sed -i "s:# SUPPORT_MBX=yes:SUPPORT_MBX=yes:" Makefile
+ fi
+ if use pam; then
+ sed -i "s:# \(SUPPORT_PAM=yes\):\1:" Makefile
+ myconf="${myconf} -lpam"
+ fi
+ if use sasl; then
+ sed -i "s:# CYRUS_SASLAUTHD_SOCKET=/var/state/saslauthd/mux:CYRUS_SASLAUTHD_SOCKET=/var/lib/sasl2/mux:" \
+ Makefile
+ myconf="${myconf} -lsasl2"
+ fi
+ if use tcpd; then
+ sed -i "s:# \(USE_TCP_WRAPPERS=yes\):\1:" Makefile
+ myconf="${myconf} -lwrap"
+ fi
+ if use lmtp; then
+ sed -i "s:# \(TRANSPORT_LMTP=yes\):\1:" Makefile
+ fi
+ if use ipv6; then
+ echo "HAVE_IPV6=YES" >> Makefile
+ #To fix bug 41196
+ echo "IPV6_USE_INET_PTON=yes" >> Makefile
+ fi
+
+ if [ -n "$myconf" ] ; then
+ echo "EXTRALIBS=${myconf} ${LDFLAGS}" >> Makefile
+ fi
+
+ cd ${S}
+ if use ssl; then
+ sed -i \
+ -e "s:# \(SUPPORT_TLS=yes\):\1:" \
+ -e "s:# \(TLS_LIBS=-lssl -lcrypto\):\1:" Local/Makefile
+ fi
+
+ LOOKUP_INCLUDE=
+ LOOKUP_LIBS=
+
+ if use ldap; then
+ sed -i \
+ -e "s:# \(LOOKUP_LDAP=yes\):\1:" \
+ -e "s:# \(LDAP_LIB_TYPE=OPENLDAP2\):\1:" Local/Makefile
+ LOOKUP_INCLUDE="-I/usr/include/ldap"
+ LOOKUP_LIBS="-L/usr/lib -lldap -llber"
+ fi
+
+ if use mysql; then
+ sed -i "s:# LOOKUP_MYSQL=yes:LOOKUP_MYSQL=yes:" Local/Makefile
+ LOOKUP_INCLUDE="$LOOKUP_INCLUDE -I/usr/include/mysql"
+ LOOKUP_LIBS="$LOOKUP_LIBS -L/usr/lib -lmysqlclient"
+ fi
+
+ if use postgres; then
+ sed -i "s:# LOOKUP_PGSQL=yes:LOOKUP_PGSQL=yes:" Local/Makefile
+ LOOKUP_INCLUDE="$LOOKUP_INCLUDE -I/usr/include/postgresql"
+ LOOKUP_LIBS="$LOOKUP_LIBS -lpq"
+ fi
+
+ if [ -n "$LOOKUP_INCLUDE" ]; then
+ sed -i "s:# LOOKUP_INCLUDE=-I /usr/local/ldap/include -I /usr/local/mysql/include -I /usr/local/pgsql/include:LOOKUP_INCLUDE=$LOOKUP_INCLUDE:" \
+ Local/Makefile
+ fi
+
+ if [ -n "$LOOKUP_LIBS" ]; then
+ sed -i "s:# LOOKUP_LIBS=-L/usr/local/lib -lldap -llber -lmysqlclient -lpq -lgds:LOOKUP_LIBS=$LOOKUP_LIBS:" \
+ Local/Makefile
+ fi
+
+
+ cat Makefile | sed -e 's/^buildname=.*/buildname=exim-gentoo/g' > Makefile.gentoo && mv -f Makefile.gentoo Makefile
+
+ sed -i "s:# LOOKUP_DSEARCH=yes:LOOKUP_DSEARCH=yes:" Local/Makefile
+
+ if use dnsdb; then
+ sed -i "s:# LOOKUP_DNSDB=yes:LOOKUP_DNSDB=yes:" Local/Makefile
+ fi
+ sed -i "s:# LOOKUP_CDB=yes:LOOKUP_CDB=yes:" Local/Makefile
+
+ if use nis; then
+ sed -i "s:# LOOKUP_NIS=yes:LOOKUP_NIS=yes:" Local/Makefile
+ sed -i "s:# LOOKUP_NISPLUS=yes:LOOKUP_NISPLUS=yes:" Local/Makefile
+ fi
+ if use syslog; then
+ sed -i "s:LOG_FILE_PATH=/var/log/exim/exim_%s.log:LOG_FILE_PATH=syslog:" Local/Makefile
+ fi
+# Use the "native" interface to the DBM library
+ echo "USE_DB=yes" >> ${S}/Local/Makefile
+}
+
+src_compile() {
+ make || die "make failed"
+}
+
+
+src_install () {
+ cd ${S}/build-exim-gentoo
+ exeinto /usr/sbin
+ doexe exim
+ if use X;then
+ doexe eximon.bin
+ doexe eximon
+ fi
+ fperms 4755 /usr/sbin/exim
+
+ dodir /usr/bin /usr/sbin /usr/lib
+ dosym ../sbin/exim /usr/bin/mailq
+ dosym ../sbin/exim /usr/bin/newaliases
+ einfo "The Exim ebuild will no longer touch /usr/bin/mail, so as not to interfere with mailx/nail."
+ dosym exim /usr/sbin/rsmtp
+ dosym exim /usr/sbin/rmail
+ if \[ ! -e /usr/lib/sendmail \];
+ then
+ dosym /usr/sbin/sendmail /usr/lib/sendmail
+ fi
+
+ if use mailwrapper
+ then
+ insinto /etc/mail
+ doins ${FILESDIR}/mailer.conf
+ else
+ dosym exim /usr/sbin/sendmail
+ fi
+
+ exeinto /usr/sbin
+ for i in exicyclog exim_dbmbuild exim_dumpdb exim_fixdb exim_lock \
+ exim_tidydb exinext exiwhat exigrep eximstats exiqsumm \
+ convert4r3 convert4r4
+ do
+ doexe $i
+ done
+
+ dodoc ${S}/doc/*
+ doman ${S}/doc/exim.8
+
+ # conf files
+ insinto /etc/exim
+ newins ${S}/src/configure.default.orig exim.conf.dist
+ if use exiscan-acl; then
+ newins ${S}/src/configure.default exim.conf.exiscan-acl
+ fi
+ doins ${FILESDIR}/system_filter.exim
+ doins ${FILESDIR}/auth_conf.sub
+ if use exiscan; then
+ newins ${S}/src/configure.default exim.conf.exiscan
+ doins ${FILESDIR}/exiscan.conf
+ fi
+
+ # INSTALL a pam.d file for SMTP AUTH that works with gentoo's pam
+ insinto /etc/pam.d
+ newins ${FILESDIR}/pam.d-exim exim
+
+ exeinto /etc/init.d
+ newexe ${FILESDIR}/exim.rc6 exim
+
+ insinto /etc/conf.d
+ newins ${FILESDIR}/exim.confd exim
+
+ DIROPTIONS="--mode=0750 --owner=mail --group=mail"
+ dodir /var/log/${PN}
+}
+
+
+pkg_postinst() {
+ einfo "/etc/exim/system_filter.exim is a sample system_filter."
+ einfo "/etc/exim/auth_conf.sub contains the configuration sub for using smtp auth."
+ einfo "Please create /etc/exim/exim.conf from /etc/exim/exim.conf.dist."
+
+ if ! use mailwrapper && [[ -e /etc/mailer.conf ]]
+ then
+ einfo
+ einfo "Since you emerged $PN without mailwrapper in USE,"
+ einfo "you probably want to 'emerge -C mailwrapper' now."
+ einfo
+ fi
+}
diff --git a/mail-mta/exim/files/digest-exim-4.50-r2 b/mail-mta/exim/files/digest-exim-4.50-r2
new file mode 100644
index 000000000000..a96f78c973a6
--- /dev/null
+++ b/mail-mta/exim/files/digest-exim-4.50-r2
@@ -0,0 +1 @@
+MD5 7844eff82171872f6b3971a4183368d9 exim-4.50.tar.bz2 1434928
diff --git a/mail-mta/exim/files/exim-4.50-srs_update-1.0.patch b/mail-mta/exim/files/exim-4.50-srs_update-1.0.patch
new file mode 100644
index 000000000000..055686f42d1b
--- /dev/null
+++ b/mail-mta/exim/files/exim-4.50-srs_update-1.0.patch
@@ -0,0 +1,527 @@
+diff -Naur exim-4.50/src/deliver.c exim-4.50-patched/src/deliver.c
+--- exim-4.50/src/deliver.c 2005-02-17 14:49:11.000000000 +0000
++++ exim-4.50-patched/src/deliver.c 2005-04-01 21:03:14.000000000 +0100
+@@ -859,6 +859,11 @@
+
+ if ((log_extra_selector & LX_sender_on_delivery) != 0)
+ s = string_append(s, &size, &ptr, 3, US" F=<", sender_address, US">");
++
++ #ifdef EXPERIMENTAL_SRS
++ if(addr->p.srs_sender)
++ s = string_append(s, &size, &ptr, 3, US" SRS=<", addr->p.srs_sender, US">");
++ #endif
+
+ /* You might think that the return path must always be set for a successful
+ delivery; indeed, I did for some time, until this statement crashed. The case
+@@ -1516,8 +1521,14 @@
+ /* Set up the return path from the errors or sender address. If the transport
+ has its own return path setting, expand it and replace the existing value. */
+
+-return_path = (addr->p.errors_address != NULL)?
+- addr->p.errors_address : sender_address;
++if(addr->p.errors_address != NULL)
++ return_path = addr->p.errors_address;
++#ifdef EXPERIMENTAL_SRS
++else if(addr->p.srs_sender != NULL)
++ return_path = addr->p.srs_sender;
++#endif
++else
++ return_path = sender_address;
+
+ if (tp->return_path != NULL)
+ {
+@@ -3505,8 +3516,14 @@
+ /* Compute the return path, expanding a new one if required. The old one
+ must be set first, as it might be referred to in the expansion. */
+
+- return_path = (addr->p.errors_address != NULL)?
+- addr->p.errors_address : sender_address;
++ if(addr->p.errors_address != NULL)
++ return_path = addr->p.errors_address;
++#ifdef EXPERIMENTAL_SRS
++ else if(addr->p.srs_sender != NULL)
++ return_path = addr->p.srs_sender;
++#endif
++ else
++ return_path = sender_address;
+
+ if (tp->return_path != NULL)
+ {
+diff -Naur exim-4.50/src/globals.c exim-4.50-patched/src/globals.c
+--- exim-4.50/src/globals.c 2005-02-17 14:49:11.000000000 +0000
++++ exim-4.50-patched/src/globals.c 2005-04-01 19:03:23.000000000 +0100
+@@ -279,6 +279,9 @@
+ NULL, /* errors_address */
+ NULL, /* extra_headers */
+ NULL, /* remove_headers */
++#ifdef EXPERIMENTAL_SRS
++ NULL, /* srs_sender */
++#endif
+ }
+ };
+
+@@ -1031,10 +1034,16 @@
+ uschar *srs_config = NULL;
+ uschar *srs_db_address = NULL;
+ uschar *srs_db_key = NULL;
++int srs_hashlength = 6;
++int srs_hashmin = -1;
++int srs_maxage = 31;
+ uschar *srs_orig_recipient = NULL;
+ uschar *srs_orig_sender = NULL;
+ uschar *srs_recipient = NULL;
++uschar *srs_secrets = NULL;
+ uschar *srs_status = NULL;
++BOOL srs_usehash = TRUE;
++BOOL srs_usetimestamp = TRUE;
+ #endif
+ int string_datestamp_offset= -1;
+ BOOL strip_excess_angle_brackets = FALSE;
+diff -Naur exim-4.50/src/globals.h exim-4.50-patched/src/globals.h
+--- exim-4.50/src/globals.h 2005-02-17 14:49:11.000000000 +0000
++++ exim-4.50-patched/src/globals.h 2005-04-01 18:55:30.000000000 +0100
+@@ -634,10 +634,16 @@
+ extern uschar *srs_config; /* SRS config secret:max age:hash length:use timestamp:use hash */
+ extern uschar *srs_db_address; /* SRS db address */
+ extern uschar *srs_db_key; /* SRS db key */
++extern int srs_hashlength; /* SRS hash length */
++extern int srs_hashmin; /* SRS minimum hash length */
++extern int srs_maxage; /* SRS max age */
+ extern uschar *srs_orig_sender; /* SRS original sender */
+ extern uschar *srs_orig_recipient; /* SRS original recipient */
+ extern uschar *srs_recipient; /* SRS recipient */
++extern uschar *srs_secrets; /* SRS secrets list */
+ extern uschar *srs_status; /* SRS staus */
++extern BOOL srs_usehash; /* SRS use hash flag */
++extern BOOL srs_usetimestamp; /* SRS use timestamp flag */
+ #endif
+ extern int string_datestamp_offset;/* After insertion by string_format */
+ extern BOOL strip_excess_angle_brackets; /* Surrounding route-addrs */
+diff -Naur exim-4.50/src/readconf.c exim-4.50-patched/src/readconf.c
+--- exim-4.50/src/readconf.c 2005-02-17 14:49:11.000000000 +0000
++++ exim-4.50-patched/src/readconf.c 2005-04-01 18:56:06.000000000 +0100
+@@ -334,6 +334,12 @@
+ { "spool_directory", opt_stringptr, &spool_directory },
+ #ifdef EXPERIMENTAL_SRS
+ { "srs_config", opt_stringptr, &srs_config },
++ { "srs_hashlength", opt_int, &srs_hashlength },
++ { "srs_hashmin", opt_int, &srs_hashmin },
++ { "srs_maxage", opt_int, &srs_maxage },
++ { "srs_secrets", opt_stringptr, &srs_secrets },
++ { "srs_usehash", opt_bool, &srs_usehash },
++ { "srs_usetimestamp", opt_bool, &srs_usetimestamp },
+ #endif
+ { "strip_excess_angle_brackets", opt_bool, &strip_excess_angle_brackets },
+ { "strip_trailing_dot", opt_bool, &strip_trailing_dot },
+diff -Naur exim-4.50/src/routers/redirect.c exim-4.50-patched/src/routers/redirect.c
+--- exim-4.50/src/routers/redirect.c 2005-02-17 14:49:11.000000000 +0000
++++ exim-4.50-patched/src/routers/redirect.c 2005-04-02 01:31:32.000000000 +0100
+@@ -108,8 +108,10 @@
+ (void *)offsetof(redirect_router_options_block, srs_alias) },
+ { "srs_condition", opt_stringptr,
+ (void *)offsetof(redirect_router_options_block, srs_condition) },
+- { "srs_db", opt_stringptr,
+- (void *)offsetof(redirect_router_options_block, srs_db) },
++ { "srs_dbinsert", opt_stringptr,
++ (void *)offsetof(redirect_router_options_block, srs_dbinsert) },
++ { "srs_dbselect", opt_stringptr,
++ (void *)offsetof(redirect_router_options_block, srs_dbselect) },
+ #endif
+ { "syntax_errors_text", opt_stringptr,
+ (void *)offsetof(redirect_router_options_block, syntax_errors_text) },
+@@ -146,9 +148,10 @@
+ NULL, /* owngroups */
+ #ifdef EXPERIMENTAL_SRS
+ NULL, /* srs */
+- NULL, /* srs_condition */
+- NULL, /* srs_db */
+ NULL, /* srs_alias */
++ NULL, /* srs_condition */
++ NULL, /* srs_dbinsert */
++ NULL, /* srs_dbselect */
+ #endif
+ 022, /* modemask */
+ RDO_REWRITE, /* bit_options */
+@@ -517,6 +520,10 @@
+ addr_prop.extra_headers = NULL;
+ addr_prop.remove_headers = NULL;
+
++#ifdef EXPERIMENTAL_SRS
++addr_prop.srs_sender = NULL;
++#endif
++
+ /* When verifying and testing addresses, the "logwrite" command in filters
+ must be bypassed. */
+
+@@ -543,8 +550,8 @@
+ }
+
+ #ifdef EXPERIMENTAL_SRS
+- /* For reverse SRS, fill the srs_recipient expandsion variable,
+- on failure, return decline/fail as relevant */
++ /* Perform SRS on recipient/return-path as required */
++
+ if(ob->srs != NULL)
+ {
+ BOOL usesrs = TRUE;
+@@ -553,22 +560,78 @@
+ usesrs = expand_check_condition(ob->srs_condition, "srs_condition expansion failed", NULL);
+
+ if(usesrs)
+- if(Ustrcmp(ob->srs, "reverse") == 0 || Ustrcmp(ob->srs, "reverseandforward") == 0)
++ {
++ int srs_action, n_srs;
++ uschar *res;
++ uschar *usedomain;
++
++ /* What are we doing? */
++ if(Ustrcmp(ob->srs, "forward") == 0)
++ srs_action = 1;
++ else if(Ustrcmp(ob->srs, "reverseandforward") == 0)
+ {
+- uschar *res;
+- int n_srs;
++ srs_action = 3;
+
++ if((ob->srs_dbinsert == NULL) ^ (ob->srs_dbselect == NULL))
++ return DEFER;
++ }
++ else if(Ustrcmp(ob->srs, "reverse") == 0)
++ srs_action = 2;
++
++ /* Reverse SRS */
++ if(srs_action & 2)
++ {
+ srs_orig_recipient = addr->address;
++
+ eximsrs_init();
+- if(ob->srs_db)
+- eximsrs_db_set(TRUE, ob->srs_db);
+- if((n_srs = eximsrs_reverse(&res, addr->address)) != OK)
++ if(ob->srs_dbselect)
++ eximsrs_db_set(TRUE, ob->srs_dbselect);
++// Comment this out for now...
++// else
++// eximsrs_db_set(TRUE, NULL);
++
++ if((n_srs = eximsrs_reverse(&res, addr->address)) == OK)
++ {
++ srs_recipient = res;
++ DEBUG(D_any)
++ debug_printf("SRS (reverse): Recipient '%s' rewritten to '%s'\n", srs_orig_recipient, srs_recipient);
++ }
++
++ eximsrs_done();
++
++ if(n_srs != OK)
+ return n_srs;
+- srs_recipient = res;
++ }
++
++ /* Forward SRS */
++ /* No point in actually performing SRS if we are just verifying a recipient */
++ if((srs_action & 1) && !verify && (sender_address ? sender_address[0] != 0 : FALSE))
++ {
++
++ srs_orig_sender = sender_address;
++ eximsrs_init();
++ if(ob->srs_dbinsert)
++ eximsrs_db_set(FALSE, ob->srs_dbinsert);
++// Comment this out for now...
++// else
++// eximsrs_db_set(FALSE, NULL);
++
++ if(ob->srs_alias != NULL ? (usedomain = expand_string(ob->srs_alias)) == NULL : 1)
++ usedomain = deliver_domain;
++
++ if((n_srs = eximsrs_forward(&res, sender_address, usedomain)) == OK)
++ {
++ addr_prop.srs_sender = res;
++ DEBUG(D_any)
++ debug_printf("SRS (forward): Sender '%s' rewritten to '%s'\n", srs_orig_sender, res);
++ }
++
+ eximsrs_done();
+- DEBUG(D_any)
+- debug_printf("SRS: Recipient '%s' rewritten to '%s'\n", srs_orig_recipient, srs_recipient);
++
++ if(n_srs != OK)
++ return n_srs;
+ }
++ }
+ }
+ #endif
+
+@@ -795,39 +858,6 @@
+ (addr_prop.errors_address != NULL)? "\n" : "");
+ }
+
+-#ifdef EXPERIMENTAL_SRS
+- /* On successful redirection, check for SRS forwarding and adjust sender */
+- if(ob->srs != NULL)
+- {
+- BOOL usesrs = TRUE;
+-
+- if(ob->srs_condition != NULL)
+- usesrs = expand_check_condition(ob->srs_condition, "srs_condition expansion failed", NULL);
+-
+- if(usesrs)
+- if((Ustrcmp(ob->srs, "forward") == 0 || Ustrcmp(ob->srs, "reverseandforward") == 0) && !verify)
+- {
+- uschar *res;
+- uschar *usedomain;
+- int n_srs;
+-
+- srs_orig_sender = sender_address;
+- eximsrs_init();
+- if(ob->srs_db)
+- eximsrs_db_set(FALSE, ob->srs_db);
+-
+- if(ob->srs_alias != NULL ? (usedomain = expand_string(ob->srs_alias)) == NULL : 1)
+- usedomain = deliver_domain;
+-
+- if((n_srs = eximsrs_forward(&res, sender_address, usedomain)) != OK)
+- return n_srs;
+- sender_address = res;
+- DEBUG(D_any)
+- debug_printf("SRS: Sender '%s' rewritten to '%s'\n", srs_orig_sender, sender_address);
+- }
+- }
+-#endif
+-
+ /* Control gets here only when the address has been completely handled. Put the
+ original address onto the succeed queue so that any retry items that get
+ attached to it get processed. */
+diff -Naur exim-4.50/src/routers/redirect.h exim-4.50-patched/src/routers/redirect.h
+--- exim-4.50/src/routers/redirect.h 2005-02-17 14:49:11.000000000 +0000
++++ exim-4.50-patched/src/routers/redirect.h 2005-04-02 01:22:45.000000000 +0100
+@@ -35,9 +35,10 @@
+
+ #ifdef EXPERIMENTAL_SRS
+ uschar *srs;
+- uschar *srs_condition;
+- uschar *srs_db;
+ uschar *srs_alias;
++ uschar *srs_condition;
++ uschar *srs_dbinsert;
++ uschar *srs_dbselect;
+ #endif
+
+ int modemask;
+diff -Naur exim-4.50/src/srs.c exim-4.50-patched/src/srs.c
+--- exim-4.50/src/srs.c 2005-02-17 14:49:11.000000000 +0000
++++ exim-4.50-patched/src/srs.c 2005-04-01 22:33:39.000000000 +0100
+@@ -1,11 +1,12 @@
+-/* $Cambridge: exim/exim-src/src/srs.c,v 1.4 2005/02/17 11:58:26 ph10 Exp $ */
+-
+ /*************************************************
+ * Exim - an Internet mail transport agent *
+ *************************************************/
+
+ /* SRS - Sender rewriting scheme support
+- ©2004 Miles Wilton <miles@mirtol.com>
++ (C)2004 Miles Wilton <miles@mirtol.com>
++
++ SRS Support Version: 1.0
++
+ License: GPL */
+
+ #include "exim.h"
+@@ -24,72 +25,88 @@
+
+ int eximsrs_init()
+ {
+- int co;
+ uschar *list = srs_config;
+ char secret_buf[SRS_MAX_SECRET_LENGTH];
+ char *secret;
+ char sbuf[4];
+ char *sbufp;
+- int hashlen, maxage;
+-
+
++ // Check if this instance of Exim has not initialized SRS
+ if(!srs)
+ {
+- /* Check config */
+- if(!srs_config)
++ int co = 0;
++ int hashlen, maxage;
++ BOOL usetimestamp, usehash;
++
++ /* Copy config vars */
++ hashlen = srs_hashlength;
++ maxage = srs_maxage;
++ usetimestamp = srs_usetimestamp;
++ usehash = srs_usehash;
++
++ /* Pass srs_config var (overrides new config vars) */
++ co = 0;
++ if(srs_config)
+ {
+- log_write(0, LOG_MAIN | LOG_PANIC,
+- "SRS Configuration Error");
+- return DEFER;
++ secret = string_nextinlist(&list, &co, secret_buf, SRS_MAX_SECRET_LENGTH);
++
++ if((sbufp = string_nextinlist(&list, &co, sbuf, sizeof(sbuf))) != NULL)
++ maxage = atoi(sbuf);
++
++ if((sbufp = string_nextinlist(&list, &co, sbuf, sizeof(sbuf))) != NULL)
++ hashlen = atoi(sbuf);
++
++ if((sbufp = string_nextinlist(&list, &co, sbuf, sizeof(sbuf))) != NULL)
++ usetimestamp = atoi(sbuf);
++
++ if((sbufp = string_nextinlist(&list, &co, sbuf, sizeof(sbuf))) != NULL)
++ usehash = atoi(sbuf);
+ }
++
++ if(srs_hashmin == -1)
++ srs_hashmin = hashlen;
+
+- /* Get config */
++ /* First secret specified in secrets? */
+ co = 0;
+- if((secret = string_nextinlist(&list, &co, secret_buf,
+- SRS_MAX_SECRET_LENGTH)) == NULL)
++ list = srs_secrets;
++ if(secret == NULL)
+ {
+- log_write(0, LOG_MAIN | LOG_PANIC,
+- "SRS Configuration Error: No secret specified");
+- return DEFER;
++ if((secret = string_nextinlist(&list, &co, secret_buf, SRS_MAX_SECRET_LENGTH)) == NULL)
++ {
++ log_write(0, LOG_MAIN | LOG_PANIC,
++ "SRS Configuration Error: No secret specified");
++ return DEFER;
++ }
+ }
+-
+- if((sbufp = string_nextinlist(&list, &co, sbuf, sizeof(sbuf))) == NULL)
+- maxage = 31;
+- else
+- maxage = atoi(sbuf);
++
++ /* Check config */
+ if(maxage < 0 || maxage > 365)
+ {
+ log_write(0, LOG_MAIN | LOG_PANIC,
+ "SRS Configuration Error: Invalid maximum timestamp age");
+ return DEFER;
+ }
+-
+- if((sbufp = string_nextinlist(&list, &co, sbuf, sizeof(sbuf))) == NULL)
+- hashlen = 6;
+- else
+- hashlen = atoi(sbuf);
+- if(hashlen < 1 || hashlen > 20)
++ if(hashlen < 1 || hashlen > 20 || srs_hashmin < 1 || srs_hashmin > 20)
+ {
+ log_write(0, LOG_MAIN | LOG_PANIC,
+ "SRS Configuration Error: Invalid hash length");
+ return DEFER;
+ }
+
+-
+ if((srs = srs_open(secret, strnlen(secret, SRS_MAX_SECRET_LENGTH),
+- maxage, hashlen, hashlen)) == NULL)
++ maxage, hashlen, srs_hashmin)) == NULL)
+ {
+ log_write(0, LOG_MAIN | LOG_PANIC,
+ "Failed to allocate SRS memory");
+ return DEFER;
+ }
+
++ srs_set_option(srs, SRS_OPTION_USETIMESTAMP, usetimestamp);
++ srs_set_option(srs, SRS_OPTION_USEHASH, usehash);
+
+- if((sbufp = string_nextinlist(&list, &co, sbuf, sizeof(sbuf))) != NULL)
+- srs_set_option(srs, SRS_OPTION_USETIMESTAMP, atoi(sbuf));
+-
+- if((sbufp = string_nextinlist(&list, &co, sbuf, sizeof(sbuf))) != NULL)
+- srs_set_option(srs, SRS_OPTION_USEHASH, atoi(sbuf));
++ /* Extra secrets? */
++ while((secret = string_nextinlist(&list, &co, secret_buf, SRS_MAX_SECRET_LENGTH)) != NULL)
++ srs_add_secret(srs, secret, strnlen(secret, SRS_MAX_SECRET_LENGTH));
+
+ DEBUG(D_any)
+ debug_printf("SRS initialized\n");
+@@ -151,11 +168,12 @@
+ int eximsrs_db_set(BOOL reverse, uschar *srs_db)
+ {
+ if(reverse)
+- srs_db_reverse = string_copy(srs_db);
++ srs_db_reverse = (srs_db == NULL ? NULL : string_copy(srs_db));
+ else
+- srs_db_forward = string_copy(srs_db);
++ srs_db_forward = (srs_db == NULL ? NULL : string_copy(srs_db));
+
+- if(srs_set_db_functions(srs, eximsrs_db_insert, eximsrs_db_lookup) * SRS_RESULT_FAIL)
++ if(srs_set_db_functions(srs, (srs_db_forward ? eximsrs_db_insert : NULL),
++ (srs_db_reverse ? eximsrs_db_lookup : NULL)) & SRS_RESULT_FAIL)
+ return DEFER;
+
+ return OK;
+@@ -167,9 +185,12 @@
+ uschar *res;
+ char buf[64];
+
++ if(!srs_db_forward)
++ return SRS_RESULT_DBERROR;
++
+ srs_db_address = string_copyn(data, data_len);
+ if(srs_generate_unique_id(srs, srs_db_address, buf, 64) & SRS_RESULT_FAIL)
+- return DEFER;
++ return SRS_RESULT_DBERROR;
+
+ srs_db_key = string_copyn(buf, 16);
+
+@@ -188,6 +209,9 @@
+ srs_result eximsrs_db_lookup(srs_t *srs, char *data, uint data_len, char *result, uint result_len)
+ {
+ uschar *res;
++
++ if(!srs_db_reverse)
++ return SRS_RESULT_DBERROR;
+
+ srs_db_key = string_copyn(data, data_len);
+ if((res = expand_string(srs_db_reverse)) == NULL)
+diff -Naur exim-4.50/src/structs.h exim-4.50-patched/src/structs.h
+--- exim-4.50/src/structs.h 2005-02-17 14:49:11.000000000 +0000
++++ exim-4.50-patched/src/structs.h 2005-04-01 18:55:45.000000000 +0100
+@@ -469,6 +469,10 @@
+ uschar *errors_address; /* where to send errors (NULL => sender) */
+ header_line *extra_headers; /* additional headers */
+ uschar *remove_headers; /* list of those to remove */
++
++ #ifdef EXPERIMENTAL_SRS
++ uschar *srs_sender; /* Change return path when delivering */
++ #endif
+ } address_item_propagated;
+
+ /* Bits for the flags field below */
+@@ -551,7 +555,7 @@
+ uschar *cipher; /* Cipher used for transport */
+ uschar *peerdn; /* DN of server's certificate */
+ #endif
+-
++
+ uid_t uid; /* uid for transporting */
+ gid_t gid; /* gid for transporting */
+
+diff -Naur exim-4.50/src/verify.c exim-4.50-patched/src/verify.c
+--- exim-4.50/src/verify.c 2005-02-17 14:49:11.000000000 +0000
++++ exim-4.50-patched/src/verify.c 2005-04-01 22:34:52.000000000 +0100
+@@ -1228,6 +1228,10 @@
+ addr_list = addr->next;
+
+ fprintf(f, "%s", CS addr->address);
++#ifdef EXPERIMENTAL_SRS
++ if(addr->p.srs_sender)
++ fprintf(f, " [srs = %s]", addr->p.srs_sender);
++#endif
+ while (p != NULL)
+ {
+ fprintf(f, "\n <-- %s", p->address);