Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Mar 2018 20:59:45 +0000 (UTC)
From:      Mahdi Mokhtari <mmokhi@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r463669 - in head/mail/rspamd: . files
Message-ID:  <201803052059.w25Kxjdl094875@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 <pj@netzkommune.de>
  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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201803052059.w25Kxjdl094875>