summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorcebka@lenovo-laptop <cebka@lenovo-laptop>2010-02-05 18:51:16 +0300
committercebka@lenovo-laptop <cebka@lenovo-laptop>2010-02-05 18:51:16 +0300
commit10c8ad2246130d77b19ee7036e3f0a74c47425a1 (patch)
tree2526a5a4f023a8f628cf3e31782edef8879a86b5 /src
parentf57b47be64858f088fc0406c05d8fed94f5f9477 (diff)
downloadrspamd-10c8ad2246130d77b19ee7036e3f0a74c47425a1.tar.gz
rspamd-10c8ad2246130d77b19ee7036e3f0a74c47425a1.zip
* Handle empty messages in learning
Diffstat (limited to 'src')
-rw-r--r--src/controller.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/controller.c b/src/controller.c
index 4e4b44cb3..d76c35db3 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);