aboutsummaryrefslogtreecommitdiffstats
path: root/src/message.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2010-07-27 20:02:20 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2010-07-27 20:02:20 +0400
commitf216d5a0fb7e1d50467182c04d72ecfd347d483f (patch)
tree7617adcdf2ee864816e270ce7d4086e9a3df24bd /src/message.c
parent0928c484b2052d4ea1a6bcb7573301fbf7f94f72 (diff)
downloadrspamd-f216d5a0fb7e1d50467182c04d72ecfd347d483f.tar.gz
rspamd-f216d5a0fb7e1d50467182c04d72ecfd347d483f.zip
* Try to save images hashes to fuzzy storage to stop some annoying spammers
Diffstat (limited to 'src/message.c')
-rw-r--r--src/message.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/message.c b/src/message.c
index be39bbb84..f819d4daf 100644
--- a/src/message.c
+++ b/src/message.c
@@ -708,6 +708,14 @@ mime_foreach_callback (GMimeObject * part, gpointer user_data)
mime_part->type = type;
mime_part->content = part_content;
mime_part->parent = task->parser_parent_part;
+ /* Extract checksums for some types */
+ if (g_ascii_strcasecmp (type->type, "image") == 0) {
+ mime_part->checksum = g_compute_checksum_for_data (G_CHECKSUM_MD5, part_content->data, part_content->len);
+ memory_pool_add_destructor (task->task_pool, (pool_destruct_func)g_free, mime_part->checksum);
+ }
+ else {
+ mime_part->checksum = NULL;
+ }
debug_task ("found part with content-type: %s/%s", type->type, type->subtype);
task->parts = g_list_prepend (task->parts, mime_part);
/* Skip empty parts */