]> source.dussan.org Git - rspamd.git/commitdiff
Restore rspamd -t for compatibility
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 16 Oct 2015 12:15:16 +0000 (13:15 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 16 Oct 2015 12:15:16 +0000 (13:15 +0100)
src/rspamd.c

index 2377f8892e1c653e002b3a41dc1b1afb83571e8a..bef6df01466277c8caa90079e614e6c9d886547e 100644 (file)
@@ -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 */