From: cebka@lenovo-laptop Date: Fri, 5 Feb 2010 15:51:16 +0000 (+0300) Subject: * Handle empty messages in learning X-Git-Tag: 0.3.0~89 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=10c8ad2246130d77b19ee7036e3f0a74c47425a1;p=thirdparty%2Frspamd.git * Handle empty messages in learning --- diff --git a/src/controller.c b/src/controller.c index 4e4b44cb34..d76c35db33 100644 --- a/src/controller.c +++ b/src/controller.c @@ -686,6 +686,17 @@ controller_read_socket (f_str_t * in, void *arg) cur = g_list_next (cur); } + /* Handle messages without text */ + if (tokens == NULL) { + i = snprintf (out_buf, sizeof (out_buf), "learn fail, no tokens can be extracted (no text data)" CRLF); + free_task (task, FALSE); + if (!rspamd_dispatcher_write (session->dispatcher, out_buf, i, FALSE, FALSE)) { + return FALSE; + } + session->state = STATE_REPLY; + return TRUE; + } + /* Get or create statfile */ statfile = get_statfile_by_symbol (session->worker->srv->statfile_pool, session->learn_classifier, session->learn_symbol, &st, TRUE);