]> source.dussan.org Git - rspamd.git/commitdiff
Allow configurations with no classifiers
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 14 Jan 2016 11:53:38 +0000 (11:53 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 14 Jan 2016 11:53:38 +0000 (11:53 +0000)
src/libstat/stat_process.c

index 086b7e2989df43742d5c74be194062a2342996b3..83621c973699221f03d79995b29251420347935c 100644 (file)
@@ -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)) {