[exim-cvs] SPF: fix result for case of only non-spf TXT RRs.…

Top Page
Delete this message
Reply to this message
Author: Exim Git Commits Mailing List
Date:  
To: exim-cvs
Subject: [exim-cvs] SPF: fix result for case of only non-spf TXT RRs. Bug 2499
Gitweb: https://git.exim.org/exim.git/commitdiff/67794d2b830fc580f87b0635718d95e32b467be1
Commit:     67794d2b830fc580f87b0635718d95e32b467be1
Parent:     ccbb15c9d7d7cac10228311aa1c7e448343a345d
Author:     Wolfgang Breyha <wbreyha@???>
AuthorDate: Tue Jan 7 13:03:18 2020 +0000
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Tue Jan 7 13:03:18 2020 +0000


    SPF: fix result for case of only non-spf TXT RRs.  Bug 2499
---
 src/src/spf.c              |  7 ++++++-
 test/scripts/4600-SPF/4601 | 17 ++++++++---------
 test/stdout/4601           | 11 ++++++-----
 3 files changed, 20 insertions(+), 15 deletions(-)


diff --git a/src/src/spf.c b/src/src/spf.c
index 7671551..9b053cc 100644
--- a/src/src/spf.c
+++ b/src/src/spf.c
@@ -152,7 +152,12 @@ for (dns_record * rr = dns_next_rr(dnsa, &dnss, RESET_ANSWERS); rr;
     srr.rr[found++] = (void *) s;
     }


-srr.num_rr = found;
+/* Did we filter out all TXT RRs? Return NO_DATA instead of SUCCESS with
+empty ANSWER section. */
+
+if (!(srr.num_rr = found))
+  srr.herrno = NO_DATA;
+
 /* spfrr->rr must have been malloc()d for this */
 SPF_dns_rr_dup(&spfrr, &srr);
 return spfrr;
diff --git a/test/scripts/4600-SPF/4601 b/test/scripts/4600-SPF/4601
index 96f06a6..5e6602a 100644
--- a/test/scripts/4600-SPF/4601
+++ b/test/scripts/4600-SPF/4601
@@ -25,14 +25,13 @@ quit
 #
 killdaemon
 #
-# SERVFAIL -> temperror
-# A multiple spf-RR return should get permerror
-# - and not crash with non-spf txt records
-# v=spf1 is casr-insensitive
+#
+#
 exim -be
-none      ${lookup {fred@???} spf {HOSTIPV4}}
-temperror ${lookup {fred@???} spf {HOSTIPV4}}
-permerror ${lookup {fred@???} spf {8.8.8.8}}
-permerror ${lookup {fred@???} spf {8.8.8.8}}
-pass      ${lookup {fred@???} spf {HOSTIPV4}}
+eDNS_NOMATCH       none      ${lookup {fred@???} spf {HOSTIPV4}}
+eDNS_AGAIN         temperror ${lookup {fred@???} spf {HOSTIPV4}}
+multiple rr        permerror ${lookup {fred@???} spf {8.8.8.8}}
+multi + non-spf    permerror ${lookup {fred@???} spf {8.8.8.8}}
+uppercase in v=    pass      ${lookup {fred@???} spf {HOSTIPV4}}
+only non-spf txt   none      ${lookup {fred@???} spf {HOSTIPV4}}
 ****
diff --git a/test/stdout/4601 b/test/stdout/4601
index cbb4cf5..38eefab 100644
--- a/test/stdout/4601
+++ b/test/stdout/4601
@@ -26,9 +26,10 @@ Connecting to 127.0.0.1 port 1224 ... connected
 <<< 250 Accepted

>>> quit

 End of script
-> none      none
-> temperror temperror
-> permerror permerror
-> permerror permerror
-> pass      pass
+> eDNS_NOMATCH       none      none
+> eDNS_AGAIN         temperror temperror
+> multiple rr        permerror permerror
+> multi + non-spf    permerror permerror
+> uppercase in v=    pass      pass
+> only non-spf txt   none      none

>