/* -------------------------------------------------------------------------- */
-/* Print debugging functions */
-void
-pdkim_quoteprint(const uschar *data, int len)
-{
-for (int i = 0; i < len; i++)
- {
- const int c = data[i];
- switch (c)
- {
- case ' ' : debug_printf("{SP}"); break;
- case '\t': debug_printf("{TB}"); break;
- case '\r': debug_printf("{CR}"); break;
- case '\n': debug_printf("{LF}"); break;
- case '{' : debug_printf("{BO}"); break;
- case '}' : debug_printf("{BC}"); break;
- default:
- if ( (c < 32) || (c > 127) )
- debug_printf("{%02x}", c);
- else
- debug_printf("%c", c);
- break;
- }
- }
-debug_printf("\n");
-}
-
-void
-pdkim_hexprint(const uschar *data, int len)
-{
-if (data) for (int i = 0 ; i < len; i++) debug_printf("%02x", data[i]);
-else debug_printf("<NULL>");
-debug_printf("\n");
-}
-
static pdkim_stringlist *
{
debug_printf(
"DKIM >> Raw signature w/o b= tag value >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");
- pdkim_quoteprint(US sig->rawsig_no_b_val, Ustrlen(sig->rawsig_no_b_val));
+ debug_printf("%Z\n", US sig->rawsig_no_b_val);
debug_printf(
"DKIM >> Sig size: %4u bits\n", (unsigned) sig->sighash.len*8);
debug_printf(
{
exim_sha_update(&b->body_hash_ctx, CUS canon_data->data, left);
b->signed_body_bytes += left;
- DEBUG(D_acl) pdkim_quoteprint(canon_data->data, left);
+ DEBUG(D_acl) debug_printf("%.*Z\n", left, canon_data->data);
}
return relaxed_data;
"DKIM [%s]%s Body %s computed: ",
sig->domain, sig->selector, pdkim_canons[b->canon_method], b->signed_body_bytes,
sig->domain, sig->selector, pdkim_hashes[b->hashtype].dkim_hashname);
- pdkim_hexprint(CUS b->bh.data, b->bh.len);
+ debug_printf("%.*H\n", b->bh.len, CUS b->bh.data);
}
/* SIGNING -------------------------------------------------------------- */
DEBUG(D_acl)
{
debug_printf("DKIM [%s] Body hash signature from headers: ", sig->domain);
- pdkim_hexprint(sig->bodyhash.data, sig->bodyhash.len);
+ debug_printf("%.*H\n", sig->bodyhash.len, sig->bodyhash.data);
debug_printf("DKIM [%s] Body hash did NOT verify\n", sig->domain);
}
sig->verify_status = PDKIM_VERIFY_FAIL;
else
{
#ifdef notdef
- DEBUG(D_acl)
- {
- debug_printf("DKIM >> raw hdr: ");
- pdkim_quoteprint(CUS ctx->cur_header->s, ctx->cur_header->ptr);
- }
+ DEBUG(D_acl) debug_printf("DKIM >> raw hdr: %.*Z\n",
+ ctx->cur_head->ptr, CUS ctx->cur_header->s);
#endif
if (strncasecmp(CCS ctx->cur_header->s,
DKIM_SIGNATURE_HEADERNAME,
debug_printf(
"DKIM >> Parsing public key record >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"
" %s\n"
- " Raw record: ",
- dns_txt_name);
- pdkim_quoteprint(CUS dns_txt_reply, Ustrlen(dns_txt_reply));
+ " Raw record: %Z\n",
+ dns_txt_name,
+ CUS dns_txt_reply);
}
if ( !(p = pdkim_parse_pubkey_record(CUS dns_txt_reply))
/*XXX we could avoid doing this for all but the GnuTLS/RSA case */
hdata = exim_dkim_data_append(hdata, rh);
- DEBUG(D_acl) pdkim_quoteprint(rh, Ustrlen(rh));
+ DEBUG(D_acl) debug_printf("%Z\n", rh);
}
}
/* Feed header to the hash algorithm */
exim_sha_update_string(&hhash_ctx, CUS rh);
- DEBUG(D_acl) pdkim_quoteprint(rh, Ustrlen(rh));
+ DEBUG(D_acl) debug_printf("%Z\n", rh);
hdrs->tag = 1;
break;
}
{
debug_printf(
"DKIM >> Signed DKIM-Signature header, pre-canonicalized >>>>>>>>>>>>>\n");
- pdkim_quoteprint(CUS sig_hdr, Ustrlen(sig_hdr));
+ debug_printf("%Z\n", CUS sig_hdr);
debug_printf(
"DKIM <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
}
{
debug_printf("DKIM >> Signed DKIM-Signature header, canonicalized (%-7s) >>>>>>>\n",
pdkim_canons[sig->canon_headers]);
- pdkim_quoteprint(CUS sig_hdr, Ustrlen(sig_hdr));
+ debug_printf("%Z\n", CUS sig_hdr);
debug_printf(
"DKIM <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
}
{
debug_printf("DKIM [%s] Header %s computed: ",
sig->domain, pdkim_hashes[sig->hashtype].dkim_hashname);
- pdkim_hexprint(hhash.data, hhash.len);
+ debug_printf("%.*H\n", hhash.len, hhash.data);
}
/* Remember headers block for signing (when the signing library cannot do
DEBUG(D_acl)
{
debug_printf( "DKIM [%s] b computed: ", sig->domain);
- pdkim_hexprint(sig->sighash.data, sig->sighash.len);
+ debug_printf("%.*H\n", sig->sighash.len, sig->sighash.data);
}
sig->signature_header = pdkim_create_header(sig, TRUE);
DEBUG(D_acl)
{
debug_printf( "DKIM [%s] b from mail: ", sig->domain);
- pdkim_hexprint(sig->sighash.data, sig->sighash.len);
+ debug_printf("%.*H\n", sig->sighash.len, sig->sighash.data);
}
if (!(sig->pubkey = pdkim_key_from_dns(ctx, sig, &vctx, err)))