From f4d26bd0a17cb6e8c6839f4b8cda65257911a93e Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Thu, 23 Aug 2018 11:21:14 +0100 Subject: [PATCH] [Feature] Support adding and deletion of recipients in the milter block --- src/libserver/milter.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/libserver/milter.c b/src/libserver/milter.c index b44856028..29c13d30a 100644 --- a/src/libserver/milter.c +++ b/src/libserver/milter.c @@ -1640,6 +1640,34 @@ rspamd_milter_process_milter_block (struct rspamd_milter_session *session, g_string_free (hvalue, TRUE); } + elt = ucl_object_lookup (obj, "add_rcpt"); + + if (elt && ucl_object_type (elt) == UCL_ARRAY) { + it = NULL; + + while ((cur = ucl_object_iterate (elt, &it, true)) != NULL) { + hvalue = g_string_new (ucl_object_tostring (cur)); + rspamd_milter_send_action (session, + RSPAMD_MILTER_ADDRCPT, + hvalue); + g_string_free (hvalue, TRUE); + } + } + + elt = ucl_object_lookup (obj, "del_rcpt"); + + if (elt && ucl_object_type (elt) == UCL_ARRAY) { + it = NULL; + + while ((cur = ucl_object_iterate (elt, &it, true)) != NULL) { + hvalue = g_string_new (ucl_object_tostring (cur)); + rspamd_milter_send_action (session, + RSPAMD_MILTER_DELRCPT, + hvalue); + g_string_free (hvalue, TRUE); + } + } + elt = ucl_object_lookup (obj, "reject"); if (elt && ucl_object_type (elt) == UCL_STRING) { -- 2.39.5