Mercurial > prosody-modules
comparison mod_firewall/conditions.lib.lua @ 2521:66b81e144ded
mod_firewall: Fix CHECK LIST syntax check
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sun, 19 Feb 2017 22:24:21 +0000 |
parents | c6fd8975704b |
children | 44a71584521d |
comparison
equal
deleted
inserted
replaced
2520:c6fd8975704b | 2521:66b81e144ded |
---|---|
253 end | 253 end |
254 | 254 |
255 -- CHECK LIST: spammers contains $<@from> | 255 -- CHECK LIST: spammers contains $<@from> |
256 function condition_handlers.CHECK_LIST(list_condition) | 256 function condition_handlers.CHECK_LIST(list_condition) |
257 local list_name, expr = list_condition:match("(%S+) contains (.+)$"); | 257 local list_name, expr = list_condition:match("(%S+) contains (.+)$"); |
258 if not list_name and expr then | 258 if not (list_name and expr) then |
259 error("Error parsing list check, syntax: LISTNAME contains EXPRESSION"); | 259 error("Error parsing list check, syntax: LISTNAME contains EXPRESSION"); |
260 end | 260 end |
261 local meta_deps = {}; | 261 local meta_deps = {}; |
262 expr = meta(("%q"):format(expr), meta_deps); | 262 expr = meta(("%q"):format(expr), meta_deps); |
263 return ("list_%s:contains(%s) == true"):format(list_name, expr), { "list:"..list_name, unpack(meta_deps) }; | 263 return ("list_%s:contains(%s) == true"):format(list_name, expr), { "list:"..list_name, unpack(meta_deps) }; |