+
+ my $hostsSave = [];
+ my($hostsNew, $allHosts, $copyConf);
+ foreach my $entry ( @{$newConf->{Hosts}} ) {
+ next if ( $entry->{host} eq "" );
+ $allHosts->{$entry->{host}} = 1;
+ $allHosts->{$1} = 1 if ( $entry->{host} =~ /(.+?)\s*=/ );
+ }
+ foreach my $entry ( @{$newConf->{Hosts}} ) {
+ next if ( $entry->{host} eq ""
+ || defined($hostsNew->{$entry->{host}}) );
+ if ( $entry->{host} =~ /(.+?)\s*=\s*(.+)/ ) {
+ if ( defined($allHosts->{$2}) ) {
+ $entry->{host} = $1;
+ $copyConf->{$1} = $2;
+ } else {
+ my $fullHost = $entry->{host};
+ my $copyHost = $2;
+ $err .= eval("qq($Lang->{CfgEdit_Error_Copy_host_does_not_exist})");
+ }
+ }
+ push(@$hostsSave, $entry);
+ $hostsNew->{$entry->{host}} = $entry;
+ }
+ ($mesg, my $hostChange) = hostsDiffMesg($hostsNew);
+ $bpc->HostInfoWrite($hostsNew) if ( $hostChange );
+ foreach my $host ( keys(%$copyConf) ) {
+ #
+ # Currently host names are forced to lc when they
+ # are read from the hosts file. Therefore we need
+ # to force the from and to hosts to lc.
+ #
+ my $confData = $bpc->ConfigDataRead(lc($copyConf->{$host}));
+ my $fromHost = $copyConf->{$host};
+ $err .= $bpc->ConfigDataWrite(lc($host), $confData);
+ $mesg .= eval("qq($Lang->{CfgEdit_Log_Copy_host_config})");
+ }
+
+ delete($newConf->{Hosts});
+ $mesg .= configDiffMesg(undef, $mainConf, $newConf);