diff src/context.cpp @ 362:bcfbffe254ed

check whitelisted dkim signers before dkim_from restrictions
author Carl Byington <carl@five-ten-sg.com>
date Mon, 16 Jan 2017 12:38:44 -0800
parents 17f21fcd44a8
children fd145e9a3df0
line wrap: on
line diff
--- a/src/context.cpp	Mon Jan 16 11:17:16 2017 -0800
+++ b/src/context.cpp	Mon Jan 16 12:38:44 2017 -0800
@@ -1123,6 +1123,16 @@
 
 const char *CONTEXT::acceptable_content(recorder &memory, int score, int bulk, const char *queueid, string_set &signers, const char *from, string& msg) {
     DKIMP dk = find_dkim_from(from);
+
+    for (string_set::iterator s=signers.begin(); s!=signers.end(); s++) {
+        const char *st = find_dkim_signer(*s);
+        // signed by a white listed signer
+        if (st == token_white) {
+            log(queueid, "whitelisted dkim signer %s", *s);
+            return token_white;
+        }
+    }
+
     if (dk) {
         const char *st = dk->action;
         for (string_set::iterator s=signers.begin(); s!=signers.end(); s++) {
@@ -1154,15 +1164,6 @@
 
     for (string_set::iterator s=signers.begin(); s!=signers.end(); s++) {
         const char *st = find_dkim_signer(*s);
-        // signed by a white listed signer
-        if (st == token_white) {
-            log(queueid, "whitelisted dkim signer %s", *s);
-            return token_white;
-        }
-    }
-
-    for (string_set::iterator s=signers.begin(); s!=signers.end(); s++) {
-        const char *st = find_dkim_signer(*s);
         // signed by a black listed signer
         if (st == token_black) {
             char buf[maxlen];