From 4ff848b506be673df1a4bf3867ad42ee78573afe Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Mon, 12 Feb 2018 16:27:09 +0000 Subject: [PATCH] Debug: more detail in dkim processing --- src/src/pdkim/pdkim.c | 15 ++++++++------- test/stderr/4520 | 6 +++--- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/src/pdkim/pdkim.c b/src/src/pdkim/pdkim.c index 256f44088..464516f0a 100644 --- a/src/src/pdkim/pdkim.c +++ b/src/src/pdkim/pdkim.c @@ -781,10 +781,10 @@ for (sig = ctx->sig; sig; sig = sig->next) DEBUG(D_acl) { - debug_printf("PDKIM [%s] Body bytes hashed: %lu\n" + debug_printf("PDKIM [%s] Body bytes (%s) hashed: %lu\n" "PDKIM [%s] Body %s computed: ", - sig->domain, b->signed_body_bytes, - sig->domain, pdkim_hashes[sig->hashtype].dkim_hashname); + sig->domain, pdkim_canons[b->canon_method], b->signed_body_bytes, + sig->domain, pdkim_hashes[b->hashtype].dkim_hashname); pdkim_hexprint(CUS b->bh.data, b->bh.len); } @@ -804,7 +804,7 @@ for (sig = ctx->sig; sig; sig = sig->next) if ( sig->bodyhash.data && memcmp(b->bh.data, sig->bodyhash.data, b->bh.len) == 0) { - DEBUG(D_acl) debug_printf("PDKIM [%s] Body hash verified OK\n", sig->domain); + DEBUG(D_acl) debug_printf("PDKIM [%s] Body hash compared OK\n", sig->domain); } else { @@ -1459,7 +1459,8 @@ for (sig = ctx->sig; sig; sig = sig->next) sig->sign_headers); DEBUG(D_acl) debug_printf( - "PDKIM >> Header data for hash, canonicalized, in sequence >>>>>>>>>>>>\n"); + "PDKIM >> Header data for hash, canonicalized (%-7s), in sequence >>\n", + pdkim_canons[sig->canon_headers]); /* SIGNING ---------------------------------------------------------------- */ @@ -1596,8 +1597,8 @@ for (sig = ctx->sig; sig; sig = sig->next) DEBUG(D_acl) { - debug_printf( - "PDKIM >> Signed DKIM-Signature header, canonicalized >>>>>>>>>>>>>>>>>\n"); + debug_printf("PDKIM >> Signed DKIM-Signature header, canonicalized (%-7s) >>>>>>>\n", + pdkim_canons[sig->canon_headers]); pdkim_quoteprint(CUS sig_hdr, Ustrlen(sig_hdr)); debug_printf( "PDKIM <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n"); diff --git a/test/stderr/4520 b/test/stderr/4520 index 499716fc1..19ff3fb48 100644 --- a/test/stderr/4520 +++ b/test/stderr/4520 @@ -34,15 +34,15 @@ PDKIM >> Parsing public key record >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> WARNING: bad dkim key in dns PDKIM (finished checking verify key)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< content{CR}{LF} -PDKIM [test.ex] Body bytes hashed: 9 +PDKIM [test.ex] Body bytes (relaxed) hashed: 9 PDKIM [test.ex] Body sha256 computed: fc06f48221d98ad6106c3845b33a2a41152482ab9e697f736ad26db4853fa657 PDKIM >> Headers to be signed: >>>>>>>>>>>> From -PDKIM >> Header data for hash, canonicalized, in sequence >>>>>>>>>>>> +PDKIM >> Header data for hash, canonicalized (relaxed), in sequence >> from:nobody@example.com{CR}{LF} PDKIM >> Signed DKIM-Signature header, pre-canonicalized >>>>>>>>>>>>> DKIM-Signature:{SP}v=1;{SP}a=rsa-sha256;{SP}q=dns/txt;{SP}c=relaxed/relaxed;{SP}d=test.ex;{CR}{LF}{TB}s=sel_bad;{SP}h=From;{SP}bh=/Ab0giHZitYQbDhFszoqQRUkgqueaX9zatJttIU/plc=;{SP}b=; -PDKIM >> Signed DKIM-Signature header, canonicalized >>>>>>>>>>>>>>>>> +PDKIM >> Signed DKIM-Signature header, canonicalized (relaxed) >>>>>>> dkim-signature:v=1;{SP}a=rsa-sha256;{SP}q=dns/txt;{SP}c=relaxed/relaxed;{SP}d=test.ex;{SP}s=sel_bad;{SP}h=From;{SP}bh=/Ab0giHZitYQbDhFszoqQRUkgqueaX9zatJttIU/plc=;{SP}b=; PDKIM [test.ex] Header sha256 computed: 241e16230df5723d899cfae9474c6b376a2ab1f81d1094e358f50ffd0e0067b3 SMTP<< 250 OK id=10HmbM-0005vi-00 -- 2.25.1