diff src/context.cpp @ 415:16451edcb962

spf code now handles mx,exists,ptr tags, multiple A records, %{i} macro
author Carl Byington <carl@five-ten-sg.com>
date Tue, 25 Apr 2017 15:23:33 -0700
parents d5a1ed33d3ae
children 7431e948b5c3
line wrap: on
line diff
--- 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);