From 3977d62bbf8a9f5e391b3f461f656da6d02c1290 Mon Sep 17 00:00:00 2001 From: Andrew Lewis Date: Sun, 8 Feb 2015 15:55:28 +0200 Subject: [PATCH] Make settings work as documented --- src/plugins/lua/settings.lua | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/src/plugins/lua/settings.lua b/src/plugins/lua/settings.lua index 01c266a3f..a219370e2 100644 --- a/src/plugins/lua/settings.lua +++ b/src/plugins/lua/settings.lua @@ -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 -- 2.39.5