Fix a bug for hostname valiation pattern

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@15107 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
leiaibj 2013-02-08 01:56:46 +00:00
parent 8efa7cdd67
commit 9c69cb198a

View File

@ -2186,8 +2186,12 @@ 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;
}