From 58c62615afaba65f9bf7183243ae5691c76fbdb6 Mon Sep 17 00:00:00 2001 From: Trevor Johnson Date: Sat, 4 Oct 2003 16:03:17 +0000 Subject: new port of the milter-regex plugin for sendmail Obtained from: the OpenBSD port by Daniel Hartmeier (author of milter-regex) --- mail/milter-regex/Makefile | 40 ++++++++++++++++++++++ mail/milter-regex/distinfo | 1 + mail/milter-regex/files/patch-milter-regex.c | 32 ++++++++++++++++++ mail/milter-regex/pkg-descr | 17 ++++++++++ mail/milter-regex/pkg-install | 50 ++++++++++++++++++++++++++++ 5 files changed, 140 insertions(+) create mode 100644 mail/milter-regex/Makefile create mode 100644 mail/milter-regex/distinfo create mode 100644 mail/milter-regex/files/patch-milter-regex.c create mode 100644 mail/milter-regex/pkg-descr create mode 100644 mail/milter-regex/pkg-install (limited to 'mail/milter-regex') diff --git a/mail/milter-regex/Makefile b/mail/milter-regex/Makefile new file mode 100644 index 000000000000..8fb1a1e6fa60 --- /dev/null +++ b/mail/milter-regex/Makefile @@ -0,0 +1,40 @@ +# New ports collection makefile for: milter-regex +# Date created: 2003-10-03 +# Whom: trevor +# +# based on the OpenBSD port by Daniel Hartmeier (dhartmei on OpenBSD.org) +# $FreeBSD$ +# + +PORTNAME= milter_regex +PORTVERSION= 0.5 +CATEGORIES= mail +MASTER_SITES= http://www.benzedrine.cx/ +DISTNAME= milter-regex-${PORTVERSION} + +MAINTAINER= trevor@FreeBSD.org +COMMENT= "Milter plugin to sendmail for regular expression filtering" + +MAN8= milter-regex.8 +PLIST= ${WRKDIR}/pkg-plist +USE_PERL5= yes + +pre-everything:: +.if !exists(/usr/lib/libmilter.a) + ${ECHO_CMD} "Fatal: milter required, see instructions in DESCR" + exit 1 +.endif + +post-patch: + ${MV} ${WRKSRC}/Makefile ${WRKSRC}/Makefile.orig + ${SED} -E "s:-I/usr/src/gnu/usr.sbin/sendmail/include:${PTHREAD_CFLAGS}:g;s:-lpthread:${PTHREAD_LIBS}:g" < ${WRKSRC}/Makefile.orig > ${WRKSRC}/Makefile + +pre-install: + ${ECHO_CMD} libexec/milter-regex > ${PLIST} + +do-install: + ${INSTALL_PROGRAM} ${WRKSRC}/milter-regex ${PREFIX}/libexec + ${INSTALL_MAN} ${WRKSRC}/milter-regex.8 ${PREFIX}/man/man8 + @${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL + +.include diff --git a/mail/milter-regex/distinfo b/mail/milter-regex/distinfo new file mode 100644 index 000000000000..0662876cc3e0 --- /dev/null +++ b/mail/milter-regex/distinfo @@ -0,0 +1 @@ +MD5 (milter-regex-0.5.tar.gz) = 58a53f79d2d09dfd0a9f895103f780af diff --git a/mail/milter-regex/files/patch-milter-regex.c b/mail/milter-regex/files/patch-milter-regex.c new file mode 100644 index 000000000000..dbb2106e0e8c --- /dev/null +++ b/mail/milter-regex/files/patch-milter-regex.c @@ -0,0 +1,32 @@ +$FreeBSD$ + +We lack OpenBSD's re-entrant logging functions. + +--- milter-regex.c.orig Sat Sep 27 16:58:48 2003 ++++ milter-regex.c Fri Oct 3 23:11:00 2003 +@@ -54,7 +54,6 @@ + static const char *rule_file_name = "/etc/milter-regex.conf"; + static struct ruleset ruleset; + static int debug = 0; +-static struct syslog_data sdata = SYSLOG_DATA_INIT; + + static sfsistat cb_connect(SMFICTX *ctx, char *name, _SOCK_ADDR *sa); + static sfsistat cb_helo(SMFICTX *ctx, char *arg); +@@ -378,7 +377,7 @@ + if (vasprintf(&msg, fmt, ap) != -1) { + if (debug) + printf("%s\n", msg); +- syslog_r(priority, &sdata, "%s", msg); ++ syslog(priority, "%s", msg); + free(msg); + } + va_end(ap); +@@ -411,7 +413,7 @@ + sfsistat r = MI_FAILURE; + + tzset(); +- openlog_r("milter-regex", LOG_PID | LOG_NDELAY, LOG_DAEMON, &sdata); ++ openlog("milter-regex", LOG_PID | LOG_NDELAY, LOG_DAEMON); + + while ((ch = getopt(argc, argv, "dc:p:")) != -1) { + switch (ch) { diff --git a/mail/milter-regex/pkg-descr b/mail/milter-regex/pkg-descr new file mode 100644 index 000000000000..d6255e3dcb92 --- /dev/null +++ b/mail/milter-regex/pkg-descr @@ -0,0 +1,17 @@ +from the OpenBSD port: + + milter-regex is a sendmail milter plugin that allows to reject mail + based on regular expressions matching SMTP envelope parameters and + mail headers and body. + + In order to build milter-regex, sendmail needs to be compiled with + milter support, installing the libmilter library. + +This is the default for the sendmail in the base system. Some of the sendmail +ports omit libmilter by default. + +This port is in an experimental, untested state on FreeBSD. Please tell the +maintainer, trevor@FreeBSD.org, about your results, whether successful or +unsuccessful. + +WWW: http://www.benzedrine.cx/milter-regex.html diff --git a/mail/milter-regex/pkg-install b/mail/milter-regex/pkg-install new file mode 100644 index 000000000000..a5f814c7edbc --- /dev/null +++ b/mail/milter-regex/pkg-install @@ -0,0 +1,50 @@ +#! /bin/sh +# $OpenBSD$ +# +# Pre/post-installation setup of milter-regex + +set -e +PATH=/bin:/usr/bin:/sbin:/usr/sbin +PREFIX=${PKG_PREFIX:-/usr/local} + +do_notice() +{ + echo + echo "+---------------" + echo "| milter-regex has been installed as $PREFIX/libexec/milter-regex." + echo "| See milter-regex(8) for instructions on how to register the plugin." + echo "|" + echo "| To start the plugin automatically on startup, one can use:" + echo "|" + echo "| /etc/rc.conf.local" + echo "| milter_regex=YES" + echo "|" + echo "| /etc/rc.local" + echo "| if [ X\"\${milter_regex}\" == X\"YES\" -a \\" + echo "| -x $PREFIX/libexec/milter-regex ]; then" + echo "| echo -n ' milter-regex'" + echo "| $PREFIX/libexec/milter-regex" + echo "| fi" + echo "|" + echo "+---------------" + echo +} + +if [ $# -ne 2 ]; then + echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2 + exit 1 +fi + +case $2 in + PRE-INSTALL) + ;; + POST-INSTALL) + do_notice + ;; + *) + echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2 + exit 1 + ;; +esac + +exit 0 -- cgit v1.2.3