commit e9f8d4f: [Minor] Write SPF digest even if it is not cached

Vsevolod Stakhov vsevolod at highsecure.ru
Mon Nov 22 17:00:04 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-11-22 16:56:28 +0000
URL: https://github.com/rspamd/rspamd/commit/e9f8d4f2797da204276de066cd64ff0f1c1a9c2f (HEAD -> master)

[Minor] Write SPF digest even if it is not cached

---
 src/libserver/spf.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/libserver/spf.c b/src/libserver/spf.c
index 7dd5ed31c..e4462cd66 100644
--- a/src/libserver/spf.c
+++ b/src/libserver/spf.c
@@ -607,6 +607,7 @@ rspamd_spf_maybe_return (struct spf_record *rec)
 {
 	struct spf_resolved *flat;
 	struct rspamd_task *task = rec->task;
+	bool cached = false;
 
 	if (rec->requests_inflight == 0 && !rec->done) {
 		flat = rspamd_spf_record_flatten (rec);
@@ -620,16 +621,26 @@ rspamd_spf_maybe_return (struct spf_record *rec)
 						spf_record_ref (flat),
 						flat->timestamp, flat->ttl);
 
-				msg_info_task ("stored record for %s (0x%xuL) in LRU cache for %d seconds, "
+				msg_info_task ("stored SPF record for %s (0x%xuL) in LRU cache for %d seconds, "
 							   "%d/%d elements in the cache",
 						flat->domain,
 						flat->digest,
 						flat->ttl,
 						rspamd_lru_hash_size (spf_lib_ctx->spf_hash),
 						rspamd_lru_hash_capacity (spf_lib_ctx->spf_hash));
+				cached = true;
 			}
 		}
 
+		if (!cached) {
+			/* Still write a log line */
+			msg_info_task ("not stored SPF record for %s (0x%xuL) in LRU cache; flags=%d; ttl=%d",
+					flat->domain,
+					flat->digest,
+					flat->flags,
+					flat->ttl);
+		}
+
 		rec->callback (flat, rec->task, rec->cbdata);
 		spf_record_unref (flat);
 		rec->done = TRUE;


More information about the Commits mailing list