commit 2349c38: add milter multiple signature support

John McKay adenosine3p at gmail.com
Mon Feb 4 14:35:21 UTC 2019


Author: John McKay
Date: 2019-02-02 11:24:17 +0000
URL: https://github.com/rspamd/rspamd/commit/2349c384e084848de73949f0f8628014913275a0

add milter multiple signature support

---
 src/libserver/milter.c | 31 +++++++++++++++++++++++++++----
 1 file changed, 27 insertions(+), 4 deletions(-)

diff --git a/src/libserver/milter.c b/src/libserver/milter.c
index 03aef8298..b3cd46226 100644
--- a/src/libserver/milter.c
+++ b/src/libserver/milter.c
@@ -1841,12 +1841,35 @@ rspamd_milter_send_task_results (struct rspamd_milter_session *session,
 
 	if (elt) {
 		hname = g_string_new (RSPAMD_MILTER_DKIM_HEADER);
-		hvalue = g_string_new (ucl_object_tostring (elt));
 
-		rspamd_milter_send_action (session, RSPAMD_MILTER_INSHEADER,
-				1, hname, hvalue);
+		if (ucl_object_type (elt) == UCL_STRING) {
+			hvalue = g_string_new (ucl_object_tostring (elt));
+
+			rspamd_milter_send_action (session, RSPAMD_MILTER_INSHEADER,
+					1, hname, hvalue);
+
+			g_string_free (hvalue, TRUE);
+		}
+		else {
+			ucl_object_iter_t it;
+			const ucl_object_t *cur;
+			int i = 1;
+
+			it = ucl_object_iterate_new (elt);
+
+			while ((cur = ucl_object_iterate_safe (it, true)) != NULL) {
+				hvalue = g_string_new (ucl_object_tostring (cur));
+
+				rspamd_milter_send_action (session, RSPAMD_MILTER_INSHEADER,
+						i++, hname, hvalue);
+
+				g_string_free (hvalue, TRUE);
+			}
+
+			ucl_object_iterate_free (it);
+		}
+
 		g_string_free (hname, TRUE);
-		g_string_free (hvalue, TRUE);
 	}
 
 	if (processed) {


More information about the Commits mailing list