comparison mod_firewall/conditions.lib.lua @ 2073:de15606f3669

mod_firewall: Verify that JID part exists before attempting to call method
author Kim Alvefur <zash@zash.se>
date Fri, 11 Mar 2016 18:18:04 +0100
parents eda5c54dfa30
children 86427261e3c4
comparison
equal deleted inserted replaced
2072:eda5c54dfa30 2073:de15606f3669
31 if pattern:find("^<.*>$") then 31 if pattern:find("^<.*>$") then
32 pattern = pattern:match("^<(.*)>$"); 32 pattern = pattern:match("^<(.*)>$");
33 else 33 else
34 pattern = pattern:gsub("%p", "%%%0"):gsub("%%(%p)", wildcard_equivs); 34 pattern = pattern:gsub("%p", "%%%0"):gsub("%%(%p)", wildcard_equivs);
35 end 35 end
36 return ("%s:match(%q)"):format(part, "^"..pattern.."$"); 36 return ("(%s and %s:match(%q))"):format(part, part, "^"..pattern.."$");
37 else 37 else
38 return ("%s == %q"):format(part, match); 38 return ("%s == %q"):format(part, match);
39 end 39 end
40 end 40 end
41 41