From: Vsevolod Stakhov Date: Fri, 16 Oct 2015 12:15:16 +0000 (+0100) Subject: Restore rspamd -t for compatibility X-Git-Tag: 1.0.6~2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=92f71e385436e8b33072fd9ee7638b93129f9551;p=rspamd.git Restore rspamd -t for compatibility --- diff --git a/src/rspamd.c b/src/rspamd.c index 2377f8892..bef6df014 100644 --- a/src/rspamd.c +++ b/src/rspamd.c @@ -905,8 +905,34 @@ main (gint argc, gchar **argv, gchar **env) } if (rspamd_main->cfg->config_test || dump_cache) { - rspamd_fprintf (stderr, "use rspamadm configtest for this operation\n"); - exit (EXIT_FAILURE); + if (!load_rspamd_config (rspamd_main, rspamd_main->cfg, FALSE)) { + exit (EXIT_FAILURE); + } + + res = TRUE; + + rspamd_symbols_cache_init (rspamd_main->cfg->cache); + + if (!rspamd_init_filters (rspamd_main->cfg, FALSE)) { + res = FALSE; + } + + /* Insert classifiers symbols */ + rspamd_config_insert_classify_symbols (rspamd_main->cfg); + + if (!rspamd_symbols_cache_validate (rspamd_main->cfg->cache, + rspamd_main->cfg, + FALSE)) { + res = FALSE; + } + + if (dump_cache) { + msg_err_main ("Use rspamc counters for dumping cache"); + exit (EXIT_FAILURE); + } + + fprintf (stderr, "syntax %s\n", res ? "OK" : "BAD"); + return res ? EXIT_SUCCESS : EXIT_FAILURE; } /* Load config */