diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2010-12-20 22:09:16 +0300 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2010-12-20 22:09:16 +0300 |
commit | b8211fbcc8f7de342d4a0176bedf182e1f37397d (patch) | |
tree | fb5922ce974af9572564f28eaf9ae8798b740e4c /src/main.c | |
parent | 90b983f151edcb747b86363d30f2101a9b060045 (diff) | |
download | rspamd-b8211fbcc8f7de342d4a0176bedf182e1f37397d.tar.gz rspamd-b8211fbcc8f7de342d4a0176bedf182e1f37397d.zip |
* Introduce new system of configuration checks:
- now symbols inside metrics definition must be inside rules as well
- symbols may be virtual (e.g. when module can insert several symbols inside callback)
- symbols may be pure callbacks (when symbol's name is unknown and depends on conditions)
* Module 'emails' is removed as it is not used in the current rspamd
MANY fixes to sample config files
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/main.c b/src/main.c index ab62c8037..72a7b6eac 100644 --- a/src/main.c +++ b/src/main.c @@ -31,6 +31,7 @@ #include "map.h" #include "fuzzy_storage.h" #include "cfg_xml.h" +#include "symbols_cache.h" #ifndef WITHOUT_PERL @@ -715,16 +716,20 @@ print_symbols_cache (struct config_file *cfg) cur = cfg->cache->negative_items; while (cur) { item = cur->data; - printf ("-----------------------------------------------------------------\n"); - printf ("| %3d | %22s | %6.1f | %9d | %9.3f |\n", i, item->s->symbol, item->s->weight, item->s->frequency, item->s->avg_time); + if (!item->is_callback) { + printf ("-----------------------------------------------------------------\n"); + printf ("| %3d | %22s | %6.1f | %9d | %9.3f |\n", i, item->s->symbol, item->s->weight, item->s->frequency, item->s->avg_time); + } cur = g_list_next (cur); i ++; } cur = cfg->cache->static_items; while (cur) { item = cur->data; - printf ("-----------------------------------------------------------------\n"); - printf ("| %3d | %22s | %6.1f | %9d | %9.3f |\n", i, item->s->symbol, item->s->weight, item->s->frequency, item->s->avg_time); + if (!item->is_callback) { + printf ("-----------------------------------------------------------------\n"); + printf ("| %3d | %22s | %6.1f | %9d | %9.3f |\n", i, item->s->symbol, item->s->weight, item->s->frequency, item->s->avg_time); + } cur = g_list_next (cur); i ++; } @@ -859,6 +864,12 @@ main (gint argc, gchar **argv, gchar **env) } l = g_list_next (l); } + /* Insert classifiers symbols */ + (void)insert_classifier_symbols (rspamd->cfg); + + if (! validate_cache (rspamd->cfg->cache, rspamd->cfg, TRUE)) { + res = FALSE; + } if (dump_vars) { dump_cfg_vars (rspamd->cfg); } @@ -917,6 +928,9 @@ main (gint argc, gchar **argv, gchar **env) /* Check configuration for modules */ (void)check_modules_config (rspamd->cfg); + /* Insert classifiers symbols */ + (void)insert_classifier_symbols (rspamd->cfg); + /* Perform modules configuring */ l = g_list_first (rspamd->cfg->filters); @@ -933,6 +947,9 @@ main (gint argc, gchar **argv, gchar **env) /* Init config cache */ init_cfg_cache (rspamd->cfg); + /* Validate cache */ + (void)validate_cache (rspamd->cfg->cache, rspamd->cfg, FALSE); + /* Flush log */ flush_log_buf (); |