Testsuite: compat vs. older GnuTLS
[exim.git] / src / src / spf.c
index 12994a690d226b363d1b7a4282cb889925b6b1fa..0b00a5c7cb6b32596998e3b9723ee4977261518e 100644 (file)
@@ -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 */
 };
@@ -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);
 
@@ -151,10 +152,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=<>");
 }