diff --git a/xCAT-server/lib/xcat/plugins/ddns.pm b/xCAT-server/lib/xcat/plugins/ddns.pm index 266d15410..5f468b3e5 100755 --- a/xCAT-server/lib/xcat/plugins/ddns.pm +++ b/xCAT-server/lib/xcat/plugins/ddns.pm @@ -423,6 +423,8 @@ sub process_request { my $names; my @hosts; my %nodehash; + my @eachhost; + my $invalid; foreach (@contents) { chomp; #no newline @@ -439,6 +441,18 @@ sub process_request { xCAT::SvrUtils::sendmsg(":Ignoring line $_ in /etc/hosts, names $names contain invalid characters (valid characters include a through z, numbers and the '-', but not '_'", $callback); next; } + $invalid = ""; + @eachhost = split(/ /,$names); + foreach my $hname (@eachhost) { + if ($hname =~ /^\./) { + xCAT::SvrUtils::sendmsg(":Ignoring line $_ in /etc/hosts, name $hname start with . ", $callback); + $invalid = $names; + last; + } + } + if ($invalid) { + next; + } my ($host, $ip) = xCAT::NetworkUtils->gethostnameandip($addr); push @hosts, $host;