commit c992064: [Project] Rework images detection

Vsevolod Stakhov vsevolod at highsecure.ru
Tue Sep 24 15:07:06 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-09-24 15:49:16 +0100
URL: https://github.com/rspamd/rspamd/commit/c992064bb2341a021ba5d000e0825d95420ec3b3

[Project] Rework images detection

---
 src/libmime/images.c  | 7 +++----
 src/libmime/message.c | 3 ++-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/libmime/images.c b/src/libmime/images.c
index 073776359..faa7a6b2e 100644
--- a/src/libmime/images.c
+++ b/src/libmime/images.c
@@ -50,14 +50,13 @@ rspamd_images_process (struct rspamd_task *task)
 {
 	guint i;
 	struct rspamd_mime_part *part;
-	rspamd_ftok_t srch;
-
-	RSPAMD_FTOK_ASSIGN (&srch, "image");
 
 	PTR_ARRAY_FOREACH (MESSAGE_FIELD (task, parts), i, part) {
 		if (!(part->flags & (RSPAMD_MIME_PART_TEXT|RSPAMD_MIME_PART_ARCHIVE))) {
-			if (rspamd_ftok_cmp (&part->ct->type, &srch) == 0 &&
+			if (part->detected_type &&
+				strcmp (part->detected_type, "image") == 0 &&
 				part->parsed_data.len > 0) {
+
 				process_image (task, part);
 			}
 		}
diff --git a/src/libmime/message.c b/src/libmime/message.c
index cb95945fe..ef725e72c 100644
--- a/src/libmime/message.c
+++ b/src/libmime/message.c
@@ -1368,7 +1368,6 @@ rspamd_message_process (struct rspamd_task *task)
 		L = task->cfg->lua_state;
 	}
 
-	rspamd_images_process (task);
 	rspamd_archives_process (task);
 
 	if (L && rspamd_lua_require_function (L,
@@ -1570,7 +1569,9 @@ rspamd_message_process (struct rspamd_task *task)
 		}
 	}
 
+	rspamd_images_process (task);
 	rspamd_images_link (task);
+
 	rspamd_tokenize_meta_words (task);
 }
 


More information about the Commits mailing list