diff options
author | Manuel Munz <freifunk@somakoma.de> | 2011-02-12 11:09:13 +0000 |
---|---|---|
committer | Manuel Munz <freifunk@somakoma.de> | 2011-02-12 11:09:13 +0000 |
commit | 408a58f6f6b0d419bc6b81eb93f32c701e19118a (patch) | |
tree | 1f719c3aa68b99dd3768dedb499bf827d8afcb8f /libs/web/luasrc | |
parent | 2b72c2093fa76e94bc249cba52c9b5b8b207e06e (diff) |
web: Improve hostname validation
Diffstat (limited to 'libs/web/luasrc')
-rw-r--r-- | libs/web/luasrc/cbi/datatypes.lua | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/libs/web/luasrc/cbi/datatypes.lua b/libs/web/luasrc/cbi/datatypes.lua index 67cb63daf..d1ac8f405 100644 --- a/libs/web/luasrc/cbi/datatypes.lua +++ b/libs/web/luasrc/cbi/datatypes.lua @@ -127,10 +127,9 @@ function macaddr(val) end function hostname(val) - if val and val:match("[a-zA-Z0-9_][a-zA-Z0-9_%-%.]*") then - return true -- XXX: ToDo: need better solution + if val and (#val < 25) and val.match(val, "^[a-zA-Z0-9][a-zA-Z0-9%-%.]*[a-zA-Z0-9]$") then + return true end - return false end |