X-Git-Url: https://vcs.fsf.org/?p=exim.git;a=blobdiff_plain;f=src%2Fsrc%2Fspf.c;h=a203c07baa8b0d70ed4fdb9737f1131d1733a300;hp=ffd278af8609f5b3e817929a75ec7d6bb9e3116f;hb=8f0776b59c787a5359599f552d6aa7270c66bad3;hpb=eb52e2cbbe8672b28541e30a05cc9fabba1510df diff --git a/src/src/spf.c b/src/src/spf.c index ffd278af8..a203c07ba 100644 --- a/src/src/spf.c +++ b/src/src/spf.c @@ -5,13 +5,13 @@ /* 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. */ #include "exim.h" -#ifdef EXPERIMENTAL_SPF +#ifdef SUPPORT_SPF /* must be kept in numeric order */ static spf_result_id spf_result_id_list[] = { @@ -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 @@ -112,7 +110,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); @@ -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