diff options
author | eik <eik@FreeBSD.org> | 2004-04-29 01:08:06 +0800 |
---|---|---|
committer | eik <eik@FreeBSD.org> | 2004-04-29 01:08:06 +0800 |
commit | 1fa14e8e69fa7a58c6a11aa195d008fc50583b6d (patch) | |
tree | 8a0080563d31e6f578f35e1eb47e0c309dfa3a2a /mail/exim | |
parent | f0bd7ceb18c8a1debb41377a7875b8d94a3608ce (diff) | |
download | freebsd-ports-gnome-1fa14e8e69fa7a58c6a11aa195d008fc50583b6d.tar.gz freebsd-ports-gnome-1fa14e8e69fa7a58c6a11aa195d008fc50583b6d.tar.zst freebsd-ports-gnome-1fa14e8e69fa7a58c6a11aa195d008fc50583b6d.zip |
- update to exiscan-acl version 18
- change `WITH_EXIMON' to include exim-monitor in this package
- remove WITHOUT_WILDLSEARCH, it was non-functional
- add fix for race condition in MBX locking
- add fix for rewrite bug
- add iplsearch wishlist patch
Diffstat (limited to 'mail/exim')
-rw-r--r-- | mail/exim/Makefile | 105 | ||||
-rw-r--r-- | mail/exim/distinfo | 4 | ||||
-rw-r--r-- | mail/exim/files/patch-mbx_lock | 67 | ||||
-rw-r--r-- | mail/exim/files/patch-src::EDITME | 2 | ||||
-rw-r--r-- | mail/exim/files/patch-src::verify.c | 68 | ||||
-rw-r--r-- | mail/exim/files/wishlist-iplsearch.patch | 395 | ||||
-rw-r--r-- | mail/exim/pkg-plist | 2 |
7 files changed, 609 insertions, 34 deletions
diff --git a/mail/exim/Makefile b/mail/exim/Makefile index 93374a9c710a..2f4b830ace7d 100644 --- a/mail/exim/Makefile +++ b/mail/exim/Makefile @@ -6,41 +6,57 @@ # PORTNAME= exim -PORTVERSION= 4.32 +PORTVERSION= ${EXIM_VERSION}+${EXISCAN_VERSION} PORTREVISION= 0 CATEGORIES= mail MASTER_SITES= ${MASTER_SITE_EXIM} MASTER_SITE_SUBDIR= exim4 +DISTNAME= ${PORTNAME}-${EXIM_VERSION} DIST_SUBDIR= exim .if !defined(WITHOUT_EXISCAN) PATCH_SITES= http://duncanthrax.net/%SUBDIR%/ PATCH_SITE_SUBDIR= exiscan-acl -PATCHFILES= exiscan-acl-${EXISCAN_VERSION}.patch.bz2 +PATCHFILES= exiscan-acl-${EXIM_VERSION}-${EXISCAN_VERSION}.patch.bz2 PATCH_DIST_STRIP= -p1 .endif MAINTAINER= eik@FreeBSD.org -COMMENT= High performance MTA for Unix systems on the Internet +COMMENT?= High performance MTA for Unix systems on the Internet -.if defined(WITH_EXIMON) -RUN_DEPENDS= ${LOCALBASE}/sbin/eximon:${PORTSDIR}/mail/exim-monitor -.endif +EXIM_VERSION= 4.32 +EXISCAN_VERSION=18 +.if !defined(EXIMON_ONLY) .if defined(PKGNAMESUFFIX) -CONFLICTS+= ${PKGNAMEPREFIX}${PORTNAME}-4* +CONFLICTS+= ${PKGNAMEPREFIX}${PORTNAME}-4.* .endif .for suffix in -ldap2 -mysql -postgresql .if !defined(PKGNAMESUFFIX) || ${PKGNAMESUFFIX} != ${suffix} -CONFLICTS+= ${PKGNAMEPREFIX}${PORTNAME}${suffix}* +CONFLICTS+= ${PKGNAMEPREFIX}${PORTNAME}${suffix}-4.* .endif .endfor +.if defined(WITH_EXIMON) +CONFLICTS+= ${PKGNAMEPREFIX}${PORTNAME}-monitor-4.* +.endif +.else +WITH_EXIMON= yes +.endif + +.if defined(WITH_EXIMON) +USE_XLIB= yes +.endif USE_BZIP2= yes USE_ICONV= yes USE_PERL5= yes USE_REINPLACE= yes + +.if !defined(EXIMON_ONLY) MAN8= exim.8 +.else +NO_INSTALL_MANPAGES= yes +.endif PORTDOC_BASE= ACKNOWLEDGMENTS NOTICE README.UPDATING PORTDOC_FILES= ChangeLog Exim3.upgrade Exim4.upgrade NewStuff \ @@ -51,25 +67,34 @@ PORT_EXAMPLES= convert4r3 convert4r4 transport-filter.pl DAILY_SCRIPTS= 150.exim-tidydb 460.exim-mail-rejects -EXISCAN_VERSION= ${PORTVERSION}-17 - PKGINSTALL= ${WRKDIR}/pkg-install -PLIST_SUB+= EXIM_VERSION="${PORTVERSION}-${PORTREVISION}" - -.if defined(NOPORTDOCS) +.if defined(NOPORTDOCS) && !defined(EXIMON_ONLY) PKGMESSAGE= ${WRKDIR}/POST-INSTALL-NOTES .else PKGMESSAGE= ${WRKDIR}/pkg-message .endif MAKE_ENV+= OSTYPE=${OPSYS} ARCHTYPE=${MACHINE_ARCH} LOCALBASE=${LOCALBASE} +.if defined(EXIMON_ONLY) +MAKE_ENV+= INSTALL_ARG="eximon eximon.bin" +.endif POSTGRESQL_PORT?= databases/postgresql7 EXIM_USER?= mailnull EXIM_GROUP?= mail +SED_SCRIPT= -e 's,%%PREFIX%%,${PREFIX},g' \ + -e 's,%%DOCSDIR%%,${DOCSDIR},g' \ + -e 's,%%EXAMPLESDIR%%,${EXAMPLESDIR},g' \ + -e 's,%%EXIM_USER%%,${EXIM_USER},g' \ + -e 's,%%EXIM_GROUP%%,${EXIM_GROUP},g' + +PLIST_SUB= EXIM_VERSION="${EXIM_VERSION}-${PORTREVISION}" \ + EXIM_USER=${EXIM_USER} \ + EXIM_GROUP=${EXIM_GROUP} + # 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. @@ -147,13 +172,13 @@ WITH_DEFAULT_CHARSET?= ISO-8859-1 #WITHOUT_MAILSTORE= yes #WITHOUT_MBX= yes # -# Define WITHOUT_CDB, WITHOUT_DNSDB, WITHOUT_DSEARCH, WILD_LSEARCH, +# Define WITHOUT_CDB, WITHOUT_DNSDB, WITHOUT_DSEARCH, WITHOUT_LSEARCH, # WITHOUT_NIS and WITHOUT_PASSWD to disable support for CDB-style, DNS-style, # directory-list, wildcarded-file, NIS and /etc/passwd lookups respectively. #WITHOUT_CDB= yes #WITHOUT_DNSDB= yes #WITHOUT_DSEARCH= yes -#WITHOUT_WILDLSEARCH= yes +#WITHOUT_LSEARCH= yes #WITHOUT_NIS= yes #WITHOUT_PASSWD= yes # @@ -186,6 +211,13 @@ SEDLIST= -e 's,XX_PREFIX_XX,${PREFIX},' \ -e 's,XX_LOCALBASE_XX,${LOCALBASE},' \ -e 's,XX_DEFAULT_CHARSET_XX,${WITH_DEFAULT_CHARSET},' +.if defined(WITH_EXIMON) +SEDLIST+= -e 's,^\# EXIM_MONITOR=,EXIM_MONITOR=,' +PLIST_SUB+= EXIMON="" +.else +PLIST_SUB+= EXIMON="@comment " +.endif + .if !defined(WITHOUT_TLS) SEDLIST+= -e 's,^\# SUPPORT_TLS=,SUPPORT_TLS=,' USE_OPENSSL= yes @@ -340,8 +372,8 @@ SEDLIST+= -e 's,^\# LOOKUP_CDB=,LOOKUP_CDB=,' SEDLIST+= -e 's,^\# LOOKUP_DSEARCH=,LOOKUP_DSEARCH=,' .endif -.if !defined(WITHOUT_WILDLSEARCH) -SEDLIST+= -e 's,^\# LOOKUP_WILDLSEARCH=,LOOKUP_WILDLSEARCH=,' +.if defined(WITHOUT_LSEARCH) +SEDLIST+= -e 's,^LOOKUP_LSEARCH=,\#LOOKUP_LSEARCH=,' .endif .if !defined(WITHOUT_NIS) @@ -362,29 +394,27 @@ SEDLIST+= -e 's,^ALT_CONFIG_PREFIX=,\# ALT_CONFIG_PREFIX=,' .include <bsd.port.pre.mk> -.if ${OSVERSION} >= 500038 -RC_SUBR?= ${DESTDIR}/etc/rc.subr +.if defined(EXIMON_ONLY) && ${MASTERDIR} == ${PKGDIR} +.error EXIMON_ONLY is not user settable +.endif + +.if !defined(EXIMON_ONLY) +USE_RC_SUBR= yes +.if ${OSVERSION} >= 500037 RC_DIR= ${DESTDIR}/etc/rc.d RC_SUFX= .else -USE_RC_SUBR= yes RC_DIR= ${PREFIX}/etc/rc.d RC_SUFX= .sh .endif -SED_SCRIPT= -e 's,%%PREFIX%%,${PREFIX},g' \ - -e 's,%%DOCSDIR%%,${DOCSDIR},g' \ - -e 's,%%EXAMPLESDIR%%,${EXAMPLESDIR},g' \ - -e 's,%%EXIM_USER%%,${EXIM_USER},g' \ - -e 's,%%EXIM_GROUP%%,${EXIM_GROUP},g' \ - -e 's,%%RC_SUBR%%,${RC_SUBR},g' \ +SED_SCRIPT+= -e 's,%%RC_SUBR%%,${RC_SUBR},g' \ -e 's,%%RC_DIR%%,${RC_DIR},g' \ -e 's,%%RC_SUFX%%,${RC_SUFX},g' PLIST_SUB+= RC_DIR=${RC_DIR} \ - RC_SUFX=${RC_SUFX} \ - EXIM_USER=${EXIM_USER} \ - EXIM_GROUP=${EXIM_GROUP} + RC_SUFX=${RC_SUFX} +.endif .if ${OSVERSION} < 400014 WITHOUT_IPV6= yes @@ -406,11 +436,15 @@ pre-everything:: do-configure: @${MKDIR} ${WRKSRC}/Local @${SED} ${SEDLIST} ${WRKSRC}/src/EDITME > ${WRKSRC}/Local/Makefile - @${SED} ${SED_SCRIPT} ${MASTERDIR}/pkg-install > ${PKGINSTALL} +.if defined(WITH_EXIMON) + @${CP} ${WRKSRC}/exim_monitor/EDITME ${WRKSRC}/Local/eximon.conf +.endif + @[ ! -f ${PKGDIR}/pkg-install ] || ${SED} ${SED_SCRIPT} ${PKGDIR}/pkg-install > ${PKGINSTALL} @${REINPLACE_CMD} ${SEDLIST} ${WRKSRC}/src/configure.default @${REINPLACE_CMD} -e 's/"(Exim $$version_number)\\n\\t"/"(Exim $$version_number; ${OPSYS})\\n\\t"/' \ ${WRKSRC}/src/globals.c @${REINPLACE_CMD} -e 's/^#include "cnumber\.h"$$/${PORTREVISION}/' ${WRKSRC}/src/version.c + @(cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} configure) post-build: .for script in exim ${DAILY_SCRIPTS} @@ -423,7 +457,9 @@ post-build: .else @${SED} ${SED_SCRIPT} ${FILESDIR}/POST-INSTALL-NOTES > ${WRKDIR}/POST-INSTALL-NOTES .endif - @${SED} ${SED_SCRIPT} ${MASTERDIR}/pkg-message > ${WRKDIR}/pkg-message + @[ ! -f ${PKGDIR}/pkg-message ] || ${SED} ${SED_SCRIPT} ${PKGDIR}/pkg-message > ${WRKDIR}/pkg-message + +.if !defined(EXIMON_ONLY) pre-install: @PKG_PREFIX="${PREFIX}" ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL @@ -459,4 +495,11 @@ post-install: @${CAT} ${PKGMESSAGE} @PKG_PREFIX="${PREFIX}" ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL +.else + +post-install: + @${CAT} ${PKGMESSAGE} + +.endif + .include <bsd.port.post.mk> diff --git a/mail/exim/distinfo b/mail/exim/distinfo index 6bf6059a27f8..0cbbfeaaced4 100644 --- a/mail/exim/distinfo +++ b/mail/exim/distinfo @@ -1,4 +1,4 @@ MD5 (exim/exim-4.32.tar.bz2) = f2dcbca57a8051c4d89d2cc8d96efd94 SIZE (exim/exim-4.32.tar.bz2) = 1321711 -MD5 (exim/exiscan-acl-4.32-17.patch.bz2) = df7860d17615c928c1f37a1bf65c1aa7 -SIZE (exim/exiscan-acl-4.32-17.patch.bz2) = 70677 +MD5 (exim/exiscan-acl-4.32-18.patch.bz2) = 6704112506aa9b8a7b28fa68094a2931 +SIZE (exim/exiscan-acl-4.32-18.patch.bz2) = 72288 diff --git a/mail/exim/files/patch-mbx_lock b/mail/exim/files/patch-mbx_lock new file mode 100644 index 000000000000..72d5886212a2 --- /dev/null +++ b/mail/exim/files/patch-mbx_lock @@ -0,0 +1,67 @@ +# +# Race condition in MBX locking +# http://www.exim.org/pipermail/exim-users/Week-of-Mon-20040419/070394.html +# +--- src/exim_lock.c 2004-04-15 09:27:01.000000000 +0100 ++++ src/exim_lock.c 2004-04-22 15:34:29.000000000 +0100 +@@ -308,7 +308,7 @@ + for (j = 0; j < lock_retries; j++) + { + int sleep_before_retry = TRUE; +- struct stat statbuf; ++ struct stat statbuf, ostatbuf; + + /* Try to build a lock file if so configured */ + +@@ -395,7 +395,7 @@ + if (use_fcntl) + printf("exim_lock: fcntl() read lock successfully applied\n"); + if (use_flock) +- printf("exim_lock: fcntl() read lock successfully applied\n"); ++ printf("exim_lock: flock() read lock successfully applied\n"); + } + } + else goto RETRY; /* Message already output */ +@@ -451,7 +451,16 @@ + printf("exim_lock: flock() lock successfully applied to mbx " + "lock file %s\n", tempname); + } +- break; ++ ++ if (lstat(tempname, &statbuf) || fstat(md, &ostatbuf) || ++ (statbuf.st_dev != ostatbuf.st_dev) || ++ (statbuf.st_ino != ostatbuf.st_ino)) ++ { ++ if (!quiet) printf("exim_lock: mbx lock file %s changed between " ++ "creation and locking\n", tempname); ++ goto RETRY; ++ } ++ else break; + } + else goto RETRY; /* Message already output */ + } +--- src/transports/appendfile.c 2004-04-15 09:27:01.000000000 +0100 ++++ src/transports/appendfile.c 2004-04-22 15:46:41.000000000 +0100 +@@ -1971,7 +1971,20 @@ + + if (apply_lock(mbx_lockfd, F_WRLCK, ob->use_fcntl, + ob->lock_fcntl_timeout, ob->use_flock, ob->lock_flock_timeout) >= 0) +- break; ++ { ++ struct stat ostatbuf; ++ if (lstat(mbx_lockname, &statbuf) || ++ fstat(mbx_lockfd, &ostatbuf) || ++ (statbuf.st_dev != ostatbuf.st_dev) || ++ (statbuf.st_ino != ostatbuf.st_ino)) ++ { ++ DEBUG(D_transport) debug_printf("MBX lockfile %s changed " ++ "between creation and locking\n", mbx_lockname); ++ close(mbx_lockfd); ++ mbx_lockfd = -1; ++ } ++ else break; ++ } + + DEBUG(D_transport) debug_printf("failed to lock %s: %s\n", mbx_lockname, + strerror(errno)); + diff --git a/mail/exim/files/patch-src::EDITME b/mail/exim/files/patch-src::EDITME index f7180f425d8c..31792a8495e1 100644 --- a/mail/exim/files/patch-src::EDITME +++ b/mail/exim/files/patch-src::EDITME @@ -62,7 +62,7 @@ # local OS-specific make files. -EXIM_MONITOR=eximon.bin -+#EXIM_MONITOR=eximon.bin ++# EXIM_MONITOR=eximon.bin diff --git a/mail/exim/files/patch-src::verify.c b/mail/exim/files/patch-src::verify.c new file mode 100644 index 000000000000..848c864442c1 --- /dev/null +++ b/mail/exim/files/patch-src::verify.c @@ -0,0 +1,68 @@ +# +# A rewrite-influenced bug was introduced in 4.31. +# http://www.exim.org/pipermail/exim-users/Week-of-Mon-20040419/070387.html +# +*** src/verify.c Thu Apr 15 09:27:01 2004 +--- verify.c Wed Apr 21 16:28:18 2004 +*************** +*** 758,764 **** + address_item *addr_succeed = NULL; + uschar *ko_prefix, *cr; + uschar *address = vaddr->address; +! uschar *save_sender = sender_address; + uschar null_sender[] = { 0 }; /* Ensure writeable memory */ + + /* Set up a prefix and suffix for error message which allow us to use the same +--- 758,764 ---- + address_item *addr_succeed = NULL; + uschar *ko_prefix, *cr; + uschar *address = vaddr->address; +! uschar *save_sender; + uschar null_sender[] = { 0 }; /* Ensure writeable memory */ + + /* Set up a prefix and suffix for error message which allow us to use the same +*************** +*** 816,825 **** + + /* If the address was rewritten to <> no verification can be done, and we have + to return OK. This rewriting is permitted only for sender addresses; for other +! addresses, such rewriting faile. */ + + if (address[0] == 0) return OK; + + /* Update the address structure with the possibly qualified and rewritten + address. Set it up as the starting address on the chain of new addresses. */ + +--- 816,830 ---- + + /* If the address was rewritten to <> no verification can be done, and we have + to return OK. This rewriting is permitted only for sender addresses; for other +! addresses, such rewriting fails. */ + + if (address[0] == 0) return OK; + ++ /* Save a copy of the sender address for re-instating if we change it to <> ++ while verifying a sender address (a nice bit of self-reference there). */ ++ ++ save_sender = sender_address; ++ + /* Update the address structure with the possibly qualified and rewritten + address. Set it up as the starting address on the chain of new addresses. */ + +*************** +*** 898,904 **** + if (!is_recipient) sender_address = null_sender; + rc = route_address(addr, &addr_local, &addr_remote, &addr_new, + &addr_succeed, verify_type); +! sender_address = save_sender; + } + + /* If routing an address succeeded, set the flag that remembers, for use when +--- 903,909 ---- + if (!is_recipient) sender_address = null_sender; + rc = route_address(addr, &addr_local, &addr_remote, &addr_new, + &addr_succeed, verify_type); +! sender_address = save_sender; /* Put back the real sender */ + } + + /* If routing an address succeeded, set the flag that remembers, for use when diff --git a/mail/exim/files/wishlist-iplsearch.patch b/mail/exim/files/wishlist-iplsearch.patch new file mode 100644 index 000000000000..72083ae22250 --- /dev/null +++ b/mail/exim/files/wishlist-iplsearch.patch @@ -0,0 +1,395 @@ +# +# Wishlist #254 (2) iplsearch +# http://www.exim.org/pipermail/exim-users/Week-of-Mon-20040419/070420.html +# +diff -uNr src/drtables.c exim-4.32.with-iplsearch/src/drtables.c +--- src/drtables.c 2004-04-15 10:27:01.000000000 +0200 ++++ exim-4.32.with-iplsearch/src/drtables.c 2004-04-23 16:16:53.000000000 +0200 +@@ -212,6 +212,23 @@ + #endif + }, + ++/* Linear search of single file with ip-addresses and networks */ ++ ++ { ++ US"iplsearch", /* lookup name */ ++ lookup_absfile, /* uses absolute file name */ ++#ifdef LOOKUP_LSEARCH ++ lsearch_open, /* open function */ ++ lsearch_check, /* check function */ ++ iplsearch_find, /* find function */ ++ lsearch_close, /* close function */ ++ NULL, /* no tidy function */ ++ NULL /* no quoting function */ ++#else ++ NULL, NULL, NULL, NULL, NULL, NULL /* lookup not present */ ++#endif ++ }, ++ + /* LDAP lookup, allowing data from only one entry to be returned */ + + { +diff -uNr src/exim.c exim-4.32.with-iplsearch/src/exim.c +--- src/exim.c 2004-04-15 10:27:01.000000000 +0200 ++++ exim-4.32.with-iplsearch/src/exim.c 2004-04-23 16:17:14.000000000 +0200 +@@ -814,7 +814,7 @@ + + fprintf(f, "Lookups:"); + #ifdef LOOKUP_LSEARCH +- fprintf(f, " lsearch wildlsearch nwildlsearch"); ++ fprintf(f, " lsearch wildlsearch nwildlsearch iplsearch"); + #endif + #ifdef LOOKUP_CDB + fprintf(f, " cdb"); +diff -uNr src/functions.h exim-4.32.with-iplsearch/src/functions.h +--- src/functions.h 2004-04-15 10:27:01.000000000 +0200 ++++ exim-4.32.with-iplsearch/src/functions.h 2004-04-23 16:01:44.000000000 +0200 +@@ -104,6 +104,7 @@ + extern int host_find_bydns(host_item *, uschar *, int, uschar *, BOOL, BOOL, + uschar **, BOOL *); + extern ip_address_item *host_find_interfaces(void); ++extern BOOL host_is_in_net(uschar *, uschar *); + extern void host_mask(int, int *, int); + extern int host_name_lookup(void); + extern int host_nmtoa(int, int *, int, uschar *); +diff -uNr src/host.c exim-4.32.with-iplsearch/src/host.c +--- src/host.c 2004-04-15 10:27:01.000000000 +0200 ++++ exim-4.32.with-iplsearch/src/host.c 2004-04-23 16:29:34.000000000 +0200 +@@ -2689,7 +2689,84 @@ + return yield; + } + ++/*********************************** ++* host_is_in_net * ++***********************************/ ++ ++/* Checks an host to be part of a network. ++ ++Arguments: ++ host The string representation of the ip-address to check ++ net The string representation of the network, with optional ++ cidr-mask ++ ++Returns: ++ TRUE if the host is inside the network ++ FALSE if the host is NOT inside the network ++*/ + ++BOOL ++host_is_in_net(uschar *host, uschar *net) ++{ ++int maskoffset; ++int i; ++int address[4]; ++int incoming[4]; ++int mlen; ++int size = host_aton(net, address); ++int insize; ++ ++if (!string_is_ip_address(net, &maskoffset)) return FALSE; ++ ++/* No mask => all bits to be checked */ ++ ++if (maskoffset == 0) mlen = 99999; /* Big number */ ++else ++ { ++ mlen = Uatoi(net + maskoffset + 1); ++ net[maskoffset] = '/'; /* restore the slash */ ++ } ++ ++/* Convert the incoming address to binary. */ ++ ++insize = host_aton(host, incoming); ++ ++/* Convert IPv4 addresses given in IPv6 compatible mode, which represent ++ connections from IPv4 hosts to IPv6 hosts, that is, addresses of the form ++ ::ffff:<v4address>, to IPv4 format. */ ++ ++if (insize == 4 && incoming[0] == 0 && incoming[1] == 0 && ++ incoming[2] == 0xffff) ++ { ++ insize = 1; ++ incoming[0] = incoming[3]; ++ } ++ ++/* No match if the sizes don't agree. */ ++ ++if (insize != size) return FALSE; ++ ++/* Else do the masked comparison. */ ++ ++for (i = 0; i < size; i++) ++ { ++ int mask; ++ if (mlen == 0) mask = 0; ++ else if (mlen < 32) ++ { ++ mask = (-1) << (32 - mlen); ++ mlen = 0; ++ } ++ else ++ { ++ mask = -1; ++ mlen -= 32; ++ } ++ if ((incoming[i] & mask) != (address[i] & mask)) return FALSE; ++ } ++return TRUE; ++ ++} + + + /************************************************* +diff -uNr src/lookups/lsearch.c exim-4.32.with-iplsearch/src/lookups/lsearch.c +--- src/lookups/lsearch.c 2004-04-15 10:27:01.000000000 +0200 ++++ exim-4.32.with-iplsearch/src/lookups/lsearch.c 2004-04-23 16:31:20.000000000 +0200 +@@ -9,7 +9,12 @@ + #include "lf_functions.h" + #include "lsearch.h" + +- ++enum { ++ LSEARCH_PLAIN, ++ LSEARCH_WILD, ++ LSEARCH_NWILD, ++ LSEARCH_IP ++}; + + /************************************************* + * Open entry point * +@@ -61,7 +66,7 @@ + + static int + internal_lsearch_find(void *handle, uschar *filename, uschar *keystring, +- int length, uschar **result, uschar **errmsg, BOOL wild, BOOL expand) ++ int length, uschar **result, uschar **errmsg, int type) + { + FILE *f = (FILE *)handle; + BOOL last_was_eol = TRUE; +@@ -136,34 +141,53 @@ + linekeylength = s - buffer; + } + +- /* A wild lsearch treats each key as a possible wildcarded string. */ +- +- if (wild) +- { +- int rc; +- int save = buffer[linekeylength]; +- uschar *list = buffer; +- buffer[linekeylength] = 0; +- rc = match_isinlist(keystring, +- &list, +- UCHAR_MAX+(expand? 1:2), /* Single-item list, possibly expanded */ +- NULL, /* No anchor */ +- NULL, /* No caching */ +- MCL_STRING, +- TRUE, /* Caseless */ +- NULL); +- buffer[linekeylength] = save; + +- if (rc == FAIL) continue; +- if (rc == DEFER) return DEFER; +- } +- +- /* A non-wild lsearch treats each key as a litersl */ +- +- else ++ switch(type) + { ++ /* A non-wild lsearch treats each key as a literal */ ++ case LSEARCH_PLAIN: + if (linekeylength != length || strncmpic(buffer, keystring, length) != 0) + continue; ++ break; ++ ++ /* A wild lsearch treats each key as a possible wildcarded string. */ ++ case LSEARCH_WILD: ++ /* Like wildlsearch, but without expanding the key */ ++ case LSEARCH_NWILD: ++ { ++ int rc; ++ int save = buffer[linekeylength]; ++ uschar *list = buffer; ++ buffer[linekeylength] = 0; ++ rc = match_isinlist(keystring, ++ &list, ++ /* Single-item list, possibly expanded */ ++ UCHAR_MAX+(type == LSEARCH_WILD? 1:2), ++ NULL, /* No anchor */ ++ NULL, /* No caching */ ++ MCL_STRING, ++ TRUE, /* Caseless */ ++ NULL); ++ buffer[linekeylength] = save; ++ ++ if (rc == FAIL) continue; ++ if (rc == DEFER) return DEFER; ++ }; ++ break; ++ /* Compare an ip address against a list of network/ip addresses */ ++ case LSEARCH_IP: ++ /* Allow * as search-key */ ++ if (!(length == 1 && linekeylength == 1 && ++ buffer[0] == '*' && keystring[0] == '*')) ++ { ++ /* This was no wildcard, so try to match key and buffer */ ++ int save = buffer[linekeylength]; ++ buffer[linekeylength] = 0; ++ if (!host_is_in_net(keystring, buffer)) ++ continue; ++ buffer[linekeylength] = save; ++ } ++ break; + } + + /* The key has matched. Skip spaces after the key, and allow an optional +@@ -245,7 +269,7 @@ + uschar **result, uschar **errmsg) + { + return internal_lsearch_find(handle, filename, keystring, length, result, +- errmsg, FALSE, FALSE); ++ errmsg, LSEARCH_PLAIN); + } + + +@@ -261,7 +285,7 @@ + uschar **result, uschar **errmsg) + { + return internal_lsearch_find(handle, filename, keystring, length, result, +- errmsg, TRUE, TRUE); ++ errmsg, LSEARCH_WILD); + } + + +@@ -277,7 +301,31 @@ + uschar **result, uschar **errmsg) + { + return internal_lsearch_find(handle, filename, keystring, length, result, +- errmsg, TRUE, FALSE); ++ errmsg, LSEARCH_NWILD); ++} ++ ++ ++/************************************************* ++* Find entry point for iplsearch * ++*************************************************/ ++ ++/* See local README for interface description */ ++ ++int ++iplsearch_find(void *handle, uschar *filename, uschar *keystring, int length, ++ uschar **result, uschar **errmsg) ++{ ++if (string_is_ip_address(keystring, NULL) ++ || (length == 1 && keystring[0] == '*')) ++ { ++ return internal_lsearch_find(handle, filename, keystring, length, result, ++ errmsg, LSEARCH_IP); ++ } ++ else ++ { ++ *errmsg = string_sprintf("\"%s\" is not a valid iplsearch key", keystring); ++ return DEFER; ++ }; + } + + +diff -uNr src/lookups/lsearch.h exim-4.32.with-iplsearch/src/lookups/lsearch.h +--- src/lookups/lsearch.h 2004-04-15 10:27:01.000000000 +0200 ++++ exim-4.32.with-iplsearch/src/lookups/lsearch.h 2004-04-23 12:24:32.000000000 +0200 +@@ -15,4 +15,6 @@ + extern int wildlsearch_find(void *, uschar *, uschar *, int, uschar **, uschar **); + extern int nwildlsearch_find(void *, uschar *, uschar *, int, uschar **, uschar **); + ++extern int iplsearch_find(void *, uschar *, uschar *, int, uschar **, uschar **); ++ + /* End of lookups/lsearch.h */ +diff -uNr src/verify.c exim-4.32.with-iplsearch/src/verify.c +--- src/verify.c 2004-04-15 10:27:01.000000000 +0200 ++++ exim-4.32.with-iplsearch/src/verify.c 2004-04-25 16:09:11.000000000 +0200 +@@ -1683,10 +1683,10 @@ + check_host(void *arg, uschar *ss, uschar **valueptr, uschar **error) + { + check_host_block *cb = (check_host_block *)arg; +-int maskoffset; + BOOL isquery = FALSE; + uschar *semicolon, *t; + uschar **aliases; ++int maskoffset; + + /* Optimize for the special case when the pattern is "*". */ + +@@ -1714,69 +1714,11 @@ + } + } + +-/* If the pattern is an IP address, optionally followed by a bitmask count, +-mask it and the current IP address, and do a binary comparison on them. +-The function string_is_ip_address(), when given a non-NULL second argument, +-puts the offset of a '/' in there and clobbers the '/' to a zero. */ ++/* If the pattern is an IP address, use host_is_in_net for checking. */ + + if (string_is_ip_address(ss, &maskoffset)) +- { +- int i; +- int address[4]; +- int incoming[4]; +- int mlen; +- int size = host_aton(ss, address); +- int insize; +- +- /* No mask => all bits to be checked */ +- +- if (maskoffset == 0) mlen = 99999; /* Big number */ +- else +- { +- mlen = Uatoi(ss + maskoffset + 1); +- ss[maskoffset] = '/'; /* restore the slash */ +- } +- +- /* Convert the incoming address to binary. */ +- +- insize = host_aton(cb->host_address, incoming); +- +- /* Convert IPv4 addresses given in IPv6 compatible mode, which represent +- connections from IPv4 hosts to IPv6 hosts, that is, addresses of the form +- ::ffff:<v4address>, to IPv4 format. */ +- +- if (insize == 4 && incoming[0] == 0 && incoming[1] == 0 && +- incoming[2] == 0xffff) +- { +- insize = 1; +- incoming[0] = incoming[3]; +- } +- +- /* No match if the sizes don't agree. */ +- +- if (insize != size) return FAIL; +- +- /* Else do the masked comparison. */ +- +- for (i = 0; i < size; i++) +- { +- int mask; +- if (mlen == 0) mask = 0; +- else if (mlen < 32) +- { +- mask = (-1) << (32 - mlen); +- mlen = 0; +- } +- else +- { +- mask = -1; +- mlen -= 32; +- } +- if ((incoming[i] & mask) != (address[i] & mask)) return FAIL; +- } +- return OK; +- } +- ++ return (host_is_in_net(cb->host_address, ss) ? OK : FAIL); ++ + /* If the item is of the form net[n]-lookup;<file|query> then it is a lookup on + a masked IP network, in textual form. The net- stuff really only applies to + single-key lookups where the key is implicit. For query-style lookups the key diff --git a/mail/exim/pkg-plist b/mail/exim/pkg-plist index b4b89a06007f..65ec208f715f 100644 --- a/mail/exim/pkg-plist +++ b/mail/exim/pkg-plist @@ -16,6 +16,8 @@ sbin/exipick sbin/exiqgrep sbin/exiqsumm sbin/exiwhat +%%EXIMON%%sbin/eximon +%%EXIMON%%sbin/eximon.bin %%PORTDOCS%%%%DOCSDIR%%/ACKNOWLEDGMENTS %%PORTDOCS%%%%DOCSDIR%%/NOTICE %%PORTDOCS%%%%DOCSDIR%%/README.UPDATING |