aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-04-01 15:52:58 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-04-01 15:52:58 +0100
commit633e5513e27b1ea14b6f152ef72a5498b6b1f825 (patch)
tree1b98598d1b0733f09101b738ce83fd75392e7fd6 /src
parent7dfecb9cc8f3ceffaf3a3077166807bfb8fff231 (diff)
downloadrspamd-633e5513e27b1ea14b6f152ef72a5498b6b1f825.tar.gz
rspamd-633e5513e27b1ea14b6f152ef72a5498b6b1f825.zip
[Minor] Add more explicit logging
Diffstat (limited to 'src')
-rw-r--r--src/libserver/url.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/libserver/url.c b/src/libserver/url.c
index f860eec0c..f0f5bb21b 100644
--- a/src/libserver/url.c
+++ b/src/libserver/url.c
@@ -402,7 +402,7 @@ rspamd_url_strerror (enum uri_errno err)
return NULL;
}
-static void
+static gboolean
rspamd_url_parse_tld_file (const gchar *fname,
struct url_match_scanner *scanner)
{
@@ -417,7 +417,7 @@ rspamd_url_parse_tld_file (const gchar *fname,
if (f == NULL) {
msg_err ("cannot open TLD file %s: %s", fname, strerror (errno));
- return;
+ return FALSE;
}
m.end = url_tld_end;
@@ -469,6 +469,8 @@ rspamd_url_parse_tld_file (const gchar *fname,
free (linebuf);
fclose (f);
+
+ return TRUE;
}
static void
@@ -511,6 +513,7 @@ void
rspamd_url_init (const gchar *tld_file)
{
GError *err = NULL;
+ gboolean ret = TRUE;
if (url_scanner != NULL) {
rspamd_url_deinit ();
@@ -535,18 +538,26 @@ rspamd_url_init (const gchar *tld_file)
rspamd_url_add_static_matchers (url_scanner);
if (tld_file != NULL) {
- rspamd_url_parse_tld_file (tld_file, url_scanner);
+ ret = rspamd_url_parse_tld_file (tld_file, url_scanner);
}
if (!rspamd_multipattern_compile (url_scanner->search_trie, &err)) {
msg_err ("cannot compile tld patterns, url matching will be "
"broken completely: %e", err);
g_error_free (err);
+ ret = FALSE;
}
if (tld_file != NULL) {
- msg_info ("initialized %ud url tld suffixes from '%s'",
- url_scanner->matchers->len, tld_file);
+ if (ret) {
+ msg_info ("initialized %ud url match suffixes from '%s'",
+ url_scanner->matchers->len, tld_file);
+ }
+ else {
+ msg_err ("failed to initialize url tld suffixes from '%s', "
+ "use %ud internal match suffixes",
+ tld_file, url_scanner->matchers->len);
+ }
}
}