changeset 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 07b88307d90a
children 7fba7cc2150e
files src/context.cpp
diffstat 1 files changed, 10 insertions(+), 9 deletions(-) [+]
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];