diff 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
line wrap: on
line diff
--- a/src/context.cpp	Tue Mar 07 09:45:39 2017 -0800
+++ b/src/context.cpp	Tue Mar 07 16:49:49 2017 -0800
@@ -1125,7 +1125,7 @@
 
 bool CONTEXT::resolve_spf(const char *from, uint32_t ip, mlfiPriv *priv, int level)
 {
-    ip = ntohl(ip);
+    // ip is in host order
     char buf[maxlen];
     log(priv->queueid, "looking for %s txt record", from);
     dns_interface(*priv, from, ns_t_txt, false, NULL, buf, maxlen);
@@ -1206,7 +1206,7 @@
         }
         if (st == token_signed_white) {
             // not signed by a white signer, but maybe passes strong spf check
-            if (resolve_spf(from, priv->ip, priv)) {
+            if (resolve_spf(from, ntohl(priv->ip), priv)) {
                 log(queueid, "spf pass for %s rather than whitelisted dkim signer", from);
                 return token_white;
             }