From: Vsevolod Stakhov Date: Mon, 2 Dec 2013 12:58:08 +0000 (+0000) Subject: Small improvements to fuzzy_check controller module. X-Git-Tag: 0.6.1~5 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4dfeea0304c2f43f2fccddfa53889085dfebc964;p=rspamd.git Small improvements to fuzzy_check controller module. --- diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c index cf1cf9c38..b79ecc452 100644 --- a/src/plugins/fuzzy_check.c +++ b/src/plugins/fuzzy_check.c @@ -907,7 +907,8 @@ fuzzy_process_handler (struct controller_session *session, f_str_t * in) while (cur) { part = cur->data; - if (part->is_empty || part->fuzzy == NULL || part->fuzzy->hash_pipe[0] == '\0') { + if (part->is_empty || part->fuzzy == NULL || part->fuzzy->hash_pipe[0] == '\0' || + (fuzzy_module_ctx->min_bytes > 0 && part->content->len < fuzzy_module_ctx->min_bytes)) { /* Skip empty parts */ cur = g_list_next (cur); continue; @@ -967,11 +968,11 @@ fuzzy_process_handler (struct controller_session *session, f_str_t * in) else { r = rspamd_snprintf (out_buf, sizeof (out_buf), "cannot write fuzzy hash" CRLF "END" CRLF); } + g_free (checksum); + free_task (task, FALSE); if (! rspamd_dispatcher_write (session->dispatcher, out_buf, r, FALSE, FALSE)) { return; } - g_free (checksum); - free_task (task, FALSE); rspamd_dispatcher_restore (session->dispatcher); return; } @@ -1003,11 +1004,11 @@ fuzzy_process_handler (struct controller_session *session, f_str_t * in) else { r = rspamd_snprintf (out_buf, sizeof (out_buf), "cannot write fuzzy hash" CRLF "END" CRLF); } + g_free (checksum); + free_task (task, FALSE); if (! rspamd_dispatcher_write (session->dispatcher, out_buf, r, FALSE, FALSE)) { return; } - g_free (checksum); - free_task (task, FALSE); rspamd_dispatcher_restore (session->dispatcher); return; }