1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-23 00:43:28 +00:00

Update to 4.50

* Remove WITH/WITHOUT_EXISCAN variable, since exiscan code was
  merged into exim-4.50

* Introduce two new variables: WITH_CONTENT_SCAN and WITH_OLD_DEMIME.

* Enable WITH_OLD_DEMIME by default to preserve backward
  compatibility with deprecated "demime" ACL condition.  For Exim
  itself, setting WITH_OLD_DEMIME forces WITH_CONTENT_SCAN to be set.

* Remove POST-INSTALL-NOTES.exiscan-acl and xpatch-exiscan2 patches.

* Add experimental-spec.txt into docs, to inform about experimental
  features.

PR:		ports/78168
Submitted by:	krion
Approved by:	maintainer is currently MIA
This commit is contained in:
Kirill Ponomarev 2005-03-02 21:50:48 +00:00
parent 513c2cb874
commit d0ec9aa055
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=130219
6 changed files with 41 additions and 657 deletions

View File

@ -6,7 +6,7 @@
#
PORTNAME= exim
PORTVERSION?= ${EXIM_VERSION}+${EXISCAN_VERSION}
PORTVERSION?= ${EXIM_VERSION}
PORTREVISION= 0
CATEGORIES= mail
MASTER_SITES= ${MASTER_SITE_EXIM:S/$/:exim/}
@ -21,14 +21,6 @@ COMMENT?= High performance MTA for Unix systems on the Internet
.include "options"
.if !defined(WITHOUT_EXISCAN)
PATCH_SITES= http://duncanthrax.net/%SUBDIR%/
PATCH_SITE_SUBDIR= exiscan-acl
PATCHFILES= exiscan-acl-${EXIM_VERSION}-${EXISCAN_VERSION}.patch.bz2
PATCH_DIST_STRIP= -p1
EXTRA_PATCHES+= ${PATCHDIR}/xpatch-exiscan2
.endif
.if defined(WITH_SA_EXIM)
MASTER_SITES+= http://marc.merlins.org/linux/exim/files/:sa_exim \
${MASTER_SITE_SOURCEFORGE_EXTENDED:S/$/:sa_exim/}
@ -36,9 +28,7 @@ MASTER_SITE_SUBDIR+= sa-exim/:sa_exim
DISTFILES+= sa-exim-${SA_EXIM_VERSION}.tar.gz:sa_exim
.endif
EXIM_VERSION= 4.44
EXISCAN_VERSION=28
SA_EXIM_VERSION=4.2
EXIM_VERSION= 4.50
IGNOREFILES= FAQ.txt.bz2
@ -74,7 +64,8 @@ NO_INSTALL_MANPAGES= yes
PORTDOC_BASE= ACKNOWLEDGMENTS FAQ NOTICE README.UPDATING
PORTDOC_FILES= ChangeLog Exim3.upgrade Exim4.upgrade NewStuff \
OptionLists.txt README README.SIEVE dbm.discuss.txt \
filter.txt pcrepattern.txt pcretest.txt spec.txt
experimental-spec.txt filter.txt pcrepattern.txt \
pcretest.txt spec.txt
PORT_EXAMPLES= convert4r3 convert4r4 pcretest transport-filter.pl
@ -113,15 +104,19 @@ PLIST_SUB= EXIM_VERSION="${EXIM_VERSION}-${PORTREVISION}" \
EXIM_GROUP=${EXIM_GROUP} \
LOGDIR="${LOGDIR}"
# Define it to enabale malware and spam scanning in the DATA ACL,
# and the MIME ACL.
#WITH_CONTENT_SCAN= yes
# Enable old, deprecated "demime" ACL condition, in addition
# to all the other content-scanning features.
#WITHOUT_OLD_DEMIME= yes
# If WITH_EXIMON is defined, the eximon monitor, which requires X,
# will be made a dependency. Note that using WITH_EXIMON will cause
# XFree86 to be installed if it is not present.
#WITH_EXIMON= yes
# If WITHOUT_EXISCAN is defined, exim will be built without exiscan
# email content scanner support.
#WITHOUT_EXISCAN= yes
# If WITH_SA_EXIM is defined, exim will be built with the SA-Exim
# local_scan function (<http://marc.merlins.org/linux/exim/sa.html>)
#WITH_SA_EXIM= yes
@ -250,13 +245,6 @@ WITH_DEFAULT_CHARSET?= ISO-8859-1
EXTRA_PATCHES+= `${FIND} ${PATCHDIR} -name 'wishlist-*.patch'`
.endif
.if !defined(WITHOUT_EXISCAN)
PORTDOC_FILES+= exiscan-acl-examples.txt exiscan-acl-spec.txt
PLIST_SUB+= EXISCAN_ACL=""
.else
PLIST_SUB+= EXISCAN_ACL="@comment "
.endif
SEDLIST+= -e 's,XX_CFLAGS_XX,${CFLAGS},' \
-e 's,XX_PREFIX_XX,${PREFIX},' \
-e 's,XX_LOCALBASE_XX,${LOCALBASE},' \
@ -483,7 +471,7 @@ SEDLIST+= -e 's,^\# (TRANSPORT_LMTP=),\1,'
SEDLIST+= -e 's,^(ALT_CONFIG_PREFIX=),\# \1,'
.endif
.if defined(WITH_SPF) && !defined(WITHOUT_EXISCAN)
.if defined(WITH_SPF)
LIB_DEPENDS+= spf2.1:${PORTSDIR}/mail/libspf2
SEDLIST+= -e 's,XX_SPF_FLAGS_XX,-DSPF,' \
-e 's,XX_SPF_LIBS_XX,-lspf2,'
@ -492,7 +480,7 @@ SEDLIST+= -e 's,XX_SPF_FLAGS_XX,,' \
-e 's,XX_SPF_LIBS_XX,,'
.endif
.if defined(WITH_SRS) && !defined(WITHOUT_EXISCAN)
.if defined(WITH_SRS)
LIB_DEPENDS+= srs2.0:${PORTSDIR}/mail/libsrs2
SEDLIST+= -e 's,XX_SRS_FLAGS_XX,-DSRS,' \
-e 's,XX_SRS_LIBS_XX,-lsrs2,'
@ -512,6 +500,14 @@ PLIST_SUB+= SA_EXIM="@comment "
SEDLIST+= -e 's,^\# (USE_READLINE=),\1,'
.endif
.if defined(WITH_CONTENT_SCAN)
SEDLIST+= -e 's,^\# (WITH_CONTENT_SCAN=),\1,'
.endif
.if !defined(WITHOUT_OLD_DEMIME)
SEDLIST+= -e 's,^\# (WITH_OLD_DEMIME=),\1,'
.endif
.include <bsd.port.pre.mk>
.if defined(EXIMON_ONLY) && ${MASTERDIR} == ${PKGDIR}
@ -596,13 +592,10 @@ post-build:
.for script in exim ${DAILY_SCRIPTS}
@${SED} ${SED_SCRIPT} ${FILESDIR}/${script}.sh > ${WRKDIR}/${script}.sh
.endfor
.if !defined(WITHOUT_EXISCAN)
@${SED} ${SED_SCRIPT} ${FILESDIR}/POST-INSTALL-NOTES.exiscan-acl \
${FILESDIR}/POST-INSTALL-NOTES > ${WRKDIR}/POST-INSTALL-NOTES
@${SED} ${SED_SCRIPT} ${FILESDIR}/POST-INSTALL-NOTES > \
${WRKDIR}/POST-INSTALL-NOTES
@${SED} ${SED_SCRIPT} ${FILESDIR}/POST-INSTALL-NOTES.clamd > ${WRKDIR}/POST-INSTALL-NOTES.clamd
.else
@${SED} ${SED_SCRIPT} ${FILESDIR}/POST-INSTALL-NOTES > ${WRKDIR}/POST-INSTALL-NOTES
.endif
@[ ! -f ${PKGDIR}/pkg-message ] || ${SED} ${SED_SCRIPT} ${PKGDIR}/pkg-message > ${WRKDIR}/pkg-message
.if !defined(EXIMON_ONLY)
@ -627,9 +620,7 @@ post-install:
.if !defined(NOPORTDOCS)
@${MKDIR} ${DESTDIR}${DOCSDIR}
@${INSTALL_DATA} ${WRKDIR}/POST-INSTALL-NOTES ${DESTDIR}${DOCSDIR}
.if !defined(WITHOUT_EXISCAN)
@${INSTALL_DATA} ${WRKDIR}/POST-INSTALL-NOTES.clamd ${DESTDIR}${DOCSDIR}
.endif
.for docfile in ${PORTDOC_BASE}
@${INSTALL_DATA} ${WRKSRC}/${docfile} ${DESTDIR}${DOCSDIR}
.endfor

View File

@ -1,7 +1,3 @@
MD5 (exim/exim-4.44.tar.bz2) = 7487274e013b598d97445987d38b2071
SIZE (exim/exim-4.44.tar.bz2) = 1364290
MD5 (exim/sa-exim-4.2.tar.gz) = ad76f73c6b3d01caa88078e3e622745a
SIZE (exim/sa-exim-4.2.tar.gz) = 66575
MD5 (exim/exiscan-acl-4.44-28.patch.bz2) = 72ef5567106e89e6cef1cc742ab52525
SIZE (exim/exiscan-acl-4.44-28.patch.bz2) = 83434
MD5 (exim/exim-4.50.tar.bz2) = 7844eff82171872f6b3971a4183368d9
SIZE (exim/exim-4.50.tar.bz2) = 1434928
MD5 (exim/FAQ.txt.bz2) = IGNORE

View File

@ -1,13 +0,0 @@
This installation of Exim includes Exiscan content scanning support,
from http://duncanthrax.net/exiscan-acl/, which is documented in
%%DOCSDIR%%/exiscan-acl-spec.txt. The ports tree
includes various content scanners that might be useful, e.g.
mail/p5-Mail-SpamAssassin and security/clamav.
Notes for enabling malware scanning with the excellent clamd scanner
are in %%DOCSDIR%%/POST-INSTALL-NOTES.clamd.
When Exiscan is actually enabled in the Exim configure file, great
care should be taken to test upgrades, since Exiscan updates tend
to not maintain backward compatibility.

View File

@ -1,596 +0,0 @@
diff -u scripts/MakeLinks scripts/MakeLinks
--- scripts/MakeLinks Sat Jul 17 11:12:00 2004
+++ scripts/MakeLinks Sat Jul 17 11:34:48 2004
@@ -187,7 +187,7 @@
ln -s ../src/osfunctions.h osfunctions.h
ln -s ../src/spam.h spam.h
ln -s ../src/spf.h spf.h
-ln -s ../src/srs.h srs.h
+ln -s ../src/srs.h srs.h
ln -s ../src/store.h store.h
ln -s ../src/structs.h structs.h
ln -s ../src/tnef.h tnef.h
diff -u src/expand.c src/expand.c
--- src/expand.c Sat Jul 17 11:12:00 2004
+++ src/expand.c Sat Jul 17 11:37:42 2004
@@ -454,8 +454,6 @@
#endif
{ "spool_directory", vtype_stringptr, &spool_directory },
#ifdef SRS
- { "srs_db_address", vtype_stringptr, &srs_db_address },
- { "srs_db_key", vtype_stringptr, &srs_db_key },
{ "srs_orig_recipient", vtype_stringptr, &srs_orig_recipient },
{ "srs_orig_sender", vtype_stringptr, &srs_orig_sender },
{ "srs_recipient", vtype_stringptr, &srs_recipient },
diff -u src/globals.c src/globals.c
--- src/globals.c Sat Jul 17 11:12:00 2004
+++ src/globals.c Sat Jul 17 11:38:52 2004
@@ -987,9 +987,12 @@
uschar *spool_directory = US SPOOL_DIRECTORY
"\0<--------------Space to patch spool_directory->";
#ifdef SRS
-uschar *srs_config = NULL;
-uschar *srs_db_address = NULL;
-uschar *srs_db_key = NULL;
+BOOL srs_alwaysrewrite = FALSE;
+int srs_hashlength = -1;
+int srs_hashmin = -1;
+int srs_maxage = -1;
+uschar *srs_secrets = NULL;
+uschar *srs_separator = NULL;
uschar *srs_orig_recipient = NULL;
uschar *srs_orig_sender = NULL;
uschar *srs_recipient = NULL;
diff -u src/globals.h src/globals.h
--- src/globals.h Sat Jul 17 11:12:00 2004
+++ src/globals.h Sat Jul 17 11:43:06 2004
@@ -596,13 +596,16 @@
#endif
extern uschar *spool_directory; /* Name of spool directory */
#ifdef SRS
-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 uschar *srs_orig_sender; /* SRS original sender */
-extern uschar *srs_orig_recipient; /* SRS original recipient */
-extern uschar *srs_recipient; /* SRS recipient */
-extern uschar *srs_status; /* SRS staus */
+extern BOOL srs_alwaysrewrite; /* Rewrite for all domains */
+extern int srs_hashlength; /* Hash length to generate */
+extern int srs_hashmin; /* Hash length to check */
+extern int srs_maxage; /* Max age for SRS address */
+extern uschar *srs_secrets; /* List of SRS secrets */
+extern uschar *srs_separator; /* Separator for SRS addresses */
+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_status; /* SRS status */
#endif
extern int string_datestamp_offset;/* After insertion by string_format */
extern BOOL strip_excess_angle_brackets; /* Surrounding route-addrs */
diff -u src/readconf.c src/readconf.c
--- src/readconf.c Sat Jul 17 11:12:00 2004
+++ src/readconf.c Sat Jul 17 11:44:21 2004
@@ -325,7 +325,12 @@
{ "split_spool_directory", opt_bool, &split_spool_directory },
{ "spool_directory", opt_stringptr, &spool_directory },
#ifdef SRS
- { "srs_config", opt_stringptr, &srs_config },
+ { "srs_alwaysrewrite", opt_bool, &srs_alwaysrewrite },
+ { "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_separator", opt_stringptr, &srs_separator },
#endif
{ "strip_excess_angle_brackets", opt_bool, &strip_excess_angle_brackets },
{ "strip_trailing_dot", opt_bool, &strip_trailing_dot },
diff -u src/routers/redirect.c src/routers/redirect.c
--- src/routers/redirect.c Sat Jul 17 11:12:00 2004
+++ src/routers/redirect.c Sat Jul 17 12:26:47 2004
@@ -98,13 +98,7 @@
(void *)offsetof(redirect_router_options_block, skip_syntax_errors) },
#ifdef SRS
{ "srs", opt_stringptr,
- (void *)offsetof(redirect_router_options_block, srs) },
- { "srs_alias", opt_stringptr,
- (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) },
+ (void *)offsetof(redirect_router_options_block, srs) },
#endif
{ "syntax_errors_text", opt_stringptr,
(void *)offsetof(redirect_router_options_block, syntax_errors_text) },
@@ -141,9 +135,6 @@
NULL, /* owngroups */
#ifdef SRS
NULL, /* srs */
- NULL, /* srs_condition */
- NULL, /* srs_db */
- NULL, /* srs_alias */
#endif
022, /* modemask */
RDO_REWRITE, /* bit_options */
@@ -538,39 +532,33 @@
ugid.gid_set = TRUE;
}
-
#ifdef SRS
/* For reverse SRS, fill the srs_recipient expandsion variable,
on failure, return decline/fail as relevant */
- if(ob->srs != NULL)
+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, "reverse") == 0 || Ustrcmp(ob->srs, "reverseandforward") == 0)
- {
- uschar *res;
- int n_srs;
-
- 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)
- return n_srs;
- srs_recipient = res;
- eximsrs_done();
- DEBUG(D_any)
- debug_printf("SRS: Recipient '%s' rewriteen to '%s'\n", srs_orig_recipient, srs_recipient);
- }
+ if (Ustrcmp(ob->srs, "reverse") == 0 || Ustrcmp(ob->srs, "reverseandforward") == 0)
+ {
+ uschar *res;
+ int ret;
+ DEBUG(D_route)
+ debug_printf("SRS: (Forward) \n");
+
+ srs_orig_recipient = addr->address;
+ eximsrs_init();
+ ret = eximsrs_reverse(&res, addr->address);
+ if (ret != OK)
+ return ret;
+ srs_recipient = res;
+ eximsrs_done();
+ DEBUG(D_route)
+ debug_printf("SRS: Recipient '%s' rewritten to '%s'\n",
+ srs_orig_recipient, srs_recipient);
+ }
}
#endif
-
/* Call the function that interprets redirection data, either inline or from a
file. This is a separate function so that the system filter can use it. It will
run the function in a subprocess if necessary. If qualify_preserve_domain is
@@ -798,33 +789,23 @@
#ifdef SRS
/* On successful redirection, check for SRS forwarding and adjust sender */
- if(ob->srs != NULL)
+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);
+ if ((Ustrcmp(ob->srs, "forward") == 0 || Ustrcmp(ob->srs, "reverseandforward") == 0) && !verify )
+ {
+ uschar *res;
+ int ret;
+ DEBUG(D_route)
+ debug_printf("SRS: (Forward) \n");
+ srs_orig_sender = sender_address;
+ eximsrs_init();
+ ret = eximsrs_forward(&res, sender_address, deliver_domain);
+ if (ret != OK)
+ return ret;
+ sender_address = res;
+ DEBUG(D_route)
+ debug_printf("SRS: Sender '%s' rewritten to '%s'\n",
+ srs_orig_sender, sender_address);
}
}
#endif
diff -u src/routers/redirect.h src/routers/redirect.h
--- src/routers/redirect.h Sat Jul 17 11:12:00 2004
+++ src/routers/redirect.h Sat Jul 17 11:55:47 2004
@@ -33,9 +33,6 @@
#ifdef SRS
uschar *srs;
- uschar *srs_condition;
- uschar *srs_db;
- uschar *srs_alias;
#endif
int modemask;
diff -u src/srs.c src/srs.c
--- src/srs.c Sat Jul 17 11:12:00 2004
+++ src/srs.c Sat Jul 17 12:28:31 2004
@@ -5,205 +5,127 @@
/* This file is an extension to Exim and is not part of the standard
Exim distribution */
-/* (c)2004 Miles Wilton <miles@mirtol.com> */
+/* (c) 2004 Shevek
+ * Based on work by Miles Wilton <miles@mirtol.com>
+ * Updated by Shevek to use libsrs2
+ * Sorry Miles, I was in a roaring hurry, but we still need the
+ * help!
+ */
/* License: GPL */
+#include "exim.h"
#ifdef SRS
-#include <srs_alt.h>
+#include <srs2.h>
-#include "exim.h"
#include "srs.h"
-srs_t *srs = NULL;
-uschar *srs_db_forward = NULL;
-uschar *srs_db_reverse = NULL;
+#define SRS_WARN_UNLESS(x) do { \
+ int __ret = (x); \
+ if (__ret != SRS_SUCCESS) \
+ DEBUG(D_any) \
+ debug_printf("srs: %s\n", srs_strerror(__ret)); \
+ } while(0)
+
+srs_t *srs = NULL;
+
+int
+eximsrs_init()
+{
+ char sbuf[1024];
+ uschar *list;
+ int co;
+
+ char *secret;
+
+ if (srs == NULL) {
+ srs = srs_new();
+
+ if (srs_secrets == NULL) {
+ log_write(0, LOG_MAIN | LOG_PANIC,
+ "SRS: No secrets specified");
+ return DEFER;
+ }
+
+ /* Get config */
+ list = srs_secrets;
+
+ co = 0;
+ while ((secret = string_nextinlist(&list, &co,
+ sbuf, sizeof(sbuf))) != NULL) {
+ SRS_WARN_UNLESS(srs_add_secret(srs, secret));
+ }
+
+ SRS_WARN_UNLESS(srs_set_alwaysrewrite(srs, srs_alwaysrewrite));
+ if (srs_hashlength != -1)
+ SRS_WARN_UNLESS(srs_set_hashlength(srs, srs_hashlength));
+ if (srs_hashmin != -1)
+ SRS_WARN_UNLESS(srs_set_hashmin(srs, srs_hashmin));
+ if (srs_maxage != -1)
+ SRS_WARN_UNLESS(srs_set_maxage(srs, srs_maxage));
+ if (srs_separator != NULL)
+ SRS_WARN_UNLESS(srs_set_separator(srs, srs_separator[0]));
+
+ DEBUG(D_any)
+ debug_printf("SRS initialised\n");
+ }
+
+ return OK;
+}
+
+int
+eximsrs_done()
+{
+ if (srs != NULL)
+ srs_free(srs);
+ srs = NULL;
+ return OK;
+}
+
+int
+eximsrs_forward(uschar **result, uschar *sender, uschar *domain)
+{
+ char res[1024];
+ int ret;
+
+ ret = srs_forward(srs, res, sizeof(res), sender, domain);
+ if (ret != SRS_SUCCESS) {
+ DEBUG(D_any)
+ debug_printf("srs_forward failed (%s, %s): %s\n",
+ sender, domain, srs_strerror(ret));
+ return DEFER;
+ }
+
+ *result = string_copy(res);
+ return OK;
+}
+
+int
+eximsrs_reverse(uschar **result, uschar *sender)
+{
+ char res[1024];
+ int ret;
+
+ ret = srs_reverse(srs, res, sizeof(res), sender);
+ if (ret != SRS_SUCCESS) {
+ switch (SRS_ERROR_TYPE(ret)) {
+ case SRS_ERRTYPE_CONFIG:
+ /* This should never happen */
+ return DEFER;
+ case SRS_ERRTYPE_INPUT:
+ /* This should never happen */
+ return DEFER;
+ case SRS_ERRTYPE_SYNTAX:
+ return DECLINE;
+ case SRS_ERRTYPE_SRS:
+ return FAIL;
+ }
+ }
+ *result = string_copy(res);
-/* srs_init just initialises libsrs and creates (if necessary)
- an srs object to use for all srs calls in this instance */
-
-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;
-
-
- if(!srs)
- {
- // Check config
- if(!srs_config)
- {
- log_write(0, LOG_MAIN | LOG_PANIC,
- "SRS Configuration Error");
- return DEFER;
- }
-
- // Get config
- co = 0;
- 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);
- 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)
- {
- 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)
- {
- log_write(0, LOG_MAIN | LOG_PANIC,
- "Failed to allocate SRS memory");
- return DEFER;
- }
-
-
- 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));
-
- DEBUG(D_any)
- debug_printf("SRS initialized\n");
- }
-
- return OK;
-}
-
-
-int eximsrs_done()
-{
- if(srs)
- srs_close(srs);
-
- srs = NULL;
-
- return OK;
-}
-
-
-int eximsrs_forward(uschar **result, uschar *orig_sender, uschar *domain)
-{
- char res[512];
- int n;
-
- if((n = srs_forward(srs, orig_sender, domain, res, sizeof(res))) & SRS_RESULT_FAIL)
- {
- DEBUG(D_any)
- debug_printf("srs_forward failed (%s, %s): %s\n", orig_sender, domain, srs_geterrormsg(n));
- return DEFER;
- }
-
- *result = string_copy(res);
- return OK;
-}
-
-
-int eximsrs_reverse(uschar **result, uschar *address)
-{
- char res[512];
- int n;
-
- if((n = srs_reverse(srs, address, res, sizeof(res))) & SRS_RESULT_FAIL)
- {
- DEBUG(D_any)
- debug_printf("srs_reverse failed (%s): %s\n", address, srs_geterrormsg(n));
- if(n == SRS_RESULT_NOTSRS || n == SRS_RESULT_BADSRS)
- return DECLINE;
- if(n == SRS_RESULT_BADHASH || n == SRS_RESULT_BADTIMESTAMP || n == SRS_RESULT_TIMESTAMPEXPIRED)
- return FAIL;
- return DEFER;
- }
-
- *result = string_copy(res);
- return OK;
+ return OK;
}
-
-
-int eximsrs_db_set(BOOL reverse, uschar *srs_db)
-{
- if(reverse)
- srs_db_reverse = string_copy(srs_db);
- else
- srs_db_forward = string_copy(srs_db);
-
- if(srs_set_db_functions(srs, eximsrs_db_insert, eximsrs_db_lookup) * SRS_RESULT_FAIL)
- return DEFER;
-
- return OK;
-}
-
-
-srs_result eximsrs_db_insert(srs_t *srs, char *data, uint data_len, char *result, uint result_len)
-{
- uschar *res;
- char buf[64];
-
- srs_db_address = string_copyn(data, data_len);
- if(srs_generate_unique_id(srs, srs_db_address, buf, 64) & SRS_RESULT_FAIL)
- return DEFER;
-
- srs_db_key = string_copyn(buf, 16);
-
- if((res = expand_string(srs_db_forward)) == NULL)
- return SRS_RESULT_DBERROR;
-
- if(result_len < 17)
- return SRS_RESULT_DBERROR;
-
- strncpy(result, srs_db_key, result_len);
-
- return SRS_RESULT_OK;
-}
-
-
-srs_result eximsrs_db_lookup(srs_t *srs, char *data, uint data_len, char *result, uint result_len)
-{
- uschar *res;
-
- srs_db_key = string_copyn(data, data_len);
- if((res = expand_string(srs_db_reverse)) == NULL)
- return SRS_RESULT_DBERROR;
-
- if(Ustrlen(res) >= result_len)
- return SRS_RESULT_ADDRESSTOOLONG;
-
- strncpy(result, res, result_len);
-
- return SRS_RESULT_OK;
-}
-
-
#endif
-
diff -u src/srs.h src/srs.h
--- src/srs.h Sat Jul 17 11:12:00 2004
+++ src/srs.h Sat Jul 17 11:58:51 2004
@@ -5,28 +5,28 @@
/* This file is an extension to Exim and is not part of the standard
Exim distribution */
-/* ©2004 Miles Wilton <miles@mirtol.com> */
+/* (c) 2004 Shevek
+ * Based on work by Miles Wilton <miles@mirtol.com>
+ * Updated by Shevek to use libsrs2
+ * Sorry Miles, I was in a roaring hurry, but we still need the
+ * help!
+ */
/* License: GPL */
#ifndef __SRS_H__
-
#define __SRS_H__ 1
-
#ifdef SRS
#include "mytypes.h"
-#include <srs_alt.h>
+#include <srs2.h>
int eximsrs_init();
int eximsrs_done();
int eximsrs_forward(uschar **result, uschar *orig_sender, uschar *domain);
int eximsrs_reverse(uschar **result, uschar *address);
-int eximsrs_db(BOOL reverse, uschar *srs_db);
-srs_result eximsrs_db_insert(srs_t *srs, char *data, uint data_len, char *result, uint result_len);
-srs_result eximsrs_db_lookup(srs_t *srs, char *data, uint data_len, char *result, uint result_len);
#endif

View File

@ -3,12 +3,16 @@
# Configurable options for mail/exim. Note that the options listed
# here are the defaults, so if you want to change them you have to
# specify the opposite version in the command line, e.g.
# `make WITHOUT_EXISCAN=yes WITH_SASLAUTHD=yes install'
# `make WITH_CONTENT_SCAN=yes WITH_SASLAUTHD=yes install'
#
# `make WITH_EXISCAN=no WITHOUT_SASLAUTHD=no' will not give the expected results.
# `make WITHOUT_CONTENT_SCAN=yes WITHOUT_SASLAUTHD=no' will not give the expected results.
#WITH_EXISCAN
# Exim will be built with exiscan email content scanner support.
#WITHOUT_CONTENT_SCAN
# Exim will be built without exiscan email content scanner support.
#WITH_OLD_DEMIME
# Enable old, deprecated "demime" ACL condition, in addition
# to all the other content-scanning features.
#WITHOUT_SA_EXIM
# SA-Exim support (<http://marc.merlins.org/linux/exim/sa.html>)
@ -159,8 +163,11 @@
# use `make makeconfig' to edit the defaults (MAINTAINER only)
_OPTIONSNG_READ?=default
.ifndef WITHOUT_EXISCAN
WITH_EXISCAN?=yes
.ifndef WITH_CONTENT_SCAN
WITHOUT_CONTENT_SCAN?=yes
.endif
.ifndef WITHOUT_OLD_DEMIME
WITH_OLD_DEMIME?=yes
.endif
.ifndef WITH_SA_EXIM
WITHOUT_SA_EXIM?=yes

View File

@ -28,12 +28,11 @@ sbin/exiwhat
%%PORTDOCS%%%%DOCSDIR%%/NewStuff
%%PORTDOCS%%%%DOCSDIR%%/OptionLists.txt
%%PORTDOCS%%%%DOCSDIR%%/POST-INSTALL-NOTES
%%PORTDOCS%%%%EXISCAN_ACL%%%%DOCSDIR%%/POST-INSTALL-NOTES.clamd
%%PORTDOCS%%%%DOCSDIR%%/POST-INSTALL-NOTES.clamd
%%PORTDOCS%%%%DOCSDIR%%/README
%%PORTDOCS%%%%DOCSDIR%%/README.SIEVE
%%PORTDOCS%%%%DOCSDIR%%/dbm.discuss.txt
%%PORTDOCS%%%%EXISCAN_ACL%%%%DOCSDIR%%/exiscan-acl-examples.txt
%%PORTDOCS%%%%EXISCAN_ACL%%%%DOCSDIR%%/exiscan-acl-spec.txt
%%PORTDOCS%%%%DOCSDIR%%/experimental-spec.txt
%%PORTDOCS%%%%DOCSDIR%%/filter.txt
%%PORTDOCS%%%%DOCSDIR%%/pcrepattern.txt
%%PORTDOCS%%%%DOCSDIR%%/pcretest.txt