diff options
author | Christian Schoenebeck <christian.schoenebeck@gmail.com> | 2015-08-28 11:19:45 +0200 |
---|---|---|
committer | Christian Schoenebeck <christian.schoenebeck@gmail.com> | 2015-08-28 11:19:45 +0200 |
commit | c48fbfa992c9f3be4dafd5963918031f68ef46ae (patch) | |
tree | bdab9801f222847dfc88f559c2a5570db0b0fe8d | |
parent | 89763f901e5f3c27b0ab998e5332f21d04f8e25f (diff) | |
parent | 34e875b3d35fa1d4dde0a3ec662868213b710c55 (diff) |
Merge pull request #451 from hnyman/fw-zone-len
luci-app-firewall: validate zone name to enforce fw3 max. length
-rw-r--r-- | applications/luci-app-firewall/luasrc/model/cbi/firewall/zone-details.lua | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/applications/luci-app-firewall/luasrc/model/cbi/firewall/zone-details.lua b/applications/luci-app-firewall/luasrc/model/cbi/firewall/zone-details.lua index 3eb95ebb5..46b374440 100644 --- a/applications/luci-app-firewall/luasrc/model/cbi/firewall/zone-details.lua +++ b/applications/luci-app-firewall/luasrc/model/cbi/firewall/zone-details.lua @@ -76,6 +76,15 @@ function name.write(self, section, value) } end +function name.validate(self, value) + -- fw3 defines 14 as the maximum length of zone name + if #value > 14 then + return nil, translate("Zone name is too long") + else + return value + end +end + p = { s:taboption("general", ListValue, "input", translate("Input")), s:taboption("general", ListValue, "output", translate("Output")), |