# HG changeset patch # User Carl Byington # Date 1488837674 28800 # Node ID 7b7066a51c33261976bf0ffe55ced5b67aa739d9 # Parent 5a88320a754793ecadc78dbaf0d95aac2599f1ec start parsing spf txt records diff -r 5a88320a7547 -r 7b7066a51c33 src/context.cpp --- a/src/context.cpp Mon Mar 06 12:30:35 2017 -0800 +++ b/src/context.cpp Mon Mar 06 14:01:14 2017 -0800 @@ -1126,10 +1126,10 @@ bool CONTEXT::resolve_spf(const char *from, uint32_t ip, mlfiPriv *priv, int level) { char buf[maxlen]; + log(priv->queueid, "looking for %s txt record", from); dns_interface(*priv, from, ns_t_txt, false, NULL, buf, maxlen); if (*buf) { - log(priv->queueid, "found txt record for %s", from); - log(priv->queueid, "found txt record value %s", buf); + log(priv->queueid, "found txt record %s", buf); char *p = buf; char *e = p + strlen(p); // point to trailing null while (p = strstr(p, " ip4:")) { diff -r 5a88320a7547 -r 7b7066a51c33 src/dnsbl.cpp --- 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);