Fix a bug for hostname validation, merge into 2.8 branch

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.8@15108 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
leiaibj 2013-02-08 01:57:33 +00:00
parent 86042cc1f4
commit 1616e26c94

View File

@ -2186,12 +2186,17 @@ sub isValidMAC
sub isValidHostname
{
my ($class, $hostname) = @_;
if ($hostname =~ /^[a-z0-9][\-a-z0-9]+[a-z0-9]$/){
return 1;
if ($hostname =~ /^[a-z0-9]/){
if ($hostname =~ /[a-z0-9]$/){
if ($hostname =~ /[\-a-z0-9]+/){
return 1;
}
}
}
return 0;
}
#-------------------------------------------------------------------------------
=head3 isValidFQDN