static gboolean
rspamd_dkim_canonize_header_relaxed (struct rspamd_dkim_common_ctx *ctx,
- const gchar *header,
- const gchar *header_name,
- gboolean is_sign)
+ const gchar *header,
+ const gchar *header_name,
+ gboolean is_sign,
+ guint count)
{
static gchar st_buf[8192];
gchar *buf;
g_assert (r != -1);
if (!is_sign) {
- msg_debug_dkim ("update signature with header: %s", buf);
+ msg_debug_dkim ("update signature with header (idx=%d): %s", count, buf);
EVP_DigestUpdate (ctx->headers_hash, buf, r);
}
else {
hdr_cnt ++;
- if (cur->next == NULL) {
+ if (cur == rh) {
/* Cycle */
break;
}
if (ctx->header_canon_type == DKIM_CANON_SIMPLE) {
rspamd_dkim_hash_update (ctx->headers_hash, sel->raw_value,
sel->raw_len);
- msg_debug_dkim ("update signature with header: %*s",
- (gint)sel->raw_len, sel->raw_value);
+ msg_debug_dkim ("update signature with header (idx=%d): %*s",
+ count, (gint)sel->raw_len, sel->raw_value);
}
else {
if (ctx->is_sign && (sel->flags & RSPAMD_HEADER_FROM)) {
PTR_ARRAY_FOREACH (MESSAGE_FIELD (task, from_mime), i, addr) {
if (!(addr->flags & RSPAMD_EMAIL_ADDR_ORIGINAL)) {
if (!rspamd_dkim_canonize_header_relaxed (ctx, addr->raw,
- header_name, FALSE)) {
+ header_name, FALSE, i)) {
return FALSE;
}
}
if (!rspamd_dkim_canonize_header_relaxed (ctx, sel->value,
- header_name, FALSE)) {
+ header_name, FALSE, count)) {
return FALSE;
}
}
if (!rspamd_dkim_canonize_header_relaxed (ctx,
dkim_header,
header_name,
- TRUE)) {
+ TRUE, 0)) {
return FALSE;
}
}
if (!rspamd_dkim_canonize_header_relaxed (&ctx->common,
hdr->str,
hname,
- TRUE)) {
+ TRUE,
+ 0)) {
g_string_free (hdr, TRUE);
return NULL;