changeset 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 c889524e92e4
children 74baa26dbe7a
files dnsbl.spec.in src/context.cpp xml/dnsbl.in
diffstat 3 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/dnsbl.spec.in	Tue Mar 07 09:45:39 2017 -0800
+++ b/dnsbl.spec.in	Tue Mar 07 16:49:49 2017 -0800
@@ -3,7 +3,7 @@
 Summary:            Sendmail milter for spam control
 Name:               @PACKAGE@
 Version:            @VERSION@
-Release:            1%{?dist}
+Release:            2%{?dist}
 License:            GPLv3+
 Group:              System Environment/Daemons
 Source:             http://www.five-ten-sg.com/%{name}/packages/%{name}-%{version}.tar.gz
@@ -155,6 +155,9 @@
 
 
 %changelog
+* Tue Mar 07 2017 Carl Byington <carl@five-ten-sg.com> - 6.52-2
+- only ntohl() once during recursive spf txt processing.
+
 * Tue Mar 07 2017 Carl Byington <carl@five-ten-sg.com> - 6.52-1
 - document dkim/spf processing.
 
--- 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;
             }
--- a/xml/dnsbl.in	Tue Mar 07 09:45:39 2017 -0800
+++ b/xml/dnsbl.in	Tue Mar 07 16:49:49 2017 -0800
@@ -483,7 +483,7 @@
                 Otherwise, processing continues.
             </para>
             <para>
-                If any of the message signers is blacklisted, the message is rejected.
+                If any of the message signers are blacklisted, the message is rejected.
             </para>
             <para>
                 If content filtering is enabled for this body, the mail text is decoded