commit bf64e86: [Minor] Some more logging improvements

Vsevolod Stakhov vsevolod at highsecure.ru
Thu Feb 6 21:21:06 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-02-06 21:19:53 +0000
URL: https://github.com/rspamd/rspamd/commit/bf64e86c02545a9fec0659620d1de244042a4a29 (HEAD -> master)

[Minor] Some more logging improvements

---
 src/libserver/dkim.c | 27 +++++++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/src/libserver/dkim.c b/src/libserver/dkim.c
index 503347544..fb98c3d63 100644
--- a/src/libserver/dkim.c
+++ b/src/libserver/dkim.c
@@ -2347,6 +2347,21 @@ rspamd_dkim_check_bh_cached (struct rspamd_dkim_common_ctx *ctx,
 	return res;
 }
 
+static const char *
+rspamd_dkim_type_to_string (enum rspamd_dkim_type t)
+{
+	switch (t) {
+	case RSPAMD_DKIM_NORMAL:
+		return "dkim";
+	case RSPAMD_DKIM_ARC_SIG:
+		return "arc_sig";
+	case RSPAMD_DKIM_ARC_SEAL:
+	default:
+		return "arc_seal";
+
+	}
+}
+
 /**
  * Check task for dkim context using dkim key
  * @param ctx dkim verify context
@@ -2445,8 +2460,9 @@ rspamd_dkim_check (rspamd_dkim_context_t *ctx,
 		/* Check bh field */
 		if (memcmp (ctx->bh, cached_bh->digest_normal, ctx->bhlen) != 0) {
 			msg_info_dkim (
-					"dkim: bh value mismatch: got %*Bs, expected %*Bs; "
+					"%s: bh value mismatch: got %*Bs, expected %*Bs; "
 					"body length %d->%d; d=%s; s=%s",
+					rspamd_dkim_type_to_string (ctx->common.type),
 					(gint)dlen, cached_bh->digest_normal,
 					(gint)dlen, ctx->bh,
 					(gint)(body_end - body_start), ctx->common.body_canonicalised,
@@ -2581,8 +2597,9 @@ rspamd_dkim_check (rspamd_dkim_context_t *ctx,
 			res->fail_reason = "rsa verify failed";
 
 			msg_info_dkim (
-					"dkim: RSA verification failure: got %*Bs, expected %*Bs; "
+					"%s: RSA verification failure: got %*Bs, expected %*Bs; "
 					"body length %d->%d; headers length %d; d=%s; s=%s",
+					rspamd_dkim_type_to_string (ctx->common.type),
 					(gint)dlen, raw_digest,
 					(gint)dlen, ctx->b,
 					(gint)(body_end - body_start), ctx->common.body_canonicalised,
@@ -2594,8 +2611,9 @@ rspamd_dkim_check (rspamd_dkim_context_t *ctx,
 		if (ECDSA_verify (nid, raw_digest, dlen, ctx->b, ctx->blen,
 				key->key.key_ecdsa) != 1) {
 			msg_info_dkim (
-					"dkim: ECDSA verification failure: got %*Bs, expected %*Bs; "
+					"%s: ECDSA verification failure: got %*Bs, expected %*Bs; "
 					"body length %d->%d; headers length %d; d=%s; s=%s",
+					rspamd_dkim_type_to_string (ctx->common.type),
 					(gint)dlen, raw_digest,
 					(gint)dlen, ctx->b,
 					(gint)(body_end - body_start), ctx->common.body_canonicalised,
@@ -2610,8 +2628,9 @@ rspamd_dkim_check (rspamd_dkim_context_t *ctx,
 		if (!rspamd_cryptobox_verify (ctx->b, ctx->blen, raw_digest, dlen,
 				key->key.key_eddsa, RSPAMD_CRYPTOBOX_MODE_25519)) {
 			msg_info_dkim (
-					"dkim: EDDSA verification failure: got %*Bs, expected %*Bs; "
+					"%s: EDDSA verification failure: got %*Bs, expected %*Bs; "
 					"body length %d->%d; headers length %d; d=%s; s=%s",
+					rspamd_dkim_type_to_string (ctx->common.type),
 					(gint)dlen, raw_digest,
 					(gint)dlen, ctx->b,
 					(gint)(body_end - body_start), ctx->common.body_canonicalised,


More information about the Commits mailing list