From owner-svn-ports-head@freebsd.org Mon Mar 5 20:59:46 2018 Return-Path: Delivered-To: svn-ports-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EF83FF2964A; Mon, 5 Mar 2018 20:59:45 +0000 (UTC) (envelope-from mmokhi@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9B2BA6DD99; Mon, 5 Mar 2018 20:59:45 +0000 (UTC) (envelope-from mmokhi@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 96073FBE; Mon, 5 Mar 2018 20:59:45 +0000 (UTC) (envelope-from mmokhi@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w25KxjwZ094877; Mon, 5 Mar 2018 20:59:45 GMT (envelope-from mmokhi@FreeBSD.org) Received: (from mmokhi@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w25Kxjdl094875; Mon, 5 Mar 2018 20:59:45 GMT (envelope-from mmokhi@FreeBSD.org) Message-Id: <201803052059.w25Kxjdl094875@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmokhi set sender to mmokhi@FreeBSD.org using -f From: Mahdi Mokhtari Date: Mon, 5 Mar 2018 20:59:45 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r463669 - in head/mail/rspamd: . files X-SVN-Group: ports-head X-SVN-Commit-Author: mmokhi X-SVN-Commit-Paths: in head/mail/rspamd: . files X-SVN-Commit-Revision: 463669 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Mar 2018 20:59:46 -0000 Author: mmokhi Date: Mon Mar 5 20:59:45 2018 New Revision: 463669 URL: https://svnweb.freebsd.org/changeset/ports/463669 Log: mail/rspamd: Backport upstream patch for reject-message with FreeBSD libmilter There was a bug in upstream's (src/libserver/milter.c) compatibility with FreeBSD's libmilter (contrib/sendmail/libmilter/engine.c). The bug causes rspamd to send reject messages after set reply. Reported by: Philip Jocks Reviewed by: mat, vsevolod (maintainer) Approved by: vsevolod (maintainer) Sponsored by: Netzkommune GmbH Differential Revision: https://reviews.freebsd.org/D14542 Added: head/mail/rspamd/files/patch-src_libserver_milter.c (contents, props changed) Modified: head/mail/rspamd/Makefile Modified: head/mail/rspamd/Makefile ============================================================================== --- head/mail/rspamd/Makefile Mon Mar 5 20:54:53 2018 (r463668) +++ head/mail/rspamd/Makefile Mon Mar 5 20:59:45 2018 (r463669) @@ -2,6 +2,7 @@ PORTNAME= rspamd PORTVERSION= 1.6.6 +PORTREVISION= 1 CATEGORIES= mail MAINTAINER= vsevolod@FreeBSD.org Added: head/mail/rspamd/files/patch-src_libserver_milter.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/mail/rspamd/files/patch-src_libserver_milter.c Mon Mar 5 20:59:45 2018 (r463669) @@ -0,0 +1,113 @@ +--- src/libserver/milter.c.orig 2017-10-22 16:16:54 UTC ++++ src/libserver/milter.c +@@ -99,6 +99,8 @@ rspamd_milter_session_reset (struct rspa + guint i; + + if (how & RSPAMD_MILTER_RESET_IO) { ++ msg_debug_milter ("cleanup IO on abort"); ++ + DL_FOREACH_SAFE (priv->out_chain, obuf, obuf_tmp) { + rspamd_milter_obuf_free (obuf); + } +@@ -111,8 +113,11 @@ rspamd_milter_session_reset (struct rspa + } + + if (how & RSPAMD_MILTER_RESET_COMMON) { ++ msg_debug_milter ("cleanup common data on abort"); ++ + if (session->message) { + session->message->len = 0; ++ msg_debug_milter ("cleanup message on abort"); + } + + if (session->rcpts) { +@@ -120,30 +125,38 @@ rspamd_milter_session_reset (struct rspa + rspamd_email_address_unref (cur); + } + ++ msg_debug_milter ("cleanup %d recipients on abort", ++ (gint)session->rcpts->len); ++ + g_ptr_array_free (session->rcpts, TRUE); + session->rcpts = NULL; + } + + if (session->from) { ++ msg_debug_milter ("cleanup from"); + rspamd_email_address_unref (session->from); + session->from = NULL; + } + + if (session->helo) { ++ msg_debug_milter ("cleanup helo"); + session->helo->len = 0; + } + + if (session->hostname) { ++ msg_debug_milter ("cleanup hostname"); + session->hostname->len = 0; + } + + if (priv->headers) { ++ msg_debug_milter ("cleanup headers"); + g_hash_table_remove_all (priv->headers); + } + } + + if (how & RSPAMD_MILTER_RESET_ADDR) { + if (session->addr) { ++ msg_debug_milter ("cleanup addr"); + rspamd_inet_address_free (session->addr); + session->addr = NULL; + } +@@ -151,6 +164,7 @@ rspamd_milter_session_reset (struct rspa + + if (how & RSPAMD_MILTER_RESET_MACRO) { + if (session->macros) { ++ msg_debug_milter ("cleanup macros"); + g_hash_table_unref (session->macros); + session->macros = NULL; + } +@@ -1545,7 +1559,7 @@ rspamd_milter_send_task_results (struct + msg_err_milter ("cannot find scan results, tempfail"); + rspamd_milter_send_action (session, RSPAMD_MILTER_TEMPFAIL); + +- return; ++ goto cleanup; + } + + elt = ucl_object_lookup (results, "action"); +@@ -1554,7 +1568,7 @@ rspamd_milter_send_task_results (struct + msg_err_milter ("cannot find action in results, tempfail"); + rspamd_milter_send_action (session, RSPAMD_MILTER_TEMPFAIL); + +- return; ++ goto cleanup; + } + + rspamd_action_from_str (ucl_object_tostring (elt), &action); +@@ -1614,7 +1628,6 @@ rspamd_milter_send_task_results (struct + } + + rspamd_milter_set_reply (session, rcode, xcode, reply); +- rspamd_milter_send_action (session, RSPAMD_MILTER_REJECT); + } + break; + case METRIC_ACTION_SOFT_REJECT: +@@ -1629,7 +1642,6 @@ rspamd_milter_send_task_results (struct + } + + rspamd_milter_set_reply (session, rcode, xcode, reply); +- rspamd_milter_send_action (session, RSPAMD_MILTER_REJECT); + break; + + case METRIC_ACTION_REWRITE_SUBJECT: +@@ -1674,6 +1686,8 @@ cleanup: + rspamd_fstring_free (rcode); + rspamd_fstring_free (xcode); + rspamd_fstring_free (reply); ++ ++ rspamd_milter_session_reset (session, RSPAMD_MILTER_RESET_ABORT); + } + + void