diff options
author | Eray Aslan <eras@gentoo.org> | 2011-11-29 21:52:06 +0000 |
---|---|---|
committer | Eray Aslan <eras@gentoo.org> | 2011-11-29 21:52:06 +0000 |
commit | 921c9c9b2258cb2abb2c602152c1c24d24ee7aed (patch) | |
tree | ccd1b89f5da553a4df53839d47aa2aa77dcdde7a /mail-filter | |
parent | Another crash fix, bug 389991 (diff) | |
download | gentoo-2-921c9c9b2258cb2abb2c602152c1c24d24ee7aed.tar.gz gentoo-2-921c9c9b2258cb2abb2c602152c1c24d24ee7aed.tar.bz2 gentoo-2-921c9c9b2258cb2abb2c602152c1c24d24ee7aed.zip |
Version bump. Create piddir if necessary in init script and remove bashism. Remove unused patch files.
(Portage version: 2.1.10.39/cvs/Linux x86_64)
Diffstat (limited to 'mail-filter')
-rw-r--r-- | mail-filter/spamass-milter/ChangeLog | 10 | ||||
-rw-r--r-- | mail-filter/spamass-milter/files/spamass-milter-popen.patch | 233 | ||||
-rw-r--r-- | mail-filter/spamass-milter/files/spamass-milter.conf2 | 11 | ||||
-rwxr-xr-x | mail-filter/spamass-milter/files/spamass-milter.rc2 | 27 | ||||
-rw-r--r-- | mail-filter/spamass-milter/files/spamass-milter.rc4 | 55 | ||||
-rw-r--r-- | mail-filter/spamass-milter/spamass-milter-0.3.2.ebuild | 46 |
6 files changed, 110 insertions, 272 deletions
diff --git a/mail-filter/spamass-milter/ChangeLog b/mail-filter/spamass-milter/ChangeLog index 06fe8f35b3d8..281d4a5faca9 100644 --- a/mail-filter/spamass-milter/ChangeLog +++ b/mail-filter/spamass-milter/ChangeLog @@ -1,6 +1,14 @@ # ChangeLog for mail-filter/spamass-milter # Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/mail-filter/spamass-milter/ChangeLog,v 1.29 2011/11/23 10:32:35 eras Exp $ +# $Header: /var/cvsroot/gentoo-x86/mail-filter/spamass-milter/ChangeLog,v 1.30 2011/11/29 21:52:06 eras Exp $ + +*spamass-milter-0.3.2 (29 Nov 2011) + + 29 Nov 2011; Eray Aslan <eras@gentoo.org> +spamass-milter-0.3.2.ebuild, + +files/spamass-milter.rc4, -files/spamass-milter.conf2, + -files/spamass-milter.rc2, -files/spamass-milter-popen.patch: + Version bump. Create piddir if necessary in init script and remove bashism. + Remove unused patch files. 23 Nov 2011; Eray Aslan <eras@gentoo.org> -spamass-milter-0.3.1-r4.ebuild: remove old diff --git a/mail-filter/spamass-milter/files/spamass-milter-popen.patch b/mail-filter/spamass-milter/files/spamass-milter-popen.patch deleted file mode 100644 index 3a7279cc2bda..000000000000 --- a/mail-filter/spamass-milter/files/spamass-milter-popen.patch +++ /dev/null @@ -1,233 +0,0 @@ -See bug #310049 - -Index: spamass-milter.cpp -=================================================================== -RCS file: /cvsroot/spamass-milt/spamass-milt/spamass-milter.cpp,v -retrieving revision 1.91 -diff -u -r1.91 spamass-milter.cpp ---- spamass-milter.cpp 24 Jul 2006 19:59:17 -0000 1.91 -+++ spamass-milter.cpp 10 Mar 2010 18:52:22 -0000 -@@ -171,10 +171,6 @@ - bool flag_expand = false; /* alias/virtusertable expansion */ - bool warnedmacro = false; /* have we logged that we couldn't fetch a macro? */ - --#if defined(__FreeBSD__) /* popen bug - see PR bin/50770 */ --static pthread_mutex_t popen_mutex = PTHREAD_MUTEX_INITIALIZER; --#endif -- - // {{{ main() - - int -@@ -461,59 +457,24 @@ - send another copy. The milter API will not let you send the - message AND return a failure code to the sender, so this is - the only way to do it. */ --#if defined(__FreeBSD__) -- int rv; --#endif -- --#if defined(HAVE_ASPRINTF) -- char *buf; --#else -- char buf[1024]; --#endif -- char *fmt="%s \"%s\""; -+ char *popen_argv[3]; - FILE *p; - --#if defined(HAVE_ASPRINTF) -- asprintf(&buf, fmt, SENDMAIL, spambucket); --#else --#if defined(HAVE_SNPRINTF) -- snprintf(buf, sizeof(buf)-1, fmt, SENDMAIL, spambucket); --#else -- /* XXX possible buffer overflow here */ -- sprintf(buf, fmt, SENDMAIL, spambucket); --#endif --#endif -- -- debug(D_COPY, "calling %s", buf); --#if defined(__FreeBSD__) /* popen bug - see PR bin/50770 */ -- rv = pthread_mutex_lock(&popen_mutex); -- if (rv) -- { -- debug(D_ALWAYS, "Could not lock popen mutex: %s", strerror(rv)); -- abort(); -- } --#endif -- p = popen(buf, "w"); -+ popen_argv[0] = SENDMAIL; -+ popen_argv[1] = spambucket; -+ popen_argv[2] = NULL; -+ -+ debug(D_COPY, "calling %s %s", SENDMAIL, spambucket); -+ p = popenv(popen_argv, "w"); - if (!p) - { -- debug(D_COPY, "popen failed(%s). Will not send a copy to spambucket", strerror(errno)); -+ debug(D_COPY, "popenv failed(%s). Will not send a copy to spambucket", strerror(errno)); - } else - { - // Send message provided by SpamAssassin - fwrite(assassin->d().c_str(), assassin->d().size(), 1, p); -- pclose(p); p = NULL; -+ fclose(p); p = NULL; - } --#if defined(__FreeBSD__) -- rv = pthread_mutex_unlock(&popen_mutex); -- if (rv) -- { -- debug(D_ALWAYS, "Could not unlock popen mutex: %s", strerror(rv)); -- abort(); -- } --#endif --#if defined(HAVE_ASPRINTF) -- free(buf); --#endif - } - return SMFIS_REJECT; - } -@@ -842,30 +803,19 @@ - /* open a pipe to sendmail so we can do address expansion */ - - char buf[1024]; -- char *fmt="%s -bv \"%s\" 2>&1"; -- --#if defined(HAVE_SNPRINTF) -- snprintf(buf, sizeof(buf)-1, fmt, SENDMAIL, envrcpt[0]); --#else -- /* XXX possible buffer overflow here */ -- sprintf(buf, fmt, SENDMAIL, envrcpt[0]); --#endif -+ char *popen_argv[4]; -+ -+ popen_argv[0] = SENDMAIL; -+ popen_argv[1] = "-bv"; -+ popen_argv[2] = envrcpt[0]; -+ popen_argv[3] = NULL; - -- debug(D_RCPT, "calling %s", buf); -+ debug(D_RCPT, "calling %s -bv %s", SENDMAIL, envrcpt[0]); - --#if defined(__FreeBSD__) /* popen bug - see PR bin/50770 */ -- rv = pthread_mutex_lock(&popen_mutex); -- if (rv) -- { -- debug(D_ALWAYS, "Could not lock popen mutex: %s", strerror(rv)); -- abort(); -- } --#endif -- -- p = popen(buf, "r"); -+ p = popenv(popen_argv, "r"); - if (!p) - { -- debug(D_RCPT, "popen failed(%s). Will not expand aliases", strerror(errno)); -+ debug(D_RCPT, "popenv failed(%s). Will not expand aliases", strerror(errno)); - assassin->expandedrcpt.push_back(envrcpt[0]); - } else - { -@@ -890,16 +840,8 @@ - assassin->expandedrcpt.push_back(p+7); - } - } -- pclose(p); p = NULL; -+ fclose(p); p = NULL; - } --#if defined(__FreeBSD__) -- rv = pthread_mutex_unlock(&popen_mutex); -- if (rv) -- { -- debug(D_ALWAYS, "Could not unlock popen mutex: %s", strerror(rv)); -- abort(); -- } --#endif - } else - { - assassin->expandedrcpt.push_back(envrcpt[0]); -@@ -2157,5 +2099,71 @@ - warnedmacro = true; - } - -+/* -+ untrusted-argument-safe popen function - only supports "r" and "w" modes -+ for simplicity, and always reads stdout and stderr in "r" mode. Call -+ fclose to close the FILE. -+*/ -+FILE *popenv(char *const argv[], const char *type) -+{ -+ FILE *iop; -+ int pdes[2]; -+ int save_errno; -+ if ((*type != 'r' && *type != 'w') || type[1]) -+ { -+ errno = EINVAL; -+ return (NULL); -+ } -+ if (pipe(pdes) < 0) -+ return (NULL); -+ switch (fork()) { -+ -+ case -1: /* Error. */ -+ save_errno = errno; -+ (void)close(pdes[0]); -+ (void)close(pdes[1]); -+ errno = save_errno; -+ return (NULL); -+ /* NOTREACHED */ -+ case 0: /* Child. */ -+ if (*type == 'r') { -+ /* -+ * The dup2() to STDIN_FILENO is repeated to avoid -+ * writing to pdes[1], which might corrupt the -+ * parent's copy. This isn't good enough in -+ * general, since the exit() is no return, so -+ * the compiler is free to corrupt all the local -+ * variables. -+ */ -+ (void)close(pdes[0]); -+ (void)dup2(pdes[1], STDOUT_FILENO); -+ (void)dup2(pdes[1], STDERR_FILENO); -+ if (pdes[1] != STDOUT_FILENO && pdes[1] != STDERR_FILENO) { -+ (void)close(pdes[1]); -+ } -+ } else { -+ if (pdes[0] != STDIN_FILENO) { -+ (void)dup2(pdes[0], STDIN_FILENO); -+ (void)close(pdes[0]); -+ } -+ (void)close(pdes[1]); -+ } -+ execv(argv[0], argv); -+ exit(127); -+ /* NOTREACHED */ -+ } -+ -+ /* Parent; assume fdopen can't fail. */ -+ if (*type == 'r') { -+ iop = fdopen(pdes[0], type); -+ (void)close(pdes[1]); -+ } else { -+ iop = fdopen(pdes[1], type); -+ (void)close(pdes[0]); -+ } -+ -+ return (iop); -+} -+ - // }}} - // vim6:ai:noexpandtab -Index: spamass-milter.h -=================================================================== -RCS file: /cvsroot/spamass-milt/spamass-milt/spamass-milter.h,v -retrieving revision 1.23 -diff -u -r1.23 spamass-milter.h ---- spamass-milter.h 7 Apr 2005 02:04:24 -0000 1.23 -+++ spamass-milter.h 10 Mar 2010 18:52:22 -0000 -@@ -186,5 +186,6 @@ - void parse_debuglevel(char* string); - char *strlwr(char *str); - void warnmacro(char *macro, char *scope); -+FILE *popenv(char *const argv[], const char *type); - - #endif diff --git a/mail-filter/spamass-milter/files/spamass-milter.conf2 b/mail-filter/spamass-milter/files/spamass-milter.conf2 deleted file mode 100644 index 66728f100b83..000000000000 --- a/mail-filter/spamass-milter/files/spamass-milter.conf2 +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright 1999-2006 Gentoo Technologies, Inc. -# Distributed under the terms of the GNU General Public License, v2 or later -# $Header: /var/cvsroot/gentoo-x86/mail-filter/spamass-milter/files/spamass-milter.conf2,v 1.1 2006/05/29 18:06:30 gustavoz Exp $ - -DAEMON=/usr/sbin/spamass-milter -SOCKET=/var/run/milter/spamass-milter.sock -PIDFILE=/var/run/milter/spamass-milter.pid -USER="milter" - -# Example: reject mails above score 20 -#OPTIONS="-r 20" diff --git a/mail-filter/spamass-milter/files/spamass-milter.rc2 b/mail-filter/spamass-milter/files/spamass-milter.rc2 deleted file mode 100755 index 089b0d1f68b5..000000000000 --- a/mail-filter/spamass-milter/files/spamass-milter.rc2 +++ /dev/null @@ -1,27 +0,0 @@ -#!/sbin/runscript -# Copyright 1999-2006 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/mail-filter/spamass-milter/files/spamass-milter.rc2,v 1.1 2006/05/29 18:06:30 gustavoz Exp $ - -depend() { - need net spamd - use logger - before sendmail -} - -start() { - ebegin "Starting spamass-milter" - start-stop-daemon --start --quiet --pidfile ${PIDFILE} -c ${USER} \ - --exec ${DAEMON} -- -P ${PIDFILE} -p ${SOCKET} -f ${OPTIONS} - eend $? "Failed to start ${DAEMON}" -} - -stop() { - ebegin "Stopping spamass-milter" - start-stop-daemon --stop --quiet --pidfile ${PIDFILE} && - { - sleep 5 - rm -f ${SOCKET} - } - eend $? "Failed to stop ${DAEMON}" -} diff --git a/mail-filter/spamass-milter/files/spamass-milter.rc4 b/mail-filter/spamass-milter/files/spamass-milter.rc4 new file mode 100644 index 000000000000..d1a938b724b5 --- /dev/null +++ b/mail-filter/spamass-milter/files/spamass-milter.rc4 @@ -0,0 +1,55 @@ +#!/sbin/runscript +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/mail-filter/spamass-milter/files/spamass-milter.rc4,v 1.1 2011/11/29 21:52:06 eras Exp $ + +depend() { + need net spamd + use logger + before mta +} + +piddir=${PIDFILE%/*} +socketdir=${SOCKET%/*} + +checkconfig() { + if [ ! -d ${piddir:=/var/run/milter} ]; then + checkpath -q -d -o milter:milter -m 0755 ${piddir} || return 1 + fi + if [ ! -d ${socketdir:=/var/run/milter} ]; then + checkpath -q -d -o ${SOCKET_USER:-milter}:${SOCKET_GROUP:-milter} \ + -m 0755 ${socketdir} || return 1 + fi +} + +start() { + checkconfig || return 1 + ebegin "Starting spamass-milter" + start-stop-daemon --start --quiet --pidfile ${PIDFILE} -u ${SOCKET_USER:-milter}:${SOCKET_GROUP:-milter} \ + --exec ${DAEMON} -- -P ${PIDFILE} -p ${SOCKET} -f ${OPTIONS} + eend $? "Failed to start ${DAEMON}" + spamass_timeout=0 + while [ $spamass_timeout -le 20 ] + do + if [ ! -S "${SOCKET}" -o ! -r "${SOCKET}" ] + then + sleep 1 + spamass_timeout=$(( $spamass_timeout+1 )) + else + break + fi + done + echo $spamass_timeout + chown ${SOCKET_USER:-milter}:${SOCKET_GROUP:-milter} ${SOCKET} 1>/dev/null 2>&1 + chmod ${SOCKET_MODE:-664} ${SOCKET} 1>/dev/null 2>&1 +} + +stop() { + ebegin "Stopping spamass-milter" + start-stop-daemon --stop --quiet --pidfile ${PIDFILE} && + { + sleep 5 + rm -f ${SOCKET} + } + eend $? "Failed to stop ${DAEMON}" +} diff --git a/mail-filter/spamass-milter/spamass-milter-0.3.2.ebuild b/mail-filter/spamass-milter/spamass-milter-0.3.2.ebuild new file mode 100644 index 000000000000..315a1a962102 --- /dev/null +++ b/mail-filter/spamass-milter/spamass-milter-0.3.2.ebuild @@ -0,0 +1,46 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/mail-filter/spamass-milter/spamass-milter-0.3.2.ebuild,v 1.1 2011/11/29 21:52:06 eras Exp $ + +EAPI=4 + +inherit eutils + +IUSE="" + +DESCRIPTION="A milter for SpamAssassin" +HOMEPAGE="http://savannah.nongnu.org/projects/spamass-milt/" +SRC_URI="http://savannah.nongnu.org/download/spamass-milt/${P}.tar.bz2" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~ppc ~x86" + +DEPEND="|| ( mail-filter/libmilter mail-mta/sendmail ) + >=mail-filter/spamassassin-3.1.0" +RDEPEND="${DEPEND}" + +pkg_setup() { + enewgroup milter + enewuser milter -1 -1 /var/lib/milter milter +} + +src_prepare() { + epatch "${FILESDIR}"/${PN}-auth_users.patch +} + +src_install() { + emake DESTDIR="${D}" install + + newinitd "${FILESDIR}"/spamass-milter.rc4 spamass-milter + newconfd "${FILESDIR}"/spamass-milter.conf3 spamass-milter + dodir /var/lib/milter + keepdir /var/lib/milter + fowners milter:milter /var/lib/milter + + dodoc AUTHORS NEWS README ChangeLog "${FILESDIR}/README.gentoo" +} + +pkg_postinst() { + elog "Documentation is installed in /usr/share/doc/${P}" +} |