From 12d5f2919c9a1f9c8eec4e091b9e2c6dca529bd6 Mon Sep 17 00:00:00 2001 From: Brian Rak Date: Fri, 2 Aug 2024 12:11:39 -0400 Subject: [PATCH] Fix issue where HELO was not being provided to libspf2, resulting in https://github.com/trusteddomainproject/OpenDMARC/issues/262 --- libopendmarc/opendmarc_spf.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libopendmarc/opendmarc_spf.c b/libopendmarc/opendmarc_spf.c index e015183..afbc41b 100644 --- a/libopendmarc/opendmarc_spf.c +++ b/libopendmarc/opendmarc_spf.c @@ -163,13 +163,14 @@ opendmarc_spf2_test(char *ip_address, char *mail_from_domain, char *helo_domain, return DMARC_POLICY_SPF_OUTCOME_TMPFAIL; } - ret = opendmarc_spf2_find_mailfrom_domain(ctx, mail_from_domain, mfrom, sizeof mfrom, used_mfrom); - if (ret != 0 || *used_mfrom == FALSE) + if (helo_domain != NULL) { (void) strlcpy(helo, helo_domain, sizeof helo); SPF_request_set_helo_dom(ctx->spf_request, helo); } - else + + ret = opendmarc_spf2_find_mailfrom_domain(ctx, mail_from_domain, mfrom, sizeof mfrom, used_mfrom); + if (ret == 0 && *used_mfrom != FALSE) { SPF_request_set_env_from(ctx->spf_request, mfrom); }