Software /
code /
prosody-modules
Diff
mod_firewall/mod_firewall.lua @ 1343:7dbde05b48a9
all the things: Remove trailing whitespace
author | Florian Zeitz <florob@babelmonkeys.de> |
---|---|
date | Tue, 11 Mar 2014 18:44:01 +0100 |
parent | 1325:b21236b6b8d8 |
child | 2070:2356114ff505 |
line wrap: on
line diff
--- a/mod_firewall/mod_firewall.lua Mon Mar 10 08:22:58 2014 +0000 +++ b/mod_firewall/mod_firewall.lua Tue Mar 11 18:44:01 2014 +0100 @@ -138,23 +138,23 @@ local function compile_firewall_rules(filename) local line_no = 0; - + local function errmsg(err) return "Error compiling "..filename.." on line "..line_no..": "..err; end - + local ruleset = { deliver = {}; }; local chain = "deliver"; -- Default chain local rule; - + local file, err = io.open(filename); if not file then return nil, err; end - + local state; -- nil -> "rules" -> "actions" -> nil -> ... - + local line_hold; for line in file:lines() do line = line:match("^%s*(.-)%s*$"); @@ -165,7 +165,7 @@ line_hold = (line_hold or "")..line:sub(1,-2); end line_no = line_no + 1; - + if line_hold or line:match("^[#;]") then -- No action; comment or partial line elseif line == "" then @@ -268,9 +268,9 @@ end end end - + -- Compile ruleset and return complete code - + local chain_handlers = {}; -- Loop through the chains in the parsed ruleset (e.g. incoming, outgoing) @@ -338,7 +338,7 @@ chain_handlers[chain_name] = code_string; end - + return chain_handlers; end @@ -362,7 +362,7 @@ for script in firewall_scripts do script = resolve_relative_path(prosody.paths.config, script); local chain_functions, err = compile_firewall_rules(script) - + if not chain_functions then module:log("error", "Error compiling %s: %s", script, err or "unknown error"); else