applications/wizard: Enforce hostname to conform to rfc952 and rfc1123
[project/luci.git] / applications / luci-ffwizard / luasrc / model / cbi / ffwizard.lua
index 0cc26e5928a105f58fca142fd73c06ec8a4fbaa1..73ec41e7e52d6e27c7fe89aedfa03e47d30b8acb 100644 (file)
@@ -121,9 +121,7 @@ function hostname.write(self, section, value)
        uci:save("freifunk")
 end
 function hostname.validate(self, value)
-       if (#value > 16) then
-               return
-       elseif (string.find(value, "[^%w%_%-]")) then
+       if (#value > 24) or string.find(value, "[^%w%.%-]") or string.find(string.sub(value, value:len()), "[%.%-]") or string.find(string.sub(value, 1), "[%.%-]") then
                return
        else
                return value