changeset 327:51846836ec92

allow multiple dkim signers in authentication results
author Carl Byington <carl@five-ten-sg.com>
date Sun, 18 Dec 2016 17:19:50 -0800
parents 5e4b5540c8cc
children b4f766947202
files src/dnsbl.cpp
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/dnsbl.cpp	Sun Dec 18 16:51:33 2016 -0800
+++ b/src/dnsbl.cpp	Sun Dec 18 17:19:50 2016 -0800
@@ -1472,14 +1472,19 @@
             if (priv.dkim_ok) {
                 const int nmatch = 2;
                 regmatch_t match[nmatch];
+                int offset = 0;
                 while (true) {
-                    if (0 == regexec(&dkim_pattern, msg, nmatch, match, 0)) {
+                    if (0 == regexec(&dkim_pattern, msg+offset, nmatch, match, 0)) {
                         int s1 = match[1].rm_so;    // domain
                         int e1 = match[1].rm_eo;
                         if (s1 != -1) {
-                            msg[e1] = '\0';
-                            priv.dkim_signers.insert(strdup(msg+s1));
+                            char save = msg[offset+e1];
+                            msg[offset+e1] = '\0';
+                            priv.dkim_signers.insert(strdup(msg+offset+s1));
+                            msg[offset+e1] = save;
+                            offset += e1 + 1;
                         }
+                        else break;
                     }
                     else break;
                 }
@@ -1860,7 +1865,7 @@
     }
 
     // setup dkim signature detection
-    if (regcomp(&dkim_pattern, " dkim=pass .* header.d=([^ ]+) ", REG_ICASE | REG_EXTENDED)) {
+    if (regcomp(&dkim_pattern, " dkim=pass .[0-9]*-bit key. header.d=([^ ]+) ", REG_ICASE | REG_EXTENDED)) {
         printf("cannot compile regex pattern to find dkim signatures\n");
         exit(3);
     }