X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/7952eef9f77899f36b23f1b9fa679f459cd52ffd..254f38d1c5ada5e4df0bccb385dc466549620c71:/src/src/spf.c diff --git a/src/src/spf.c b/src/src/spf.c index 1d4e032e9..0b00a5c7c 100644 --- a/src/src/spf.c +++ b/src/src/spf.c @@ -5,7 +5,7 @@ /* Experimental SPF support. Copyright (c) Tom Kistner 2004 - 2014 License: GPL - Copyright (c) The Exim Maintainers 2017 + Copyright (c) The Exim Maintainers 2015 - 2018 */ /* Code for calling spf checks via libspf-alt. Called from acl.c. */ @@ -22,8 +22,6 @@ static spf_result_id spf_result_id_list[] = { { US"fail", 3 }, { US"softfail", 4 }, { US"none", 5 }, - { US"err_temp", 6 }, /* Deprecated Apr 2014 */ - { US"err_perm", 7 }, /* Deprecated Apr 2014 */ { US"temperror", 6 }, /* RFC 4408 defined */ { US"permerror", 7 } /* RFC 4408 defined */ }; @@ -89,7 +87,7 @@ return TRUE; /* spf_process adds the envelope sender address to the existing context (if any), retrieves the result, sets up expansion strings and evaluates the condition outcome. - + Return: OK/FAIL */ int @@ -105,14 +103,17 @@ if (!(spf_server && spf_request)) rc = SPF_RESULT_PERMERROR; else if (SPF_request_set_env_from(spf_request, CS spf_envelope_sender)) - /* Invalid sender address. This should be a real rare occurence */ + /* Invalid sender address. This should be a real rare occurrence */ rc = SPF_RESULT_PERMERROR; 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); @@ -146,4 +147,23 @@ while ((spf_result_id = string_nextinlist(&list, &sep, NULL, 0))) return FAIL; } + + +gstring * +authres_spf(gstring * g) +{ +uschar * s; +if (!spf_result) return g; + +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=<>"); +} + + #endif