summaryrefslogtreecommitdiffstats
path: root/src/libstat/stat_process.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-10-08 16:27:15 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-10-08 16:35:42 +0100
commitbe2828419394df4339c793ce8526b5327da388d9 (patch)
treed2735974bc2b64710ed429828312b27392a17cc4 /src/libstat/stat_process.c
parent561594bb943bfdc9c9b888c1eacc2a6d34ca882b (diff)
downloadrspamd-be2828419394df4339c793ce8526b5327da388d9.tar.gz
rspamd-be2828419394df4339c793ce8526b5327da388d9.zip
[Minor] More fixes to backend-less classifiers
Diffstat (limited to 'src/libstat/stat_process.c')
-rw-r--r--src/libstat/stat_process.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/libstat/stat_process.c b/src/libstat/stat_process.c
index 7eeac00c1..ea0fcd601 100644
--- a/src/libstat/stat_process.c
+++ b/src/libstat/stat_process.c
@@ -275,6 +275,7 @@ rspamd_stat_preprocess (struct rspamd_stat_ctx *st_ctx,
rspamd_stat_process_tokenize (st_ctx, task);
task->stat_runtimes = g_ptr_array_sized_new (st_ctx->statfiles->len);
+ g_ptr_array_set_size (task->stat_runtimes, st_ctx->statfiles->len);
rspamd_mempool_add_destructor (task->task_pool,
rspamd_ptr_array_free_hard, task->stat_runtimes);
@@ -282,6 +283,11 @@ rspamd_stat_preprocess (struct rspamd_stat_ctx *st_ctx,
st = g_ptr_array_index (st_ctx->statfiles, i);
g_assert (st != NULL);
+ if (st->classifier->cfg->flags & RSPAMD_FLAG_CLASSIFIER_NO_BACKEND) {
+ g_ptr_array_index (task->stat_runtimes, i) = NULL;
+ continue;
+ }
+
bk_run = st->backend->runtime (task, st->stcf, learn, st->bkcf);
if (bk_run == NULL) {
@@ -289,7 +295,7 @@ rspamd_stat_preprocess (struct rspamd_stat_ctx *st_ctx,
st->backend->name, st->stcf->symbol);
}
- g_ptr_array_add (task->stat_runtimes, bk_run);
+ g_ptr_array_index (task->stat_runtimes, i) = bk_run;
}
}
@@ -728,7 +734,7 @@ rspamd_stat_backends_learn (struct rspamd_stat_ctx *st_ctx,
}
end:
- if (sel == NULL) {
+ if (!res && sel == NULL) {
if (classifier) {
g_set_error (err, rspamd_stat_quark (), 404, "cannot find classifier "
"with name %s", classifier);