From: rettenbe Date: Wed, 6 Feb 2008 16:38:14 +0000 (+0000) Subject: gosa-si-server accepts mac addresses as answer_targets for own registered clients X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=c55122d55ce6301720600c9aa66cec2a79b35886;p=gosa.git gosa-si-server accepts mac addresses as answer_targets for own registered clients git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8761 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server index a3764f4cd..e03855aa6 100755 --- a/gosa-si/gosa-si-server +++ b/gosa-si/gosa-si-server @@ -744,10 +744,6 @@ sub client_input { # for each answer in answer list foreach my $answer ( @{$answer_l} ) { - - - - my $error = 0; # check answer if gosa-si envelope conform my $answer_hash = $xml->XMLin($answer, ForceArray=>1); @@ -802,12 +798,29 @@ sub client_input { &send_msg_to_target($answer, $host_name, $host_key, $answer_header); } } + elsif( $answer_target =~ /([0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2})/ ) { + daemon_log("target is mac address '$answer_target', looking for host in known_clients", 3); + my $sql_statement = "SELECT * FROM known_clients WHERE macaddress='$answer_target'"; + my $query_res = $known_clients_db->select_dbentry( $sql_statement ); + my $found_ip_flag = 0; + while( my ($hit_num, $hit) = each %{ $query_res } ) { + my $host_name = $hit->{hostname}; + my $host_key = $hit->{hostkey}; + $answer =~ s/$answer_target/$host_name/g; + daemon_log("found host '$host_name', assoziated to '$answer_target'", 3); + &send_msg_to_target($answer, $host_name, $host_key, $answer_header); + $found_ip_flag++ ; + } + if( $found_ip_flag == 0) { + daemon_log("ERROR: no host found in known_clients with mac address '$answer_target', answer could not be send", 1); + } + } else { # answer is for one specific host # get encrypt_key my $encrypt_key = &get_encrypt_key($answer_target); if( !$encrypt_key ) { - daemon_log("ERROR: no encrypt key found for answer target '$answer_target'", 1); + daemon_log("ERROR: no encrypt key found in known_clients or known_server for target '$answer_target'", 1); daemon_log("\n$answer", 8); next; } diff --git a/gosa-si/tests/client.php b/gosa-si/tests/client.php index 879de7550..ff33d537d 100755 --- a/gosa-si/tests/client.php +++ b/gosa-si/tests/client.php @@ -45,7 +45,7 @@ if($sock->connected()){ #$data = "
gosa_reinstall
10.89.1.31:20083 10.89.1.31:20081
"; #$data = "
gosa_softupdate
10.89.1.31:20083 10.89.1.31:20081
"; #$data = "
gosa_halt
10.89.1.31:20083 10.89.1.31:20081
"; -$data = "
gosa_new_key_for_client
10.89.1.31:20083 10.89.1.31:20081
"; +$data = "
gosa_new_key_for_client
00:01:6c:9d:b9:fa 10.89.1.31:20081
"; $sock->write($data);