firewall: validate max length of zone name
[oweals/luci.git] / applications / luci-app-firewall / luasrc / model / cbi / firewall / zone-details.lua
index 3eb95ebb57a916b334c80ced09a568192d1fb465..46b3744403087998a13ee65af7616c8be63b96d4 100644 (file)
@@ -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")),