diff --git a/xCAT-server-2.0/lib/xcat/plugins/bind.pm b/xCAT-server-2.0/lib/xcat/plugins/bind.pm index 6c919ebb3..2347d9763 100755 --- a/xCAT-server-2.0/lib/xcat/plugins/bind.pm +++ b/xCAT-server-2.0/lib/xcat/plugins/bind.pm @@ -114,11 +114,17 @@ LINE: while(){ tr/A-Z/a-z/; # translate to lower case ($data,$comment) = split('#', $_, 2); - ($addr, $names) = split(' ', $data, 2); + ($addr, $names) = split(/[ ]+/, $data, 2); if ($names =~ /^[ \t]*$/) { #$callback->({data=>["Bad line in hosts file ignored '$_'"]}); next LINE; } + $addr =~ s/^[ ]*//; + $addr =~ s/[ ]*$//; + if ($addr !~ /^\d+\.\d+\.\d+\.\d+$/) { + $callback->({data=>["Ignoring $addr (not a valid IPv4 address)"]}); + next LINE; + } # Match -e args foreach $netpat (@elimpats){