aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2012-12-15 14:41:15 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2012-12-15 14:41:15 +0400
commit9289af21db35126236c24d73f5c298c532ff6b12 (patch)
treed203a59d226f0e895362e58a8db296613b4736f1 /src
parentfbcc7af8a6bfb2c82d17180358bfdadf0228cddd (diff)
downloadrspamd-9289af21db35126236c24d73f5c298c532ff6b12.tar.gz
rspamd-9289af21db35126236c24d73f5c298c532ff6b12.zip
Fix test build and shlibs depends.
Diffstat (limited to 'src')
-rw-r--r--src/cfg_utils.c51
-rw-r--r--src/lua/CMakeLists.txt1
-rw-r--r--src/main.c51
3 files changed, 52 insertions, 51 deletions
diff --git a/src/cfg_utils.c b/src/cfg_utils.c
index 37f28c822..ae0971d6a 100644
--- a/src/cfg_utils.c
+++ b/src/cfg_utils.c
@@ -578,56 +578,6 @@ substitute_all_variables (gpointer key, gpointer value, gpointer data)
(void)substitute_variable (cfg, (gchar *)key, (gchar *)value, 1);
}
-static void
-parse_filters_str (struct config_file *cfg, const gchar *str)
-{
- gchar **strvec, **p;
- struct filter *cur;
- module_t **pmodule;
-
- if (str == NULL) {
- return;
- }
-
- strvec = g_strsplit_set (str, ",", 0);
- if (strvec == NULL) {
- return;
- }
-
- p = strvec;
- while (*p) {
- cur = NULL;
- /* Search modules from known C modules */
- pmodule = &modules[0];
- while (*pmodule) {
- g_strstrip (*p);
- if ((*pmodule)->name != NULL && g_ascii_strcasecmp ((*pmodule)->name, *p) == 0) {
- cur = memory_pool_alloc (cfg->cfg_pool, sizeof (struct filter));
- cur->type = C_FILTER;
- msg_debug ("found C filter %s", *p);
- cur->func_name = memory_pool_strdup (cfg->cfg_pool, *p);
- cur->module = (*pmodule);
- cfg->filters = g_list_prepend (cfg->filters, cur);
-
- break;
- }
- pmodule ++;
- }
- if (cur != NULL) {
- /* Go to next iteration */
- p++;
- continue;
- }
- cur = memory_pool_alloc (cfg->cfg_pool, sizeof (struct filter));
- cur->type = PERL_FILTER;
- cur->func_name = memory_pool_strdup (cfg->cfg_pool, *p);
- cfg->filters = g_list_prepend (cfg->filters, cur);
- p++;
- }
-
- g_strfreev (strvec);
-}
-
/*
* Place pointers to cfg_file structure to hash cfg_params
*/
@@ -697,7 +647,6 @@ post_load_config (struct config_file *cfg)
g_hash_table_foreach (cfg->variables, substitute_all_variables, cfg);
g_hash_table_foreach (cfg->modules_opts, substitute_module_variables, cfg);
- parse_filters_str (cfg, cfg->filters_str);
fill_cfg_params (cfg);
#ifdef HAVE_CLOCK_GETTIME
diff --git a/src/lua/CMakeLists.txt b/src/lua/CMakeLists.txt
index 10609f782..8d05c65e5 100644
--- a/src/lua/CMakeLists.txt
+++ b/src/lua/CMakeLists.txt
@@ -19,6 +19,7 @@ SET(LUASRC lua_common.c
ADD_LIBRARY(rspamd-lua ${LINK_TYPE} ${LUASRC})
SET_TARGET_PROPERTIES(rspamd-lua PROPERTIES VERSION ${RSPAMD_VERSION})
TARGET_LINK_LIBRARIES(rspamd-lua rspamd-util)
+TARGET_LINK_LIBRARIES(rspamd-lua hiredis)
IF(ENABLE_LUAJIT MATCHES "ON")
TARGET_LINK_LIBRARIES(rspamd-lua "${LUAJIT_LIBRARY}")
ELSE(ENABLE_LUAJIT MATCHES "ON")
diff --git a/src/main.c b/src/main.c
index d28672e83..f85fe7ade 100644
--- a/src/main.c
+++ b/src/main.c
@@ -301,6 +301,56 @@ config_logger (struct rspamd_main *rspamd, GQuark type, gboolean is_fatal)
}
static void
+parse_filters_str (struct config_file *cfg, const gchar *str)
+{
+ gchar **strvec, **p;
+ struct filter *cur;
+ module_t **pmodule;
+
+ if (str == NULL) {
+ return;
+ }
+
+ strvec = g_strsplit_set (str, ",", 0);
+ if (strvec == NULL) {
+ return;
+ }
+
+ p = strvec;
+ while (*p) {
+ cur = NULL;
+ /* Search modules from known C modules */
+ pmodule = &modules[0];
+ while (*pmodule) {
+ g_strstrip (*p);
+ if ((*pmodule)->name != NULL && g_ascii_strcasecmp ((*pmodule)->name, *p) == 0) {
+ cur = memory_pool_alloc (cfg->cfg_pool, sizeof (struct filter));
+ cur->type = C_FILTER;
+ msg_debug ("found C filter %s", *p);
+ cur->func_name = memory_pool_strdup (cfg->cfg_pool, *p);
+ cur->module = (*pmodule);
+ cfg->filters = g_list_prepend (cfg->filters, cur);
+
+ break;
+ }
+ pmodule ++;
+ }
+ if (cur != NULL) {
+ /* Go to next iteration */
+ p++;
+ continue;
+ }
+ cur = memory_pool_alloc (cfg->cfg_pool, sizeof (struct filter));
+ cur->type = PERL_FILTER;
+ cur->func_name = memory_pool_strdup (cfg->cfg_pool, *p);
+ cfg->filters = g_list_prepend (cfg->filters, cur);
+ p++;
+ }
+
+ g_strfreev (strvec);
+}
+
+static void
reread_config (struct rspamd_main *rspamd)
{
struct config_file *tmp_cfg;
@@ -728,6 +778,7 @@ load_rspamd_config (struct config_file *cfg, gboolean init_modules)
/* Do post-load actions */
post_load_config (cfg);
+ parse_filters_str (cfg, cfg->filters_str);
if (init_modules) {
/* Init C modules */