diff src/context.cpp @ 400:b48ee4bc431b stable-6-0-52-3

handle a and a: elements in spf txt records
author Carl Byington <carl@five-ten-sg.com>
date Thu, 09 Mar 2017 08:54:29 -0800
parents 74baa26dbe7a
children 8f3a84de3739
line wrap: on
line diff
--- a/src/context.cpp	Tue Mar 07 16:54:20 2017 -0800
+++ b/src/context.cpp	Thu Mar 09 08:54:29 2017 -0800
@@ -1158,6 +1158,30 @@
             p = (b) ? b : e;
         }
         p = buf;
+        while ((p = strstr(p, " a:"))) {
+            p += 3;
+            char *b = strchr(p, ' ');
+            if (b) *b = '\0';
+            uint32_t ipy = ntohl(dns_interface(*priv, p, ns_t_a));
+            if (ipy == ip) {
+                log(priv->queueid, "match %s", p);
+                return true;
+            }
+            if (b) *b = ' ';
+            p = (b) ? b : e;
+        }
+        p = buf;
+        while ((p = strstr(p, " a"))) {
+            p += 2;
+            if ((*p == ' ') || (*p == '\0')) {
+                uint32_t ipy = ntohl(dns_interface(*priv, from, ns_t_a));
+                if (ipy == ip) {
+                    log(priv->queueid, "match %s", from);
+                    return true;
+                }
+            }
+        }
+        p = buf;
         while ((level < 5) && (p = strstr(p, " include:"))) {
             p += 9;
             char *b = strchr(p, ' ');