libs/web: relax validation for hostnames to allow names like _kerberos._udp.EXAMPLE.COM
This commit is contained in:
parent
9939dd2f72
commit
c802c941cb
2 changed files with 4 additions and 4 deletions
|
@ -148,8 +148,8 @@ var cbi_validators = {
|
||||||
'hostname': function()
|
'hostname': function()
|
||||||
{
|
{
|
||||||
if (this.length <= 253)
|
if (this.length <= 253)
|
||||||
return (this.match(/^[a-zA-Z]+$/) != null ||
|
return (this.match(/^[a-zA-Z0-9]+$/) != null ||
|
||||||
(this.match(/^[a-zA-Z0-9][a-zA-Z0-9\-.]*[a-zA-Z0-9]$/) &&
|
(this.match(/^[a-zA-Z0-9_][a-zA-Z0-9_\-.]*[a-zA-Z0-9]$/) &&
|
||||||
this.match(/[^0-9.]/)));
|
this.match(/[^0-9.]/)));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -179,8 +179,8 @@ end
|
||||||
|
|
||||||
function hostname(val)
|
function hostname(val)
|
||||||
if val and (#val < 254) and (
|
if val and (#val < 254) and (
|
||||||
val:match("^[a-zA-Z]+$") or
|
val:match("^[a-zA-Z_]+$") or
|
||||||
(val:match("^[a-zA-Z0-9][a-zA-Z0-9%-%.]*[a-zA-Z0-9]$") and
|
(val:match("^[a-zA-Z0-9_][a-zA-Z0-9_%-%.]*[a-zA-Z0-9]$") and
|
||||||
val:match("[^0-9%.]"))
|
val:match("[^0-9%.]"))
|
||||||
) then
|
) then
|
||||||
return true
|
return true
|
||||||
|
|
Loading…
Reference in a new issue