* Exim - an Internet mail transport agent *
*************************************************/
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2024 */
/* Copyright (c) University of Cambridge, 1995 - 2018 */
/* See the file NOTICE for conditions of use and distribution. */
/* SPDX-License-Identifier: GPL-2.0-or-later */
break;
}
-log_write(0, LOG_MAIN, "%s", string_from_gstring(logmsg));
+log_write(0, LOG_MAIN, "%Y", logmsg);
return;
}
if (sig->domain) g = string_append_listele(g, ':', sig->domain);
if (sig->identity) g = string_append_listele(g, ':', sig->identity);
}
-
-if (g) dkim_signers = g->s;
+gstring_release_unused(g);
+dkim_signers = string_from_gstring(g);
out:
store_pool = dkim_verify_oldpool;
{
int rc;
DEBUG(D_receive)
- debug_printf("calling acl_smtp_dkim for dkim_cur_signer='%s'\n", id);
+ debug_printf("calling acl_smtp_dkim for identity '%s' domain '%s' sel '%s'\n",
+ id, dkim_signing_domain, dkim_signing_selector);
rc = acl_check(ACL_WHERE_DKIM, NULL, acl_smtp_dkim, user_msgptr, log_msgptr);
dkim_exim_verify_log_sig(dkim_cur_sig);
/* For the given identity, run the DKIM ACL once for each matching signature.
+If none match, run it once.
Arguments
id Identity to look for in dkim signatures
dkim_verify_status = dkim_exim_expand_query(DKIM_VERIFY_STATUS);
dkim_verify_reason = dkim_exim_expand_query(DKIM_VERIFY_REASON);
- if ((rc = dkim_acl_call(id, res_ptr, user_msgptr, log_msgptr)) != OK)
+ if ( (rc = dkim_acl_call(id, res_ptr, user_msgptr, log_msgptr)) != OK
+ || dkim_verify_minimal && Ustrcmp(dkim_verify_status, "pass") == 0)
return rc;
}
store_pool = POOL_MAIN;
+GET_OPTION("dkim_domain");
if ((s = dkim->dkim_domain) && !(dkim_domain = expand_cstring(s)))
/* expansion error, do not send message. */
{ errwhen = US"dkim_domain"; goto expand_bad; }
/* Set $dkim_selector expansion variable to each selector in list,
for this domain. */
+ GET_OPTION("dkim_selector");
if (!(dkim_sel = expand_string(dkim->dkim_selector)))
{ errwhen = US"dkim_selector"; goto expand_bad; }
/* Get canonicalization to use */
+ GET_OPTION("dkim_canon");
dkim_canon_expanded = dkim->dkim_canon
? expand_string(dkim->dkim_canon) : US"relaxed";
if (!dkim_canon_expanded) /* expansion error, do not send message. */
pdkim_canon = PDKIM_CANON_RELAXED;
}
+ GET_OPTION("dkim_sign_headers");
if ( dkim->dkim_sign_headers
&& !(dkim_sign_headers_expanded = expand_string(dkim->dkim_sign_headers)))
{ errwhen = US"dkim_sign_header"; goto expand_bad; }
/* Get private key to use. */
+ GET_OPTION("dkim_private_key");
if (!(dkim_private_key_expanded = expand_string(dkim->dkim_private_key)))
{ errwhen = US"dkim_private_key"; goto expand_bad; }
expand_file_big_buffer(dkim_private_key_expanded)))
goto bad;
+ GET_OPTION("dkim_hash");
if (!(dkim_hash_expanded = expand_string(dkim->dkim_hash)))
{ errwhen = US"dkim_hash"; goto expand_bad; }
+ GET_OPTION("dkim_identity");
if (dkim->dkim_identity)
if (!(dkim_identity_expanded = expand_string(dkim->dkim_identity)))
{ errwhen = US"dkim_identity"; goto expand_bad; }
else if (!*dkim_identity_expanded)
dkim_identity_expanded = NULL;
+ GET_OPTION("dkim_timestamps");
if (dkim->dkim_timestamps)
if (!(dkim_timestamps_expanded = expand_string(dkim->dkim_timestamps)))
{ errwhen = US"dkim_timestamps"; goto expand_bad; }
else
- xval = (tval = (unsigned long) time(NULL))
- + strtoul(CCS dkim_timestamps_expanded, NULL, 10);
+ {
+ tval = (unsigned long) time(NULL);
+ xval = strtoul(CCS dkim_timestamps_expanded, NULL, 10);
+ if (xval > 0)
+ xval += tval;
+ }
if (!(sig = pdkim_init_sign(&dkim_sign_ctx, dkim_signing_domain,
dkim_signing_selector,
if (!pdkim_set_sig_bodyhash(&dkim_sign_ctx, sig))
goto bad;
+ dkim_signing_record = string_append_listele(dkim_signing_record, ':', dkim_signing_domain);
+ dkim_signing_record = string_append_listele(dkim_signing_record, ':', dkim_signing_selector);
+
if (!dkim_sign_ctx.sig) /* link sig to context chain */
dkim_sign_ctx.sig = sig;
else
DEBUG(D_acl)
if (gstring_length(g) == start)
- debug_printf("DKIM: no authres\n");
+ debug_printf("DKIM:\tno authres\n");
else
- debug_printf("DKIM: authres '%.*s'\n", g->ptr - start - 3, g->s + start + 3);
+ debug_printf("DKIM:\tauthres '%.*s'\n", g->ptr - start - 3, g->s + start + 3);
return g;
}