diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-01-14 11:53:38 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-01-14 11:53:38 +0000 |
commit | e0fa8bf017a672d178f9024eeb46ce81eeaf188c (patch) | |
tree | a67e90b015668e59803ba6bb6fd7a1b43c9c24c6 | |
parent | 8803f26e7ad1fddcf0b964f6b88cbae6f3bdfa32 (diff) | |
download | rspamd-e0fa8bf017a672d178f9024eeb46ce81eeaf188c.tar.gz rspamd-e0fa8bf017a672d178f9024eeb46ce81eeaf188c.zip |
Allow configurations with no classifiers
-rw-r--r-- | src/libstat/stat_process.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/libstat/stat_process.c b/src/libstat/stat_process.c index 086b7e298..83621c973 100644 --- a/src/libstat/stat_process.c +++ b/src/libstat/stat_process.c @@ -347,6 +347,10 @@ rspamd_stat_classify (struct rspamd_task *task, lua_State *L, guint stage, st_ctx = rspamd_stat_get_ctx (); g_assert (st_ctx != NULL); + if (st_ctx->classifiers->len == 0) { + task->processed_stages |= stage; + return ret; + } if (stage == RSPAMD_TASK_STAGE_CLASSIFIERS_PRE) { /* Preprocess tokens */ @@ -603,6 +607,7 @@ rspamd_stat_learn (struct rspamd_task *task, GError **err) { struct rspamd_stat_ctx *st_ctx; + rspamd_stat_result_t ret = RSPAMD_STAT_PROCESS_OK; /* * We assume now that a task has been already classified before @@ -610,11 +615,14 @@ rspamd_stat_learn (struct rspamd_task *task, */ g_assert (RSPAMD_TASK_IS_CLASSIFIED (task)); - rspamd_stat_result_t ret = RSPAMD_STAT_PROCESS_OK; - st_ctx = rspamd_stat_get_ctx (); g_assert (st_ctx != NULL); + if (st_ctx->classifiers->len == 0) { + task->processed_stages |= stage; + return ret; + } + if (stage == RSPAMD_TASK_STAGE_LEARN_PRE) { /* Process classifiers */ if (!rspamd_stat_cache_check (st_ctx, task, classifier, spam, err)) { |