aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/fuzzy_check.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-12-16 17:57:16 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-12-16 17:57:16 +0000
commitc0728b83b8b9a2470e0b4f11d69b41bbd33bfc86 (patch)
treec7a3546a1b4c5dbbe0c3de079f30ca09a49c920d /src/plugins/fuzzy_check.c
parentda7970857f420b4598e62f424e99f6d87a0035a3 (diff)
downloadrspamd-c0728b83b8b9a2470e0b4f11d69b41bbd33bfc86.tar.gz
rspamd-c0728b83b8b9a2470e0b4f11d69b41bbd33bfc86.zip
[Rework|Minor] Fix fuzzy check plugin
Diffstat (limited to 'src/plugins/fuzzy_check.c')
-rw-r--r--src/plugins/fuzzy_check.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c
index 0c270f9db..b33f1eb13 100644
--- a/src/plugins/fuzzy_check.c
+++ b/src/plugins/fuzzy_check.c
@@ -286,7 +286,7 @@ parse_fuzzy_headers (const gchar *str)
}
static gboolean
-fuzzy_check_content_type (struct fuzzy_rule *rule, GMimeContentType *type)
+fuzzy_check_content_type (struct fuzzy_rule *rule, struct rspamd_content_type *ct)
{
struct fuzzy_mime_type *ft;
GList *cur;
@@ -296,9 +296,10 @@ fuzzy_check_content_type (struct fuzzy_rule *rule, GMimeContentType *type)
ft = cur->data;
if (ft->type) {
- if (g_pattern_match_string (ft->type, type->type)) {
+ if (g_pattern_match (ft->type, ct->type.len, ct->type.begin, NULL)) {
if (ft->subtype) {
- if (g_pattern_match_string (ft->subtype, type->subtype)) {
+ if (g_pattern_match (ft->subtype, ct->subtype.len,
+ ct->subtype.begin, NULL)) {
return TRUE;
}
}
@@ -2234,7 +2235,7 @@ fuzzy_generate_commands (struct rspamd_task *task, struct fuzzy_rule *rule,
mime_part = g_ptr_array_index (task->parts, i);
if (mime_part->flags & RSPAMD_MIME_PART_IMAGE) {
- image = mime_part->specific_data;
+ image = mime_part->specific.img;
if (image->data->len > 0) {
if (fuzzy_module_ctx->min_height <= 0 || image->height >=
@@ -2261,9 +2262,9 @@ fuzzy_generate_commands (struct rspamd_task *task, struct fuzzy_rule *rule,
}
}
- if (mime_part->content->len > 0 &&
- fuzzy_check_content_type (rule, mime_part->type)) {
- if (fuzzy_module_ctx->min_bytes <= 0 || mime_part->content->len >=
+ if (mime_part->parsed_data.len > 0 &&
+ fuzzy_check_content_type (rule, mime_part->ct)) {
+ if (fuzzy_module_ctx->min_bytes <= 0 || mime_part->parsed_data.len >=
fuzzy_module_ctx->min_bytes) {
io = fuzzy_cmd_from_data_part (rule, c, flag, value,
task->task_pool,