comparison src/context.cpp @ 397:d08da4b058e8

only ntohl() once during recursive spf txt processing
author Carl Byington <carl@five-ten-sg.com>
date Tue, 07 Mar 2017 16:49:49 -0800
parents a8cf6a3da907
children 74baa26dbe7a
comparison
equal deleted inserted replaced
396:c889524e92e4 397:d08da4b058e8
1123 } 1123 }
1124 1124
1125 1125
1126 bool CONTEXT::resolve_spf(const char *from, uint32_t ip, mlfiPriv *priv, int level) 1126 bool CONTEXT::resolve_spf(const char *from, uint32_t ip, mlfiPriv *priv, int level)
1127 { 1127 {
1128 ip = ntohl(ip); 1128 // ip is in host order
1129 char buf[maxlen]; 1129 char buf[maxlen];
1130 log(priv->queueid, "looking for %s txt record", from); 1130 log(priv->queueid, "looking for %s txt record", from);
1131 dns_interface(*priv, from, ns_t_txt, false, NULL, buf, maxlen); 1131 dns_interface(*priv, from, ns_t_txt, false, NULL, buf, maxlen);
1132 if (*buf) { 1132 if (*buf) {
1133 log(priv->queueid, "found txt record %s", buf); 1133 log(priv->queueid, "found txt record %s", buf);
1204 return token_black; 1204 return token_black;
1205 } 1205 }
1206 } 1206 }
1207 if (st == token_signed_white) { 1207 if (st == token_signed_white) {
1208 // not signed by a white signer, but maybe passes strong spf check 1208 // not signed by a white signer, but maybe passes strong spf check
1209 if (resolve_spf(from, priv->ip, priv)) { 1209 if (resolve_spf(from, ntohl(priv->ip), priv)) {
1210 log(queueid, "spf pass for %s rather than whitelisted dkim signer", from); 1210 log(queueid, "spf pass for %s rather than whitelisted dkim signer", from);
1211 return token_white; 1211 return token_white;
1212 } 1212 }
1213 } 1213 }
1214 if (st == token_require_signed) { 1214 if (st == token_require_signed) {