mirror of
				https://github.com/xcat2/xcat-core.git
				synced 2025-10-31 03:12:30 +00:00 
			
		
		
		
	fix issue 1553 makedns failed when input invalid hostname into /etc/hosts
This commit is contained in:
		| @@ -423,6 +423,8 @@ sub process_request { | ||||
|         my $names; | ||||
|         my @hosts; | ||||
|         my %nodehash; | ||||
|         my @eachhost; | ||||
|         my $invalid; | ||||
|  | ||||
|         foreach (@contents) { | ||||
|             chomp;            #no newline | ||||
| @@ -440,6 +442,18 @@ sub process_request { | ||||
|                 next; | ||||
|             } | ||||
|  | ||||
|             @eachhost = split(/ /,$names); | ||||
|             foreach my $hname (@eachhost) { | ||||
|                 unless ($hname !~ /^\.[a-z0-9]+/i) { | ||||
|                     xCAT::SvrUtils::sendmsg(":Ignoring line $_ in /etc/hosts, names  $names start with . ", $callback); | ||||
|                     $invalid = $names; | ||||
|                     last; | ||||
|                 } | ||||
|             } | ||||
|             if ($invalid) { | ||||
|                 next; | ||||
|             } | ||||
|  | ||||
|             my ($host, $ip) = xCAT::NetworkUtils->gethostnameandip($addr); | ||||
|             push @hosts, $host; | ||||
|             $nodehash{$addr}{names} = $names; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user