]> source.dussan.org Git - rspamd.git/commitdiff
Fix initialization issues for some variables.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 22 Dec 2014 16:55:37 +0000 (16:55 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 22 Dec 2014 16:55:37 +0000 (16:55 +0000)
src/fuzzy_storage.c
src/libmime/message.c
src/plugins/fuzzy_check.c

index 8c32b423adc7e6822abb5ed3f97f58258482b905..3e7d13db5885a08d77f260d2887d896fecf98c4c 100644 (file)
@@ -295,6 +295,7 @@ accept_fuzzy_socket (gint fd, short what, void *arg)
                }
                else if ((guint)r >= sizeof (struct rspamd_fuzzy_cmd)) {
                        /* Check shingles count sanity */
+                       session.legacy = FALSE;
                        cmd = (struct rspamd_fuzzy_cmd *)buf;
                        if (!rspamd_fuzzy_command_valid (cmd, r)) {
                                /* Bad input */
index f465b1c06f3832703ebc629e069c8b642ace14cd..8ce3e720fd1bd8988c77bc1f83c79de292654737 100644 (file)
@@ -1130,6 +1130,8 @@ process_text_part (struct rspamd_task *task,
        buf.begin = text_part->content->data;
        buf.len = text_part->content->len;
        buf.size = buf.len;
+       token.begin = NULL;
+       token.len = 0;
 
        text_part->words = g_array_new (FALSE, FALSE, sizeof (rspamd_fstring_t));
        while ((pos = rspamd_tokenizer_get_word (&buf,
index e807bec68aa8069f57de7de45fecff61fac22209..d84b69ee6ba3bab6113de2dc0282ff2510dd6fdf 100644 (file)
@@ -553,7 +553,7 @@ fuzzy_cmd_from_text_part (struct fuzzy_rule *rule,
        blake2b_state st;
        rspamd_fstring_t *word;
 
-       if (legacy || part->words == NULL) {
+       if (legacy || part->words == NULL || part->words->len == 0) {
                cmd = rspamd_mempool_alloc0 (pool, sizeof (*cmd));
 
                cmd->shingles_count = 0;
@@ -809,12 +809,7 @@ fuzzy_io_callback (gint fd, short what, void *arg)
        }
        else {
                rspamd_upstream_ok (session->server);
-               if (session->commands->len == 0) {
-                       /*
-                        * All requests are processed now
-                        */
-                       remove_normal_event (session->task->s, fuzzy_io_fin, session);
-               }
+               remove_normal_event (session->task->s, fuzzy_io_fin, session);
        }
 }
 
@@ -916,12 +911,10 @@ fuzzy_learn_callback (gint fd, short what, void *arg)
                rspamd_upstream_ok (session->server);
        }
 
-       if (ret == -1 || session->commands->len == 0) {
-               (*session->saved) --;
-               rspamd_http_connection_unref (session->http_entry->conn);
-               event_del (&session->ev);
-               close (session->fd);
-       }
+       (*session->saved) --;
+       rspamd_http_connection_unref (session->http_entry->conn);
+       event_del (&session->ev);
+       close (session->fd);
 
        if (*session->saved == 0) {
                if (*(session->err) != NULL) {