aboutsummaryrefslogtreecommitdiffstats
path: root/src/cfg_utils.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2010-12-13 20:54:22 +0300
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2010-12-13 20:54:22 +0300
commitdbc8bb8dbc278b80dd13e732da9647c9df856fa4 (patch)
tree2911a704485d5d31304985180e3b521f0ead15c9 /src/cfg_utils.c
parent55ec0f5776109efcd191c1a91e5107ca52a41c83 (diff)
downloadrspamd-dbc8bb8dbc278b80dd13e732da9647c9df856fa4.tar.gz
rspamd-dbc8bb8dbc278b80dd13e732da9647c9df856fa4.zip
Implement checking options for modules
Implement checking for classifier options Fix redirector to handle timeouts and invalid replies properly Fix surbl module not to check each url
Diffstat (limited to 'src/cfg_utils.c')
-rw-r--r--src/cfg_utils.c48
1 files changed, 43 insertions, 5 deletions
diff --git a/src/cfg_utils.c b/src/cfg_utils.c
index 2a0f548b8..b98746fe9 100644
--- a/src/cfg_utils.c
+++ b/src/cfg_utils.c
@@ -901,12 +901,12 @@ static GMarkupParser xml_parser = {
gboolean
read_xml_config (struct config_file *cfg, const gchar *filename)
{
- struct stat st;
+ struct stat st;
gint fd;
- gchar *data;
- gboolean res;
- GMarkupParseContext *ctx;
- GError *err = NULL;
+ gchar *data;
+ gboolean res;
+ GMarkupParseContext *ctx;
+ GError *err = NULL;
struct rspamd_xml_userdata ud;
@@ -939,6 +939,44 @@ read_xml_config (struct config_file *cfg, const gchar *filename)
return res;
}
+static void
+modules_config_callback (gpointer key, gpointer value, gpointer ud)
+{
+ extern GHashTable *module_options;
+ GHashTable *cur_module;
+ GList *cur;
+ struct module_opt *opt;
+ const gchar *mname = key;
+ gboolean *res = ud;
+
+ if ((cur_module = g_hash_table_lookup (module_options, mname)) == NULL) {
+ msg_warn ("module %s has not registered any options but is presented in configuration", mname);
+ *res = FALSE;
+ return;
+ }
+
+ cur = value;
+ while (cur) {
+ opt = cur->data;
+
+ if (!opt->is_lua && !check_module_option (mname, opt->param, opt->value)) {
+ *res = FALSE;
+ return;
+ }
+
+ cur = g_list_next (cur);
+ }
+}
+
+gboolean
+check_modules_config (struct config_file *cfg)
+{
+ gboolean res = TRUE;
+
+ g_hash_table_foreach (cfg->modules_opts, modules_config_callback, &res);
+ return res;
+}
+
/*
* vi:ts=4
*/