Software /
code /
prosody-modules
Comparison
mod_firewall/mod_firewall.lua @ 2404:9af2d36567a8
mod_firewall: Allow conditions to end with a question mark
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 02 Dec 2016 11:45:10 +0100 |
parent | 2402:2040330586e4 |
child | 2412:9159f9166893 |
comparison
equal
deleted
inserted
replaced
2403:f96bdfd81eba | 2404:9af2d36567a8 |
---|---|
303 state = "rules"; | 303 state = "rules"; |
304 rule = new_rule(ruleset, chain); | 304 rule = new_rule(ruleset, chain); |
305 end | 305 end |
306 -- Check standard modifiers for the condition (e.g. NOT) | 306 -- Check standard modifiers for the condition (e.g. NOT) |
307 local negated; | 307 local negated; |
308 local condition = line:match("^[^:=%.]*"); | 308 local condition = line:match("^[^:=%.?]*"); |
309 if condition:find("%f[%w]NOT%f[^%w]") then | 309 if condition:find("%f[%w]NOT%f[^%w]") then |
310 local s, e = condition:match("%f[%w]()NOT()%f[^%w]"); | 310 local s, e = condition:match("%f[%w]()NOT()%f[^%w]"); |
311 condition = (condition:sub(1,s-1)..condition:sub(e+1, -1)):match("^%s*(.-)%s*$"); | 311 condition = (condition:sub(1,s-1)..condition:sub(e+1, -1)):match("^%s*(.-)%s*$"); |
312 negated = true; | 312 negated = true; |
313 end | 313 end |