comparison mod_firewall/mod_firewall.lua @ 4582:cc20493018f6

mod_firewall: Allow underscores in definition names
author Matthew Wild <mwild1@gmail.com>
date Sat, 05 Jun 2021 16:22:22 +0100
parents 7e8f2e36419d
children 4e8fa75cc678
comparison
equal deleted inserted replaced
4581:3e2e708fd18b 4582:cc20493018f6
370 elseif chain_info.type ~= "event" then 370 elseif chain_info.type ~= "event" then
371 return nil, errmsg("Only event chains supported at the moment"); 371 return nil, errmsg("Only event chains supported at the moment");
372 end 372 end
373 ruleset[chain] = ruleset[chain] or {}; 373 ruleset[chain] = ruleset[chain] or {};
374 elseif not(state) and line:sub(1,1) == "%" then -- Definition (zone, limit, etc.) 374 elseif not(state) and line:sub(1,1) == "%" then -- Definition (zone, limit, etc.)
375 local what, name = line:match("^%%%s*(%w+) +([^ :]+)"); 375 local what, name = line:match("^%%%s*([%w_]+) +([^ :]+)");
376 if not definition_handlers[what] then 376 if not definition_handlers[what] then
377 return nil, errmsg("Definition of unknown object: "..what); 377 return nil, errmsg("Definition of unknown object: "..what);
378 elseif not name or not idsafe(name) then 378 elseif not name or not idsafe(name) then
379 return nil, errmsg("Invalid "..what.." name"); 379 return nil, errmsg("Invalid "..what.." name");
380 end 380 end