diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2018-03-22 13:26:58 +0000 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2018-03-22 13:26:58 +0000 |
commit | 87e9d061c94e3fdd721b7b04ccbdba7a061f6ca3 (patch) | |
tree | e6a241c455a7995d4160eed6ab172f175dbd7e42 /src | |
parent | e01d111e5565ac1962804750bd14a16efc7226d6 (diff) |
SPF: additional variable $spf_result_guessed; tweak authresults string indicating guess
Diffstat (limited to 'src')
-rw-r--r-- | src/src/dmarc.c | 2 | ||||
-rw-r--r-- | src/src/expand.c | 1 | ||||
-rw-r--r-- | src/src/globals.c | 1 | ||||
-rw-r--r-- | src/src/globals.h | 1 | ||||
-rw-r--r-- | src/src/smtp_in.c | 1 | ||||
-rw-r--r-- | src/src/spf.c | 14 |
6 files changed, 17 insertions, 3 deletions
diff --git a/src/src/dmarc.c b/src/src/dmarc.c index ba9aa6695..1c917aa15 100644 --- a/src/src/dmarc.c +++ b/src/src/dmarc.c @@ -605,7 +605,7 @@ if (dmarc_has_been_checked) { g = string_append(g, 2, US";\n\tdmarc=", dmarc_pass_fail); if (header_from_sender) - g = string_append(g, 2, US"header.from=", header_from_sender); + g = string_append(g, 2, US" header.from=", header_from_sender); } return g; } diff --git a/src/src/expand.c b/src/src/expand.c index f1c8544c9..a1ac7d198 100644 --- a/src/src/expand.c +++ b/src/src/expand.c @@ -710,6 +710,7 @@ static var_entry var_table[] = { { "spf_header_comment", vtype_stringptr, &spf_header_comment }, { "spf_received", vtype_stringptr, &spf_received }, { "spf_result", vtype_stringptr, &spf_result }, + { "spf_result_guessed", vtype_bool, &spf_result_guessed }, { "spf_smtp_comment", vtype_stringptr, &spf_smtp_comment }, #endif { "spool_directory", vtype_stringptr, &spool_directory }, diff --git a/src/src/globals.c b/src/src/globals.c index 55154646c..aed695066 100644 --- a/src/src/globals.c +++ b/src/src/globals.c @@ -1382,6 +1382,7 @@ uschar *spf_guess = US"v=spf1 a/24 mx/24 ptr ?all"; uschar *spf_header_comment = NULL; uschar *spf_received = NULL; uschar *spf_result = NULL; +BOOL spf_result_guessed = FALSE; uschar *spf_smtp_comment = NULL; #endif diff --git a/src/src/globals.h b/src/src/globals.h index 7bd681fe9..66d6c26be 100644 --- a/src/src/globals.h +++ b/src/src/globals.h @@ -881,6 +881,7 @@ extern uschar *spf_guess; /* spf best-guess record */ extern uschar *spf_header_comment; /* spf header comment */ extern uschar *spf_received; /* Received-SPF: header */ extern uschar *spf_result; /* spf result in string form */ +extern BOOL spf_result_guessed; /* spf result is of best-guess operation */ extern uschar *spf_smtp_comment; /* spf comment to include in SMTP reply */ #endif extern BOOL split_spool_directory; /* TRUE to use multiple subdirs */ diff --git a/src/src/smtp_in.c b/src/src/smtp_in.c index c7eedf346..7d6298160 100644 --- a/src/src/smtp_in.c +++ b/src/src/smtp_in.c @@ -2006,6 +2006,7 @@ prdr_requested = FALSE; #endif #ifdef SUPPORT_SPF spf_header_comment = spf_received = spf_result = spf_smtp_comment = NULL; +spf_result_guessed = FALSE; #endif #ifdef EXPERIMENTAL_DMARC dmarc_has_been_checked = dmarc_disable_verify = dmarc_enable_forensic = FALSE; diff --git a/src/src/spf.c b/src/src/spf.c index 12994a690..0f0a05d4d 100644 --- a/src/src/spf.c +++ b/src/src/spf.c @@ -112,7 +112,10 @@ else { /* get SPF result */ if (action == SPF_PROCESS_FALLBACK) + { SPF_request_query_fallback(spf_request, &spf_response, CS spf_guess); + spf_result_guessed = TRUE; + } else SPF_request_query_mailfrom(spf_request, &spf_response); @@ -151,10 +154,17 @@ return FAIL; gstring * authres_spf(gstring * g) { +uschar * s; if (!spf_result) return g; -return string_append(g, 4, US";\n\tspf=", spf_result, - US" smtp.mailfrom=", expand_string(US"$sender_address_domain")); +g = string_append(g, 2, US";\n\tspf=", spf_result); +if (spf_result_guessed) + g = string_cat(g, US" (best guess record for domain)"); + +s = expand_string(US"$sender_address_domain"); +return s && *s + ? string_append(g, 2, US" smtp.mailfrom=", s) + : string_cat(g, US" smtp.mailfrom=<>"); } |