aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver/cfg_utils.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-04-28 15:25:10 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-04-28 15:25:10 +0100
commitb64cb0ef4685038fff4e902d592fcbe9937c3abf (patch)
tree8ad78304fe02cd49ace41120aa0b7e894309d497 /src/libserver/cfg_utils.c
parentb245bc26da34211a8eedd4a7a4cd8fd3f4349331 (diff)
downloadrspamd-b64cb0ef4685038fff4e902d592fcbe9937c3abf.tar.gz
rspamd-b64cb0ef4685038fff4e902d592fcbe9937c3abf.zip
Try to guess url_tld if it is not specified.
Diffstat (limited to 'src/libserver/cfg_utils.c')
-rw-r--r--src/libserver/cfg_utils.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c
index 450bde0a7..900914535 100644
--- a/src/libserver/cfg_utils.c
+++ b/src/libserver/cfg_utils.c
@@ -383,6 +383,27 @@ rspamd_config_post_load (struct rspamd_config *cfg)
cfg->default_metric = def_metric;
+ if (cfg->tld_file == NULL) {
+ /* Try to guess tld file */
+ GString *fpath = g_string_new (NULL);
+
+ rspamd_printf_gstring (fpath, "%s%c%s", RSPAMD_PLUGINSDIR,
+ G_DIR_SEPARATOR, "effective_tld_names.dat");
+
+ if (access (fpath->str, R_OK)) {
+ msg_warn ("url_tld option is not specified but %s is available,"
+ " therefore this file is assumed as TLD file for URL"
+ " extraction", fpath->str);
+ cfg->tld_file = rspamd_mempool_strdup (cfg->cfg_pool, fpath->str);
+ }
+ else {
+ msg_err ("no url_tld option has been specified, URL's detection "
+ "will be awfully broken");
+ }
+
+ g_string_free (fpath, TRUE);
+ }
+
/* Lua options */
(void)rspamd_lua_post_load_config (cfg);
init_dynamic_config (cfg);