]> source.dussan.org Git - rspamd.git/commitdiff
[Feature] Support adding and deletion of recipients in the milter block
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 23 Aug 2018 10:21:14 +0000 (11:21 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 23 Aug 2018 10:21:14 +0000 (11:21 +0100)
src/libserver/milter.c

index b44856028544edac2b5d9837c1e01c90f904b5f7..29c13d30a1eeca039cb5a6d5b352aff9902ec34b 100644 (file)
@@ -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) {