comparison 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
comparison
equal deleted inserted replaced
399:7e670e59d59d 400:b48ee4bc431b
1156 if (b) *b = ' '; 1156 if (b) *b = ' ';
1157 if (s) *s = '/'; 1157 if (s) *s = '/';
1158 p = (b) ? b : e; 1158 p = (b) ? b : e;
1159 } 1159 }
1160 p = buf; 1160 p = buf;
1161 while ((p = strstr(p, " a:"))) {
1162 p += 3;
1163 char *b = strchr(p, ' ');
1164 if (b) *b = '\0';
1165 uint32_t ipy = ntohl(dns_interface(*priv, p, ns_t_a));
1166 if (ipy == ip) {
1167 log(priv->queueid, "match %s", p);
1168 return true;
1169 }
1170 if (b) *b = ' ';
1171 p = (b) ? b : e;
1172 }
1173 p = buf;
1174 while ((p = strstr(p, " a"))) {
1175 p += 2;
1176 if ((*p == ' ') || (*p == '\0')) {
1177 uint32_t ipy = ntohl(dns_interface(*priv, from, ns_t_a));
1178 if (ipy == ip) {
1179 log(priv->queueid, "match %s", from);
1180 return true;
1181 }
1182 }
1183 }
1184 p = buf;
1161 while ((level < 5) && (p = strstr(p, " include:"))) { 1185 while ((level < 5) && (p = strstr(p, " include:"))) {
1162 p += 9; 1186 p += 9;
1163 char *b = strchr(p, ' '); 1187 char *b = strchr(p, ' ');
1164 if (b) *b = '\0'; 1188 if (b) *b = '\0';
1165 if (resolve_spf(p, ip, priv, level+1)) return true; 1189 if (resolve_spf(p, ip, priv, level+1)) return true;