diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-05-13 13:59:09 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-05-13 13:59:09 +0100 |
commit | 967e5ee83cb1e7bb17dde33686a48d27617b1e0c (patch) | |
tree | 8efb05f9d6fb1e876a1560354ea567f5241713ea | |
parent | 0a9d4aac126a244c0d1b8a5eb7322c78416df083 (diff) | |
download | rspamd-967e5ee83cb1e7bb17dde33686a48d27617b1e0c.tar.gz rspamd-967e5ee83cb1e7bb17dde33686a48d27617b1e0c.zip |
[Minor] Add some logging
-rw-r--r-- | src/hs_helper.c | 20 | ||||
-rw-r--r-- | src/libserver/re_cache.c | 8 |
2 files changed, 28 insertions, 0 deletions
diff --git a/src/hs_helper.c b/src/hs_helper.c index cba2ca230..c19293bb1 100644 --- a/src/hs_helper.c +++ b/src/hs_helper.c @@ -133,6 +133,10 @@ rspamd_hs_helper_cleanup_dir (struct hs_helper_ctx *ctx, gboolean forced) } globbuf.gl_offs = 0; + /* + * We reuse this buffer for .new patterns as well, so allocate with some + * margin + */ len = strlen (ctx->hs_dir) + 1 + sizeof ("*.hs.new") + 2; pattern = g_malloc (len); rspamd_snprintf (pattern, len, "%s%c%s", ctx->hs_dir, G_DIR_SEPARATOR, "*.hs"); @@ -147,6 +151,10 @@ rspamd_hs_helper_cleanup_dir (struct hs_helper_ctx *ctx, gboolean forced) strerror (errno)); ret = FALSE; } + else { + msg_notice ("successfully removed outdated hyperscan file: %s", + globbuf.gl_pathv[i]); + } } } } @@ -193,6 +201,18 @@ rspamd_hs_helper_cleanup_dir (struct hs_helper_ctx *ctx, gboolean forced) strerror(errno)); ret = FALSE; } + else { + msg_notice ("successfully removed outdated hyperscan temporary file: %s; " + "pid of the file creator process: %P", + globbuf.gl_pathv[i], + foreign_pid); + } + } + else { + msg_notice ("skip removal of the hyperscan temporary file: %s; " + "pid of the file creator process: %P", + globbuf.gl_pathv[i], + foreign_pid); } } } diff --git a/src/libserver/re_cache.c b/src/libserver/re_cache.c index 1d2f6522f..1b591a81c 100644 --- a/src/libserver/re_cache.c +++ b/src/libserver/re_cache.c @@ -2291,10 +2291,18 @@ rspamd_re_cache_is_valid_hyperscan_file (struct rspamd_re_cache *cache, len = strlen (path); if (len < sizeof (rspamd_cryptobox_HASHBYTES + 3)) { + if (!silent) { + msg_err_re_cache ("cannot open hyperscan cache file %s: too short filename", + path); + } return FALSE; } if (memcmp (path + len - 3, ".hs", 3) != 0) { + if (!silent) { + msg_err_re_cache ("cannot open hyperscan cache file %s: not ending with .hs", + path); + } return FALSE; } |