]> source.dussan.org Git - rspamd.git/commitdiff
Make settings work as documented 143/head
authorAndrew Lewis <nerf@judo.za.org>
Sun, 8 Feb 2015 13:55:28 +0000 (15:55 +0200)
committerAndrew Lewis <nerf@judo.za.org>
Sun, 8 Feb 2015 17:21:18 +0000 (19:21 +0200)
src/plugins/lua/settings.lua

index 01c266a3fc139d1e2a3f0227b878caed636d2c47..a219370e2115e9e0aaa2917a2318b99ecc6820b5 100644 (file)
@@ -73,40 +73,64 @@ local function check_settings(task)
   local function check_specific_setting(name, rule, ip, from, rcpt, user)
     local res = false
 
-    if rule['ip'] and ip then
+    if rule['ip'] then
+      if not ip then
+        return nil
+      end
       for _, i in ipairs(rule['ip']) do
         res = check_ip_setting(i, ip)
         if res then
           break
         end
       end
+      if not res then
+        return nil
+      end
     end
 
-    if not res and rule['from'] and from then
+    if rule['from'] then
+      if not from then
+        return nil
+      end
       for _, i in ipairs(rule['from']) do
         res = check_addr_setting(i, from)
         if res then
           break
         end
       end
+      if not res then
+        return nil
+      end
     end
 
-    if not res and rule['rcpt'] and rcpt then
+    if rule['rcpt'] then
+      if not rcpt then
+        return nil
+      end
       for _, i in ipairs(rule['rcpt']) do
         res = check_addr_setting(i, rcpt)
         if res then
           break
         end
       end
+      if not res then
+        return nil
+      end
     end
 
-    if not res and rule['user'] and user then
+    if rule['user'] then
+      if not user then
+        return nil
+      end
       for _, i in ipairs(rule['user']) do
         res = check_addr_setting(i, user)
         if res then
           break
         end
       end
+      if not res then
+        return nil
+      end
     end
 
     if res then