]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Add some logging
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 13 May 2021 12:59:09 +0000 (13:59 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 13 May 2021 12:59:09 +0000 (13:59 +0100)
src/hs_helper.c
src/libserver/re_cache.c

index cba2ca230bc39a79f06d3d9dc5ebc3cfd36387da..c19293bb19fe430e627b34cf207fd1e659212b32 100644 (file)
@@ -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);
                        }
                }
        }
index 1d2f6522fb132ff9bba0cf64dd4d5124c7e2b90f..1b591a81cb7c6508677b0ef5bc2b89b15b8d08ec 100644 (file)
@@ -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;
        }