From: rettenbe Date: Mon, 2 Jun 2008 16:22:07 +0000 (+0000) Subject: * gosa-si-server-nobus X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=bfafcc906518abfe47dfdbbe3bc550c00e0f8a69;p=gosa.git * gosa-si-server-nobus * under construction git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11154 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-si/client/events/corefunctions.pm b/gosa-si/client/events/corefunctions.pm index 223d486b1..b4b992156 100644 --- a/gosa-si/client/events/corefunctions.pm +++ b/gosa-si/client/events/corefunctions.pm @@ -10,7 +10,6 @@ my @events = ( "detect_hardware", "confirm_new_key", "ping", - "new_ping", "import_events", # no implementations ); @EXPORT = @events; @@ -475,23 +474,6 @@ sub detect_hardware { } -#sub ping { -# my ($msg, $msg_hash) = @_ ; -# my $header = @{$msg_hash->{'header'}}[0]; -# my $source = @{$msg_hash->{'source'}}[0]; -# my $target = @{$msg_hash->{'target'}}[0]; -# my $session_id = @{$msg_hash->{'session_id'}}[0]; -# -# -# # switch target and source and send msg back -# my $out_hash = &main::create_xml_hash("got_ping", $target, $source); -# &add_content2xml_hash($out_hash, "session_id", $session_id); -# my $out_msg = &main::create_xml_string($out_hash); -# return $out_msg; -# -#} - - sub ping { my ($msg, $msg_hash) = @_ ; my $header = @{$msg_hash->{'header'}}[0]; diff --git a/gosa-si/modules/ClientPackages.pm b/gosa-si/modules/ClientPackages.pm index 52a2515ca..68056c43c 100644 --- a/gosa-si/modules/ClientPackages.pm +++ b/gosa-si/modules/ClientPackages.pm @@ -626,24 +626,6 @@ sub here_i_am { $out_hash = &create_xml_hash("registered", $server_address, $source); - - -# # notify registered client to all other server -# if( $bus_activ eq "on") { -# # fetch actual bus key -# my $sql_statement= "SELECT * FROM known_server WHERE status='bus'"; -# my $query_res = $main::known_server_db->select_dbentry( $sql_statement ); -# my $hostkey = $query_res->{1}->{'hostkey'}; -# -# # send update msg to bus -# $out_hash = &create_xml_hash("new_client", $server_address, $bus_address, $source); -# &add_content2xml_hash($out_hash, "macaddress", $mac_address); -# &add_content2xml_hash($out_hash, "timestamp", $act_timestamp); -# my $new_client_out = &create_xml_string($out_hash); -# push(@out_msg_l, $new_client_out); -# &main::daemon_log("$session_id INFO: send bus msg that client '$source' has registered at server '$server_address'", 5); -# } - # give the new client his ldap config # Workaround: Send within the registration response, if the client will get an ldap config later my $new_ldap_config_out = &new_ldap_config($source, $session_id); diff --git a/gosa-si/server/events/gosaTriggered.pm b/gosa-si/server/events/gosaTriggered.pm index 1b21bc4f1..330d77fb5 100644 --- a/gosa-si/server/events/gosaTriggered.pm +++ b/gosa-si/server/events/gosaTriggered.pm @@ -340,23 +340,12 @@ sub get_client_for_login_usr { } -#sub ping { -# my ($msg, $msg_hash, $session_id) = @_ ; -# my $out_msg = $msg; -# my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0]; -# if( defined $jobdb_id) { -# my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; -# &main::daemon_log("$session_id DEBUG: $sql_statement", 7); -# my $res = $main::job_db->exec_statement($sql_statement); -# } -# -# $out_msg =~ s/
gosa_/
/; -# -# my @out_msg_l = ( $out_msg ); -# return @out_msg_l; -#} sub ping { my ($msg, $msg_hash, $session_id) = @_ ; + my $header = @{$msg_hash->{header}}[0]; + my $target = @{$msg_hash->{target}}[0]; + my $source = @{$msg_hash->{target}}[0]; + my ($sql, $res); my $out_msg = $msg; my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0]; @@ -366,20 +355,15 @@ sub ping { my $res = $main::job_db->exec_statement($sql_statement); } - $out_msg =~ s/
gosa_/
/; - # send message - my $header = @{$msg_hash->{header}}[0]; - my $target = @{$msg_hash->{target}}[0]; - $sql = "SELECT * FROM $main::known_clients_tn WHERE ((hostname='$target') || (macaddress LIKE '$target'))"; $res = $main::known_clients_db->exec_statement($sql); my $host_name = @{@$res[0]}[0]; - $out_msg =~ s/\S+<\/target>/$host_name<\/target>/; - $out_msg =~ s/\S+<\/source>/$main::server_address<\/source>/; - $out_msg =~ s/<\/xml>/$session_id<\/session_id><\/xml>/; my $host_key = @{@$res[0]}[2]; + my $client_hash = &create_xml_hash("ping", $main::server_address, $host_name); + &add_content2xml_hash($client_hash, 'session_id', $session_id); + my $out_msg = &create_xml_string($out_hash); my $error = &main::send_msg_to_target($out_msg, $host_name, $host_key, $header, $session_id); #if ($error != 0) {} @@ -395,11 +379,15 @@ sub ping { } my $answer_xml = @{@$res[0]}[3]; my %data = ( 'answer_xml' => 'bin noch da' ); - my $answer_msg = &build_msg("got_new_ping", "$main::server_address", "GOSA", \%data); + my $answer_msg = &build_msg("got_ping", $target, $source, \%data); $sql = "DELETE FROM $main::incoming_tn WHERE id=$message_id"; $res = $main::incoming_db->exec_statement($sql); + my $forward_to_gosa = @{$msg_hash->{'forward_to_gosa'}}[0]; + if (defined $forward_to_gosa) { + $answer_msg =~s/<\/xml>/$forward_to_gosa<\/forward_to_gosa><\/xml>/; + } my @answer_msg_l = ( $answer_msg ); return @answer_msg_l; diff --git a/gosa-si/tests/client.php b/gosa-si/tests/client.php index b9e35f3b3..580bc8e35 100755 --- a/gosa-si/tests/client.php +++ b/gosa-si/tests/client.php @@ -106,8 +106,8 @@ for($count = 1; $count <= $zahl; $count++) #$data = "
gosa_krb5_modify_principal
00:01:6c:9d:b9:fa horst@WIRECARD.SYSGOSA666
"; #$data = "
gosa_query_fai_server
GOSA 10.89.1.131:20081
"; - #$data = "
gosa_new_ping
00:0c:29:02:e5:4d GOSA
"; - $data = "
job_ping
GOSA 00:0c:29:02:e5:4d 00:0c:29:02:e5:4d29700101000000
"; + $data = "
gosa_ping
00:01:6c:9d:aa:16 GOSA
"; + #$data = "
job_ping
GOSA 00:0c:29:02:e5:4d 00:0c:29:02:e5:4d29700101000000
"; $sock->write($data); $answer = "nothing";