From: Vsevolod Stakhov Date: Sun, 13 Dec 2015 23:03:29 +0000 (+0000) Subject: Report fuzzy errors X-Git-Tag: 1.1.0~318 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=762e33f17f86c2ffbaa0f52202c180c814250def;p=rspamd.git Report fuzzy errors --- diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c index 957dd4ea6..592b73b3f 100644 --- a/src/plugins/fuzzy_check.c +++ b/src/plugins/fuzzy_check.c @@ -1084,31 +1084,49 @@ fuzzy_check_io_callback (gint fd, short what, void *arg) symbol = map->symbol; } - if (rep->prob > 0.5) { - nval = fuzzy_normalize (rep->value, session->rule->max_score); - nval *= rep->prob; + if (rep->value == 0) { + if (rep->prob > 0.5) { + nval = fuzzy_normalize (rep->value, + session->rule->max_score); + nval *= rep->prob; + msg_info_task ( + "found fuzzy hash with weight: " + "%.2f, in list: %s:%d%s", + nval, + symbol, + rep->flag, + map == NULL ? "(unknown)" : ""); + if (map != NULL || !session->rule->skip_unknown) { + rspamd_snprintf (buf, + sizeof (buf), + "%d: %.2f / %.2f", + rep->flag, + rep->prob, + nval); + rspamd_task_insert_result_single (session->task, + symbol, + nval, + g_list_prepend (NULL, + rspamd_mempool_strdup ( + session->task->task_pool, + buf))); + } + } + } + else if (rep->value == 403) { msg_info_task ( - "<%s>, found fuzzy hash with weight: %.2f, in list: %s:%d%s", - session->task->message_id, - nval, + "fuzzy check error for %s(%d): forbidden", + symbol, + rep->flag); + } + else { + msg_info_task ( + "fuzzy check error for %s(%d): unknown error (%d)", symbol, rep->flag, - map == NULL ? "(unknown)" : ""); - if (map != NULL || !session->rule->skip_unknown) { - rspamd_snprintf (buf, - sizeof (buf), - "%d: %.2f / %.2f", - rep->flag, - rep->prob, - nval); - rspamd_task_insert_result_single (session->task, - symbol, - nval, - g_list_prepend (NULL, - rspamd_mempool_strdup ( - session->task->task_pool, buf))); - } + rep->value); } + ret = return_finished; } }