aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstat/backends
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-11-20 07:36:23 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-11-20 07:36:23 +0000
commitce26b2d4553dbf66e2a2328d7618057bfbcc5a1a (patch)
treea138489542e9afa76f739229a24d742a654e39d7 /src/libstat/backends
parentbf66470bed906d729b542c194b205ad39de56c29 (diff)
downloadrspamd-ce26b2d4553dbf66e2a2328d7618057bfbcc5a1a.tar.gz
rspamd-ce26b2d4553dbf66e2a2328d7618057bfbcc5a1a.zip
[Fix] Fix parsing of the per-user script
Issue: #1843 MFH: rspamd-1.6
Diffstat (limited to 'src/libstat/backends')
-rw-r--r--src/libstat/backends/redis_backend.c49
1 files changed, 29 insertions, 20 deletions
diff --git a/src/libstat/backends/redis_backend.c b/src/libstat/backends/redis_backend.c
index 22c784e07..8f6462952 100644
--- a/src/libstat/backends/redis_backend.c
+++ b/src/libstat/backends/redis_backend.c
@@ -1186,8 +1186,7 @@ rspamd_redis_try_ucl (struct redis_stat_ctx *backend,
struct rspamd_config *cfg,
const gchar *symbol)
{
- const ucl_object_t *elt, *relt, *users_enabled;
- const gchar *lua_script;
+ const ucl_object_t *elt, *relt;
elt = ucl_object_lookup_any (obj, "read_servers", "servers", NULL);
@@ -1228,6 +1227,33 @@ rspamd_redis_try_ucl (struct redis_stat_ctx *backend,
}
}
+ elt = ucl_object_lookup_any (obj, "db", "database", "dbname", NULL);
+ if (elt) {
+ backend->dbname = ucl_object_tostring (elt);
+ }
+ else {
+ backend->dbname = NULL;
+ }
+
+ elt = ucl_object_lookup (obj, "password");
+ if (elt) {
+ backend->password = ucl_object_tostring (elt);
+ }
+ else {
+ backend->password = NULL;
+ }
+
+ return TRUE;
+}
+
+static void
+rspamd_redis_parse_classifier_opts (struct redis_stat_ctx *backend,
+ const ucl_object_t *obj,
+ struct rspamd_config *cfg)
+{
+ const gchar *lua_script;
+ const ucl_object_t *elt, *users_enabled;
+
users_enabled = ucl_object_lookup_any (obj, "per_user",
"users_enabled", NULL);
@@ -1285,14 +1311,6 @@ rspamd_redis_try_ucl (struct redis_stat_ctx *backend,
backend->timeout = REDIS_DEFAULT_TIMEOUT;
}
- elt = ucl_object_lookup (obj, "password");
- if (elt) {
- backend->password = ucl_object_tostring (elt);
- }
- else {
- backend->password = NULL;
- }
-
elt = ucl_object_lookup (obj, "store_tokens");
if (elt) {
backend->store_tokens = ucl_object_toboolean (elt);
@@ -1324,16 +1342,6 @@ rspamd_redis_try_ucl (struct redis_stat_ctx *backend,
else {
backend->expiry = 0;
}
-
- elt = ucl_object_lookup_any (obj, "db", "database", "dbname", NULL);
- if (elt) {
- backend->dbname = ucl_object_tostring (elt);
- }
- else {
- backend->dbname = NULL;
- }
-
- return TRUE;
}
gpointer
@@ -1391,6 +1399,7 @@ rspamd_redis_init (struct rspamd_stat_ctx *ctx,
return NULL;
}
+ rspamd_redis_parse_classifier_opts (backend, st->classifier->cfg->opts, cfg);
stf->clcf->flags |= RSPAMD_FLAG_CLASSIFIER_INCREMENTING_BACKEND;
backend->stcf = stf;