]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Feature] Use normalized images in fuzzy hashes
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 6 Dec 2016 18:07:40 +0000 (18:07 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 6 Dec 2016 18:07:40 +0000 (18:07 +0000)
src/plugins/fuzzy_check.c

index 507d224cccaef619f5c84a80ae972b6ebe8284ef..e3ccd814d9c0f42a7c9ed4892996f726d0054d42 100644 (file)
@@ -2128,6 +2128,22 @@ fuzzy_generate_commands (struct rspamd_task *task, struct fuzzy_rule *rule,
                                                if (io) {
                                                        g_ptr_array_add (res, io);
                                                }
+
+                                               if (image->normalized_data) {
+                                                       guchar norm_digest[rspamd_cryptobox_HASHBYTES];
+
+                                                       rspamd_cryptobox_hash (norm_digest,
+                                                                       image->normalized_data->data,
+                                                                       image->normalized_data->len * sizeof (gint),
+                                                                       NULL, 0);
+                                                       /* TODO: add shingles here */
+                                                       io = fuzzy_cmd_from_data_part (rule, c, flag, value,
+                                                                       task->task_pool,
+                                                                       norm_digest);
+                                                       if (io) {
+                                                               g_ptr_array_add (res, io);
+                                                       }
+                                               }
                                        }
                                }
                        }