From: Manuel Munz Date: Thu, 20 Jan 2011 02:06:48 +0000 (+0000) Subject: applications/wizard: Enforce hostname to conform to rfc952 and rfc1123 X-Git-Tag: 0.11.0~2345 X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=commitdiff_plain;h=94e437c2f02fbca2b88a0f9d7e12bfd1a4d864a4 applications/wizard: Enforce hostname to conform to rfc952 and rfc1123 --- diff --git a/applications/luci-ffwizard/luasrc/model/cbi/ffwizard.lua b/applications/luci-ffwizard/luasrc/model/cbi/ffwizard.lua index 0cc26e592..73ec41e7e 100644 --- a/applications/luci-ffwizard/luasrc/model/cbi/ffwizard.lua +++ b/applications/luci-ffwizard/luasrc/model/cbi/ffwizard.lua @@ -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