diff src/dnsbl.cpp @ 384:7b7066a51c33

start parsing spf txt records
author Carl Byington <carl@five-ten-sg.com>
date Mon, 06 Mar 2017 14:01:14 -0800
parents c378e9d03f37
children be7355b47051
line wrap: on
line diff
--- a/src/dnsbl.cpp	Mon Mar 06 12:30:35 2017 -0800
+++ b/src/dnsbl.cpp	Mon Mar 06 14:01:14 2017 -0800
@@ -418,8 +418,8 @@
                 txt_answer[0] = '\0';  // return null string if there are no txt answers
                 txt_size--; // allow room for terminating null;
                 while (ns_parserr(&handle, ns_s_an, rrnum++, &rr) == 0) {
+                    if (ns_rr_type(rr) == qtype) {
                     size_t offset = 0;
-                    if (ns_rr_type(rr) == qtype) {
                         size_t rdlen = ns_rr_rdlen(rr);
                         const unsigned char *rdata = ns_rr_rdata(rr);
                         while ((offset < txt_size) && rdlen) {
@@ -432,13 +432,13 @@
                             rdata  += m;
                             rdlen  -= m;
                         }
-                    }
                     txt_answer[offset] = '\0';  // trailing null
                     if (strncasecmp(txt_answer, "v=spf1 ", 7) == 0) break;
                 }
-                if (strncasecmp(txt_answer, "v=spf1 ", 7) != 0) {
-                    txt_answer[0] = '\0';  // return null string if there are no spf1 txt answers
                 }
+                //if (strncasecmp(txt_answer, "v=spf1 ", 7) != 0) {
+                //    txt_answer[0] = '\0';  // return null string if there are no spf1 txt answers
+                //}
             }
         }
     pthread_mutex_unlock(&resolve_mutex);