]> source.dussan.org Git - rspamd.git/commitdiff
Do not learn with legacy data.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 22 Dec 2014 17:09:38 +0000 (17:09 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 22 Dec 2014 17:09:38 +0000 (17:09 +0000)
src/plugins/fuzzy_check.c

index bc49a9b163ec854f35d95bc2ab3993e1bbacbd1e..0c83783999bd726110a1a3bd53588e6533b007d2 100644 (file)
@@ -982,10 +982,12 @@ fuzzy_generate_commands (struct rspamd_task *task, struct fuzzy_rule *rule,
                /*
                 * Try legacy first
                 */
-               cmd = fuzzy_cmd_from_text_part (rule, c, flag, value, task->task_pool,
-                               part, TRUE, NULL);
-               if (cmd) {
-                       g_ptr_array_add (res, cmd);
+               if (c == FUZZY_CHECK) {
+                       cmd = fuzzy_cmd_from_text_part (rule, c, flag, value, task->task_pool,
+                                       part, TRUE, NULL);
+                       if (cmd) {
+                               g_ptr_array_add (res, cmd);
+                       }
                }
                cmd = fuzzy_cmd_from_text_part (rule, c, flag, value, task->task_pool,
                                part, FALSE, NULL);
@@ -1004,12 +1006,14 @@ fuzzy_generate_commands (struct rspamd_task *task, struct fuzzy_rule *rule,
                                fuzzy_module_ctx->min_height) {
                                if (fuzzy_module_ctx->min_width <= 0 || image->width >=
                                        fuzzy_module_ctx->min_width) {
-                                       cmd = fuzzy_cmd_from_data_part (rule, c, flag, value,
-                                                       task->task_pool,
-                                                       image->data->data, image->data->len,
-                                                       TRUE, NULL);
-                                       if (cmd) {
-                                               g_ptr_array_add (res, cmd);
+                                       if (c == FUZZY_CHECK) {
+                                               cmd = fuzzy_cmd_from_data_part (rule, c, flag, value,
+                                                               task->task_pool,
+                                                               image->data->data, image->data->len,
+                                                               TRUE, NULL);
+                                               if (cmd) {
+                                                       g_ptr_array_add (res, cmd);
+                                               }
                                        }
                                        cmd = fuzzy_cmd_from_data_part (rule, c, flag, value,
                                                        task->task_pool,
@@ -1031,12 +1035,14 @@ fuzzy_generate_commands (struct rspamd_task *task, struct fuzzy_rule *rule,
                        fuzzy_check_content_type (rule, mime_part->type)) {
                        if (fuzzy_module_ctx->min_bytes <= 0 || mime_part->content->len >=
                                fuzzy_module_ctx->min_bytes) {
-                               cmd = fuzzy_cmd_from_data_part (rule, c, flag, value,
-                                               task->task_pool,
-                                               mime_part->content->data, mime_part->content->len,
-                                               TRUE, NULL);
-                               if (cmd) {
-                                       g_ptr_array_add (res, cmd);
+                               if (c == FUZZY_CHECK) {
+                                       cmd = fuzzy_cmd_from_data_part (rule, c, flag, value,
+                                                       task->task_pool,
+                                                       mime_part->content->data, mime_part->content->len,
+                                                       TRUE, NULL);
+                                       if (cmd) {
+                                               g_ptr_array_add (res, cmd);
+                                       }
                                }
                                cmd = fuzzy_cmd_from_data_part (rule, c, flag, value,
                                                task->task_pool,