# HG changeset patch # User Carl Byington # Date 1493159013 25200 # Node ID 16451edcb962ebf8236b587ce1bb33880fcda489 # Parent d5a1ed33d3aed1528fd88570fd99cc3474447eb8 spf code now handles mx,exists,ptr tags, multiple A records, %{i} macro diff -r d5a1ed33d3ae -r 16451edcb962 src/context.cpp --- a/src/context.cpp Tue Apr 25 14:48:19 2017 -0700 +++ b/src/context.cpp Tue Apr 25 15:23:33 2017 -0700 @@ -1193,7 +1193,7 @@ else if (strncmp(p, "exists:", 7) == 0) { p += 7; char buf[maxlen]; - uint32_t ipy = ntohl(dns_interface(*priv, p, ns_t_a, false, NULL, buf, maxlen)); + dns_interface(*priv, p, ns_t_a, false, NULL, buf, maxlen); uint32_t *a = (uint32_t *)buf; if (a[0]) { log(priv->queueid, "match exists:%s", p); @@ -1203,15 +1203,15 @@ else if (strncmp(p, "mx", 2) == 0) { const char *name = (p[2] == ':') ? p+2 : from; char buf[maxlen]; - uint32_t c = ntohl(dns_interface(*priv, name, ns_t_mx, false, NULL, buf, maxlen)); + dns_interface(*priv, name, ns_t_mx, false, NULL, buf, maxlen); char *b = buf; while (*b) { log(priv->queueid, "found mx %s", b); - char abuf[maxlen]; - uint32_t ipy = ntohl(dns_interface(*priv, b, ns_t_a, false, NULL, buf, maxlen)); + char buf[maxlen]; + dns_interface(*priv, b, ns_t_a, false, NULL, buf, maxlen); uint32_t *a = (uint32_t *)buf; size_t c = a[0]; - for (size_t i=1; i++; i<=c) { + for (size_t i=1; i<=c; i++) { ipy = ntohl(a[i]); if (ipy == ip) { log(priv->queueid, "match mx:%s", name); @@ -1227,7 +1227,7 @@ uint32_t ipy = ntohl(dns_interface(*priv, name, ns_t_a, false, NULL, buf, maxlen)); uint32_t *a = (uint32_t *)buf; size_t c = a[0]; - for (size_t i=1; i++; i<=c) { + for (size_t i=1; i<=c; i++) { ipy = ntohl(a[i]); if (ipy == ip) { log(priv->queueid, "match a:%s", name); diff -r d5a1ed33d3ae -r 16451edcb962 src/dnsbl.cpp --- a/src/dnsbl.cpp Tue Apr 25 14:48:19 2017 -0700 +++ b/src/dnsbl.cpp Tue Apr 25 15:23:33 2017 -0700 @@ -435,11 +435,11 @@ while (ns_parserr(&handle, ns_s_an, rrnum++, &rr) == 0) { if (ns_rr_type(rr) == qtype) { char exchange[NS_MAXDNAME]; - size_t rdlen = ns_rr_rdlen(rr); + //size_t rdlen = ns_rr_rdlen(rr); + //const uint16_t pri = ns_get16(rdata); const unsigned char *rdata = ns_rr_rdata(rr); - const uint16_t pri = ns_get16(rdata); int len = dn_expand(glom.answer, glom.answer+glom.length, rdata + 2, exchange, sizeof(exchange)); - if ((len > 0) && (my_size > len+2)) { + if ((len > 0) && (my_size > (uint32_t)len+2)) { strcpy(my_answer, exchange); my_answer += len + 1; my_size -= len + 1; @@ -1733,7 +1733,7 @@ } CONTEXT *con = NULL; - const char *st; + const char *st = token_black; for (context_map::iterator i=priv.env_to.begin(); i!=priv.env_to.end(); i++) { const char *rcpt = (*i).first; CONTEXT *next = (*i).second;