Software /
code /
prosody-modules
Comparison
mod_firewall/mod_firewall.lua @ 1325:b21236b6b8d8
Backed out changeset 853a382c9bd6
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 28 Feb 2014 15:37:55 +0100 |
parent | 1324:853a382c9bd6 |
child | 1343:7dbde05b48a9 |
comparison
equal
deleted
inserted
replaced
1324:853a382c9bd6 | 1325:b21236b6b8d8 |
---|---|
23 "presence/bare", "presence/full", "presence/host"; | 23 "presence/bare", "presence/full", "presence/host"; |
24 "iq/bare", "iq/full", "iq/host"; | 24 "iq/bare", "iq/full", "iq/host"; |
25 }; | 25 }; |
26 deliver_remote = { | 26 deliver_remote = { |
27 type = "event"; "route/remote"; | 27 type = "event"; "route/remote"; |
28 priority = 0.1; | |
29 }; | |
30 send_remote = { -- FIXME name | |
31 type = "filter"; "s2sout"; | |
32 priority = 0.1; | 28 priority = 0.1; |
33 }; | 29 }; |
34 }; | 30 }; |
35 | 31 |
36 local function idsafe(name) | 32 local function idsafe(name) |
374 local handler, err = compile_handler(handler_code, "mod_firewall::"..chain); | 370 local handler, err = compile_handler(handler_code, "mod_firewall::"..chain); |
375 if not handler then | 371 if not handler then |
376 module:log("error", "Compilation error for %s: %s", script, err); | 372 module:log("error", "Compilation error for %s: %s", script, err); |
377 else | 373 else |
378 local chain_definition = chains[chain]; | 374 local chain_definition = chains[chain]; |
379 if chain_definition then | 375 if chain_definition and chain_definition.type == "event" then |
380 if chain_definition.type == "event" then | 376 for _, event_name in ipairs(chain_definition) do |
381 for _, event_name in ipairs(chain_definition) do | 377 module:hook(event_name, handler, chain_definition.priority); |
382 module:hook(event_name, handler, chain_definition.priority); | |
383 end | |
384 elseif chain_definition.type == "filter" then | |
385 -- TODO | |
386 end | 378 end |
387 elseif not chain:match("^user/") then | 379 elseif not chain:match("^user/") then |
388 module:log("warn", "Unknown chain %q", chain); | 380 module:log("warn", "Unknown chain %q", chain); |
389 end | 381 end |
390 module:hook("firewall/chains/"..chain, handler); | 382 module:hook("firewall/chains/"..chain, handler); |