comparison src/context.cpp @ 416:7431e948b5c3

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:26:51 -0700
parents 16451edcb962
children d1976e04f5ba
comparison
equal deleted inserted replaced
415:16451edcb962 416:7431e948b5c3
1210 char buf[maxlen]; 1210 char buf[maxlen];
1211 dns_interface(*priv, b, ns_t_a, false, NULL, buf, maxlen); 1211 dns_interface(*priv, b, ns_t_a, false, NULL, buf, maxlen);
1212 uint32_t *a = (uint32_t *)buf; 1212 uint32_t *a = (uint32_t *)buf;
1213 size_t c = a[0]; 1213 size_t c = a[0];
1214 for (size_t i=1; i<=c; i++) { 1214 for (size_t i=1; i<=c; i++) {
1215 ipy = ntohl(a[i]); 1215 uint32_t ipy = ntohl(a[i]);
1216 if (ipy == ip) { 1216 if (ipy == ip) {
1217 log(priv->queueid, "match mx:%s", name); 1217 log(priv->queueid, "match mx:%s", name);
1218 return true; 1218 return true;
1219 } 1219 }
1220 } 1220 }
1222 } 1222 }
1223 } 1223 }
1224 else if (p[0] == 'a') { 1224 else if (p[0] == 'a') {
1225 const char *name = (p[1] == ':') ? p+2 : from; 1225 const char *name = (p[1] == ':') ? p+2 : from;
1226 char buf[maxlen]; 1226 char buf[maxlen];
1227 uint32_t ipy = ntohl(dns_interface(*priv, name, ns_t_a, false, NULL, buf, maxlen)); 1227 dns_interface(*priv, name, ns_t_a, false, NULL, buf, maxlen);
1228 uint32_t *a = (uint32_t *)buf; 1228 uint32_t *a = (uint32_t *)buf;
1229 size_t c = a[0]; 1229 size_t c = a[0];
1230 for (size_t i=1; i<=c; i++) { 1230 for (size_t i=1; i<=c; i++) {
1231 ipy = ntohl(a[i]); 1231 uint32_t ipy = ntohl(a[i]);
1232 if (ipy == ip) { 1232 if (ipy == ip) {
1233 log(priv->queueid, "match a:%s", name); 1233 log(priv->queueid, "match a:%s", name);
1234 return true; 1234 return true;
1235 } 1235 }
1236 } 1236 }