]> source.dussan.org Git - rspamd.git/commitdiff
Fix fuzzy_add for messages without valid parts.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 9 Dec 2013 13:58:51 +0000 (13:58 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 9 Dec 2013 13:58:51 +0000 (13:58 +0000)
src/plugins/fuzzy_check.c

index 48414a82bc6d9153cf7ae22bbf16ed0a7f990a55..ba07acd2f37a0592bc80a4528cb6de701146aa29 100644 (file)
@@ -912,6 +912,7 @@ fuzzy_process_rule (struct controller_session *session, struct fuzzy_rule *rule,
        GList                           *cur;
        gchar                           *checksum;
        fuzzy_hash_t                    fake_fuzzy;
+       gboolean                        processed = FALSE;
 
        /* Plan new event for writing */
        cur = task->text_parts;
@@ -933,6 +934,7 @@ fuzzy_process_rule (struct controller_session *session, struct fuzzy_rule *rule,
                        /* Cannot write hash */
                        return FALSE;
                }
+               processed = TRUE;
                cur = g_list_next (cur);
        }
 
@@ -956,6 +958,7 @@ fuzzy_process_rule (struct controller_session *session, struct fuzzy_rule *rule,
 
                                        msg_info ("save hash of image: [%s] to list: %d", checksum, flag);
                                        g_free (checksum);
+                                       processed = TRUE;
                                }
                        }
                }
@@ -981,6 +984,7 @@ fuzzy_process_rule (struct controller_session *session, struct fuzzy_rule *rule,
                                                mime_part->type->type, mime_part->type->subtype,
                                                checksum, flag);
                                g_free (checksum);
+                               processed = TRUE;
                        }
                }
                cur = g_list_next (cur);
@@ -988,7 +992,7 @@ fuzzy_process_rule (struct controller_session *session, struct fuzzy_rule *rule,
 
        memory_pool_add_destructor (session->session_pool, (pool_destruct_func)free_task_soft, task);
 
-       return TRUE;
+       return processed;
 }
 
 static gboolean
@@ -1055,10 +1059,12 @@ fuzzy_process_handler (struct controller_session *session, f_str_t * in)
                        continue;
                }
 
-               processed = TRUE;
-
                res = fuzzy_process_rule (session, rule, task, err, cmd, flag, value, saved);
 
+               if (res) {
+                       processed = TRUE;
+               }
+
                cur = g_list_next (cur);
        }