SPF: fix result for case of only non-spf TXT RRs. Bug 2499
[users/jgh/exim.git] / src / src / spf.c
index 7671551bca4b8c3af115065e8221acea13ece51a..9b053ccf98e0f563444b917532897b2f0c27c70b 100644 (file)
@@ -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;