Mercurial > prosody-modules
comparison mod_firewall/mod_firewall.lua @ 2928:b0d92332b87f
mod_firewall: Add special case for $local zone (fixes #1090)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 12 Mar 2018 12:26:15 +0100 |
parents | 165d2877eeac |
children | 7e8f2e36419d |
comparison
equal
deleted
inserted
replaced
2927:7953b7dde6e7 | 2928:b0d92332b87f |
---|---|
181 global_code = [[local group_contains = module:depends("groups").group_contains]]; | 181 global_code = [[local group_contains = module:depends("groups").group_contains]]; |
182 }; | 182 }; |
183 is_admin = { global_code = [[local is_admin = require "core.usermanager".is_admin;]]}; | 183 is_admin = { global_code = [[local is_admin = require "core.usermanager".is_admin;]]}; |
184 core_post_stanza = { global_code = [[local core_post_stanza = prosody.core_post_stanza;]] }; | 184 core_post_stanza = { global_code = [[local core_post_stanza = prosody.core_post_stanza;]] }; |
185 zone = { global_code = function (zone) | 185 zone = { global_code = function (zone) |
186 assert(idsafe(zone), "Invalid zone name: "..zone); | 186 local var = zone; |
187 return ("local zone_%s = zones[%q] or {};"):format(zone, zone); | 187 if var == "$local" then |
188 var = "_local"; -- See #1090 | |
189 else | |
190 assert(idsafe(var), "Invalid zone name: "..zone); | |
191 end | |
192 return ("local zone_%s = zones[%q] or {};"):format(var, zone); | |
188 end }; | 193 end }; |
189 date_time = { global_code = [[local os_date = os.date]]; local_code = [[local current_date_time = os_date("*t");]] }; | 194 date_time = { global_code = [[local os_date = os.date]]; local_code = [[local current_date_time = os_date("*t");]] }; |
190 time = { local_code = function (what) | 195 time = { local_code = function (what) |
191 local defs = {}; | 196 local defs = {}; |
192 for field in what:gmatch("%a+") do | 197 for field in what:gmatch("%a+") do |