diff src/dnsbl.cpp @ 334:a4f2fda72422

missing ==0 testing for from header, we were scanning all the non-from headers
author Carl Byington <carl@five-ten-sg.com>
date Tue, 20 Dec 2016 09:20:15 -0800
parents 89574f8a2f64
children 354b15b8b263
line wrap: on
line diff
--- a/src/dnsbl.cpp	Mon Dec 19 17:11:39 2016 -0800
+++ b/src/dnsbl.cpp	Tue Dec 20 09:20:15 2016 -0800
@@ -1500,7 +1500,8 @@
         }
     }
 
-    if ((priv.header_count > 2) && (strcasecmp(headerf, "from"))) {
+    // only look at the first from header
+    if ((priv.header_count > 2) && (!priv.fromaddr) && (strcasecmp(headerf, "from") == 0)) {
         const int nmatch = 2;
         regmatch_t match[nmatch];
         int err = regexec(&from_pattern, msg, nmatch, match, 0);
@@ -1512,11 +1513,6 @@
                 priv.fromaddr = strdup(msg+s1);
             }
         }
-        else {
-            char buf[maxlen];
-            size_t n = regerror(err, &from_pattern, buf, maxlen);
-            my_syslog(&priv, buf);
-        }
     }
 
     // headers that avoid autowhitelisting