From: Manuel Munz Date: Sat, 12 Feb 2011 19:39:54 +0000 (+0000) Subject: web: Relax hostname validation for length X-Git-Tag: 0.11.0~2263 X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=commitdiff_plain;h=489279bb9a4d9984315bc0e0f97a56fea800bbcd;hp=4b0d5f9205de41d772e5f393123ceafed1c92c6c web: Relax hostname validation for length --- diff --git a/libs/web/htdocs/luci-static/resources/cbi.js b/libs/web/htdocs/luci-static/resources/cbi.js index d12d050a8..2bcfb8c3d 100644 --- a/libs/web/htdocs/luci-static/resources/cbi.js +++ b/libs/web/htdocs/luci-static/resources/cbi.js @@ -141,7 +141,7 @@ var cbi_validators = { }, 'hostname': function(v) - { if ( v.length <= 24 ) + { if ( v.length <= 253 ) return (v.match(/^[a-zA-Z0-9][a-zA-Z0-9\-.]*[a-zA-Z0-9]$/) != null); }, diff --git a/libs/web/luasrc/cbi/datatypes.lua b/libs/web/luasrc/cbi/datatypes.lua index d1ac8f405..58b54de6e 100644 --- a/libs/web/luasrc/cbi/datatypes.lua +++ b/libs/web/luasrc/cbi/datatypes.lua @@ -127,7 +127,7 @@ function macaddr(val) end function hostname(val) - if val and (#val < 25) and val.match(val, "^[a-zA-Z0-9][a-zA-Z0-9%-%.]*[a-zA-Z0-9]$") then + if val and (#val < 254) and val.match(val, "^[a-zA-Z0-9][a-zA-Z0-9%-%.]*[a-zA-Z0-9]$") then return true end return false