SPF: remove the deprecated "err_temp" and "err_perm" result names
[exim.git] / src / src / spf.c
index ffd278af8609f5b3e817929a75ec7d6bb9e3116f..a203c07baa8b0d70ed4fdb9737f1131d1733a300 100644 (file)
@@ -5,13 +5,13 @@
 /* Experimental SPF support.
    Copyright (c) Tom Kistner <tom@duncanthrax.net> 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