From: Vsevolod Stakhov Date: Sat, 12 Nov 2016 13:27:25 +0000 (+0000) Subject: [Feature] Support multiple hashes in delhash path X-Git-Tag: 1.4.0~82 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c967577fbd835bc1db05907aa754acdd56a4f6aa;p=thirdparty%2Frspamd.git [Feature] Support multiple hashes in delhash path --- diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c index f1e5b0602e..803958b81a 100644 --- a/src/plugins/fuzzy_check.c +++ b/src/plugins/fuzzy_check.c @@ -2429,26 +2429,33 @@ fuzzy_process_handler (struct rspamd_http_connection_entry *conn_ent, res = 0; if (is_hash) { + GPtrArray *args; const rspamd_ftok_t *arg; + guint i; - arg = rspamd_http_message_find_header (msg, "Hash"); + args = rspamd_http_message_find_header_multiple (msg, "Hash"); - if (arg) { + if (args) { struct fuzzy_cmd_io *io; + commands = g_ptr_array_sized_new (args->len); - io = fuzzy_cmd_hash (rule, cmd, arg, flag, value, - task->task_pool); + for (i = 0; i < args->len; i ++) { + arg = g_ptr_array_index (args, i); + io = fuzzy_cmd_hash (rule, cmd, arg, flag, value, + task->task_pool); - if (io) { - commands = g_ptr_array_sized_new (1); - g_ptr_array_add (commands, io); - res = register_fuzzy_controller_call (conn_ent, - rule, - task, - commands, - saved, - err); + if (io) { + g_ptr_array_add (commands, io); + } } + + res = register_fuzzy_controller_call (conn_ent, + rule, + task, + commands, + saved, + err); + g_ptr_array_free (args, TRUE); } else { rspamd_controller_send_error (conn_ent, 400,