From owner-svn-ports-all@freebsd.org Mon Feb 24 08:43:48 2020 Return-Path: Delivered-To: svn-ports-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 34A47255C46; Mon, 24 Feb 2020 08:43:48 +0000 (UTC) (envelope-from fluffy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48QwZr0Jfhz43wW; Mon, 24 Feb 2020 08:43:48 +0000 (UTC) (envelope-from fluffy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DDD9B22A26; Mon, 24 Feb 2020 08:43:47 +0000 (UTC) (envelope-from fluffy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01O8hlvV041655; Mon, 24 Feb 2020 08:43:47 GMT (envelope-from fluffy@FreeBSD.org) Received: (from fluffy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01O8hlhS041649; Mon, 24 Feb 2020 08:43:47 GMT (envelope-from fluffy@FreeBSD.org) Message-Id: <202002240843.01O8hlhS041649@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: fluffy set sender to fluffy@FreeBSD.org using -f From: Dima Panov Date: Mon, 24 Feb 2020 08:43:47 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r526957 - in head/mail/exim: . files X-SVN-Group: ports-head X-SVN-Commit-Author: fluffy X-SVN-Commit-Paths: in head/mail/exim: . files X-SVN-Commit-Revision: 526957 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Feb 2020 08:43:48 -0000 Author: fluffy Date: Mon Feb 24 08:43:46 2020 New Revision: 526957 URL: https://svnweb.freebsd.org/changeset/ports/526957 Log: mail/exim: update sa-exim plugin to 4.2.1 Unbreak build for exim-sa-exim slave port (${FILESDIR} misusage) Incorporate some patches from Debian: 1) api-limitations.patch: Exim now exports only the symbols that are part of the official API 2) remove-header-crs.patch: Delete carriage returns from header lines. When spamd gets a message with CRLF line endings, which it will when the spool file is in wire format, it will return a message with CRLF line endings, including the header. We will need to strip out the CRs. 3)spamc-args.patch: Changes related to the arguments sent to spamc, namely that we don't pass -d (SAspamcHost), -p (SAspamcPort), or -U (SAspamcSockPath) if those options aren't set, as well as the new parameter -u (SAspamcUser). 4)sprintf_no_format_string.diff: Do not invoke printf-like function without parameter. With exim 4.93, string_sprintf() requires at least two arguments PR: 244223 Submitted by: fluffy Approved by: maintainer, implicit Added: head/mail/exim/files/extra-patch-Local-sa-exim.conf (contents, props changed) Modified: head/mail/exim/Makefile head/mail/exim/distinfo head/mail/exim/files/extra-patch-Local-sa-exim.c Modified: head/mail/exim/Makefile ============================================================================== --- head/mail/exim/Makefile Mon Feb 24 08:32:04 2020 (r526956) +++ head/mail/exim/Makefile Mon Feb 24 08:43:46 2020 (r526957) @@ -97,11 +97,12 @@ IGNORE= you cannot enable DANE without DNSSEC support MASTER_SITES+= http://marc.merlins.org/linux/exim/files/:sa_exim \ SF/sa-exim/sa-exim/${SA_EXIM_VERSION}:sa_exim DISTFILES+= sa-exim-${SA_EXIM_VERSION}.tar.gz:sa_exim -EXTRA_PATCHES+= ${FILESDIR}/files/extra-patch-Local-sa-exim.c +EXTRA_PATCHES+= ${FILESDIR}/extra-patch-Local-sa-exim.c +EXTRA_PATCHES+= ${FILESDIR}/extra-patch-Local-sa-exim.conf .endif EXIM_VERSION= 4.93 -SA_EXIM_VERSION=4.2 +SA_EXIM_VERSION=4.2.1 EXIM_INSTALL_ARG+= "-no_chown" "-no_symlink" .if !defined(EXIMON_ONLY) @@ -553,6 +554,7 @@ post-extract: .if ${PORT_OPTIONS:MSA_EXIM} @cd ${WRKDIR} && ${TAR} ${EXTRACT_BEFORE_ARGS} ${_DISTDIR}/sa-exim-${SA_EXIM_VERSION}.tar.gz ${EXTRACT_AFTER_ARGS} @@${CP} ${WRKDIR}/sa-exim-${SA_EXIM_VERSION}/sa-exim.c ${WRKSRC}/Local + @@${CP} ${WRKDIR}/sa-exim-${SA_EXIM_VERSION}/sa-exim.conf ${WRKSRC}/Local .endif do-configure: @@ -580,7 +582,7 @@ do-configure: ${ECHO_CMD} "#define SPAMASSASSIN_CONF \"${PREFIX}/etc/exim/sa-exim.conf\""; \ } > ${WRKSRC}/Local/sa-exim.h @${REINPLACE_CMD} -e 's,/usr/bin/spamc,${LOCALBASE}/bin/spamc,' \ - ${WRKDIR}/sa-exim-${SA_EXIM_VERSION}/sa-exim.conf + ${WRKSRC}/Local/sa-exim.conf .endif @${REINPLACE_CMD} -E -e 's/XX_STRIPCMD_XX/${STRIP_CMD:S,/,\/,g}/' \ ${WRKSRC}/OS/Makefile-FreeBSD @@ -622,7 +624,7 @@ post-install: .endfor .endif .if ${PORT_OPTIONS:MSA_EXIM} - ${INSTALL_DATA} ${WRKDIR}/sa-exim-${SA_EXIM_VERSION}/sa-exim.conf \ + ${INSTALL_DATA} ${WRKSRC}/Local/sa-exim.conf \ ${STAGEDIR}${PREFIX}/etc/exim/sa-exim.conf.sample .endif Modified: head/mail/exim/distinfo ============================================================================== --- head/mail/exim/distinfo Mon Feb 24 08:32:04 2020 (r526956) +++ head/mail/exim/distinfo Mon Feb 24 08:43:46 2020 (r526957) @@ -1,5 +1,5 @@ -TIMESTAMP = 1581947251 +TIMESTAMP = 1582043253 SHA256 (exim/exim-4.93.tar.bz2) = 22c432c0585ef605c52bc796042c4823e961f58a7e6ad1486252e203bf4c9276 SIZE (exim/exim-4.93.tar.bz2) = 1972841 -SHA256 (exim/sa-exim-4.2.tar.gz) = 72e0a735547f18b05785e6c58a71d24623858f0f5234a5dc0e24cb453999e99a -SIZE (exim/sa-exim-4.2.tar.gz) = 66575 +SHA256 (exim/sa-exim-4.2.1.tar.gz) = 24d4bf7b0fdddaea11f132981cebb6a86a4ab20ef54111a8ebd481b421c6e2c1 +SIZE (exim/sa-exim-4.2.1.tar.gz) = 68933 Modified: head/mail/exim/files/extra-patch-Local-sa-exim.c ============================================================================== --- head/mail/exim/files/extra-patch-Local-sa-exim.c Mon Feb 24 08:32:04 2020 (r526956) +++ head/mail/exim/files/extra-patch-Local-sa-exim.c Mon Feb 24 08:43:46 2020 (r526957) @@ -1,11 +1,200 @@ ---- Local/sa-exim.c.orig 2020-02-18 20:02:59.741459000 +0100 -+++ Local/sa-exim.c 2020-02-18 20:03:42.394082000 +0100 -@@ -1218,7 +1218,7 @@ +--- Local/sa-exim.c.orig 2020-02-19 03:04:43 UTC ++++ Local/sa-exim.c +@@ -29,10 +29,7 @@ http://lists.merlins.org/lists/listinfo/sa-exim + #include "sa-exim.h" + + /* Exim includes */ +-#include "local_scan.h" +-extern FILE *smtp_out; /* Exim's incoming SMTP output file */ +-extern int body_linecount; /* Line count in body */ +-extern uschar *primary_hostname; ++#include + + #ifdef DLOPEN_LOCAL_SCAN + +@@ -409,6 +406,11 @@ int parsemlheader(char *buffer, FILE *readfh, char *he + if (buffer[strlen(buffer)-1] == '\n') + { + buffer[strlen(buffer)-1]=0; ++ /* and any carriage return */ ++ if (buffer[strlen(buffer)-1] == '\r') ++ { ++ buffer[strlen(buffer)-1]=0; ++ } } + if (SAEximDebug > 5) + { +@@ -515,6 +517,7 @@ int local_scan(volatile int fd, uschar **return_text) + int pid; + int writefd[2]; + int readfd[2]; ++ char *spamc_argv[10]; + int i; + /* These are the only values that we want working after the longjmp + * The automatic ones can be clobbered, but we don't really care */ +@@ -550,8 +553,9 @@ int local_scan(volatile int fd, uschar **return_text) + static char *SAspamcpath=SPAMC_LOCATION; + static char *SAsafemesgidchars=SAFEMESGIDCHARS + static char *SAspamcSockPath=NULL; +- static char *SAspamcPort="783"; +- static char *SAspamcHost="127.0.0.1"; ++ static char *SAspamcPort=NULL; ++ static char *SAspamcHost=NULL; ++ static char *SAspamcUser=NULL; + static char *SAEximRunCond="0"; + static char *SAEximRejCond="1"; + static int SAmaxbody=250*1024; +@@ -602,6 +606,10 @@ int local_scan(volatile int fd, uschar **return_text) + /* Do not put a %s in there, or you'll segfault */ + static char *SAmsgerror="Temporary local error while processing message, please contact postmaster"; ++ /* This needs to be retrieved through expand_string in order ++ not to violate the API. */ ++ uschar *primary_hostname=expand_string("$primary_hostname"); ++ + /* New values we read from spamassassin */ + char *xspamstatus=NULL; + char *xspamflag=NULL; +@@ -712,6 +720,7 @@ int local_scan(volatile int fd, uschar **return_text) + M_CHECKFORSTR(SAspamcSockPath); + M_CHECKFORSTR(SAspamcPort); + M_CHECKFORSTR(SAspamcHost); ++ M_CHECKFORSTR(SAspamcUser); + M_CHECKFORSTR(SAEximRunCond); + M_CHECKFORSTR(SAEximRejCond); + M_CHECKFORVAR(SAmaxbody, "%d"); +@@ -914,6 +923,22 @@ int local_scan(volatile int fd, uschar **return_text) + ret=dup2(readfd[1],2); + CHECKERR(ret,"dup2 stderr",__LINE__); + ++ i = 0; ++ spamc_argv[i++] = "spamc"; ++ if (SAspamcUser && SAspamcUser[0]) ++ { ++ expand=expand_string(SAspamcUser); ++ if (expand == NULL) ++ { ++ log_write(0, LOG_MAIN | LOG_PANIC, "SA: SAspamcUser expansion failure on %s, will run as Exim user instead.", SAspamcUser); ++ } ++ else if (expand[0] != '\0') ++ { ++ spamc_argv[i++] = "-u"; ++ spamc_argv[i++] = expand; ++ } ++ } ++ + /* + * I could implement the spamc protocol and talk to spamd directly + * instead of forking spamc, but considering the overhead spent +@@ -924,17 +949,30 @@ int local_scan(volatile int fd, uschar **return_text) + /* Ok, we cheat, spamc cares about how big the whole message is and + * we only know about the body size, so I'll give an extra 16K + * to account for any headers that can accompany the message */ ++ ++ spamc_argv[i++] = "-s"; ++ spamc_argv[i++] = string_sprintf("%d", SAmaxbody+16384); ++ + if(SAspamcSockPath) + { +- ret=execl(SAspamcpath, "spamc", "-s", string_sprintf("%d", SAmaxbody+16384), "-U", SAspamcSockPath, NULL); +- CHECKERR(ret,string_sprintf("exec %s", SAspamcpath),__LINE__); ++ spamc_argv[i++] = "-U"; ++ spamc_argv[i++] = SAspamcSockPath; + } + else + { +- ret=execl(SAspamcpath, "spamc", "-s", string_sprintf("%d", SAmaxbody+16384), "-d", SAspamcHost, "-p", SAspamcPort, NULL); +- CHECKERR(ret,string_sprintf("exec %s", SAspamcpath),__LINE__); ++ if (SAspamcHost) { ++ spamc_argv[i++] = "-d"; ++ spamc_argv[i++] = SAspamcHost; ++ } ++ if (SAspamcPort) { ++ spamc_argv[i++] = "-p"; ++ spamc_argv[i++] = SAspamcPort; ++ } + } +- ++ spamc_argv[i++] = NULL; ++ ++ ret=execv(SAspamcpath, spamc_argv); ++ CHECKERR(ret,string_sprintf("exec %s", SAspamcpath),__LINE__); + } + + if (SAEximDebug > 8) +@@ -1045,6 +1083,11 @@ int local_scan(volatile int fd, uschar **return_text) + if (buffer[strlen(buffer)-1] == '\n') + { + buffer[strlen(buffer)-1]=0; ++ /* and any carriage return */ ++ if (buffer[strlen(buffer)-1] == '\r') ++ { ++ buffer[strlen(buffer)-1]=0; ++ } + } + restart: + if (SAEximDebug > 5) +@@ -1218,7 +1261,7 @@ restart: + } + stret=write(fd, buffer, strlen(buffer)); - CHECKERR(stret,string_sprintf("SA body write to msg"),__LINE__); -+ CHECKERR(stret,"SA body write to msg",__LINE__); ++ CHECKERR(stret,string_sprintf("%s", "SA body write to msg"),__LINE__); if (SAEximDebug > 8) { log_write(0, LOG_MAIN, "SA: Debug9: Wrote to msg; line %d (wrote %d)", line, ret); +@@ -1229,18 +1272,20 @@ restart: + } + } + ++ + if (SAEximDebug > 1) + { + log_write(0, LOG_MAIN, "SA: Debug2: body_linecount before SA: %d", body_linecount); + } + + /* update global variable $body_linecount to reflect the new body size*/ +- body_linecount = (line - 1); ++ if (body_linecount > 0) body_linecount = (line - 1); // Not updating if zero, indicating spool_wireformat + + if (SAEximDebug > 1) + { + log_write(0, LOG_MAIN, "SA: Debug2: body_linecount after SA: %d", body_linecount); + } ++ + } + + fclose((FILE *)readfh); +@@ -1331,6 +1376,9 @@ restart: + + if (dorej && doteergrube) + { ++ char *teergrubewaitstr; ++ teergrubewaitstr=string_sprintf(SAmsgteergrubewait, spamstatus); ++ + /* By default, we'll only save temp bounces by message ID so + * that when the same message is submitted several times, we + * overwrite the same file on disk and not create a brand new +@@ -1353,20 +1401,8 @@ restart: + + for (i=0;i