diff src/dnsbl.cpp @ 333:89574f8a2f64

log regexec error extracting domain from header
author Carl Byington <carl@five-ten-sg.com>
date Mon, 19 Dec 2016 17:11:39 -0800
parents 9800776436b9
children a4f2fda72422
line wrap: on
line diff
--- a/src/dnsbl.cpp	Mon Dec 19 16:35:49 2016 -0800
+++ b/src/dnsbl.cpp	Mon Dec 19 17:11:39 2016 -0800
@@ -1503,7 +1503,8 @@
     if ((priv.header_count > 2) && (strcasecmp(headerf, "from"))) {
         const int nmatch = 2;
         regmatch_t match[nmatch];
-        if (0 == regexec(&from_pattern, msg, nmatch, match, 0)) {
+        int err = regexec(&from_pattern, msg, nmatch, match, 0);
+        if (err == 0) {
             int s1 = match[1].rm_so;    // domain
             int e1 = match[1].rm_eo;
             if (s1 != -1) {
@@ -1511,6 +1512,11 @@
                 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