]> source.dussan.org Git - rspamd.git/commitdiff
Small improvements to fuzzy_check controller module.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 2 Dec 2013 12:58:08 +0000 (12:58 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 2 Dec 2013 12:58:08 +0000 (12:58 +0000)
src/plugins/fuzzy_check.c

index cf1cf9c385b476be69950874dd4e4b2e4c1e6dac..b79ecc452d625f8d7e3bd1407bed80221a3ce6d0 100644 (file)
@@ -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;
                                                }