summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d29ec8c)
raw | patch | inline | side by side (parent: d29ec8c)
author | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 2 Jun 2008 16:22:07 +0000 (16:22 +0000) | ||
committer | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 2 Jun 2008 16:22:07 +0000 (16:22 +0000) |
* under construction
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11154 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11154 594d385d-05f5-0310-b6e9-bd551577e9d8
index 223d486b15d0d248078303146fa000158a24fdb0..b4b992156e0a5a058d7c4138416c7240c92f135f 100644 (file)
"detect_hardware",
"confirm_new_key",
"ping",
- "new_ping",
"import_events", # no implementations
);
@EXPORT = @events;
}
-#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];
index 52a2515cad4c9229355277f353f3d70d3dcb40f1..68056c43c4338a43d236674ed62c03600ef17153 100644 (file)
$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);
index 1b21bc4f1c0cded41eb9bfbea8cd0741a30d5a4d..330d77fb5beb1bc482eb2005e6a554cf38834da4 100644 (file)
}
-#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/<header>gosa_/<header>/;
-#
-# 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];
my $res = $main::job_db->exec_statement($sql_statement);
}
- $out_msg =~ s/<header>gosa_/<header>/;
-
# 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/<target>\S+<\/target>/<target>$host_name<\/target>/;
- $out_msg =~ s/<source>\S+<\/source>/<source>$main::server_address<\/source>/;
- $out_msg =~ s/<\/xml>/<session_id>$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) {}
}
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<\/forward_to_gosa><\/xml>/;
+ }
my @answer_msg_l = ( $answer_msg );
return @answer_msg_l;
index b9e35f3b317c16d0e007fed5e5134b4b463ba161..580bc8e350b29276056b8d6fa54f90ac3f3926e5 100755 (executable)
--- a/gosa-si/tests/client.php
+++ b/gosa-si/tests/client.php
#$data = "<xml> <header>gosa_krb5_modify_principal</header> <target>00:01:6c:9d:b9:fa</target> <principal>horst@WIRECARD.SYS</principal><source>GOSA</source><max_life>666</max_life></xml>";
#$data = "<xml><header>gosa_query_fai_server</header><source>GOSA</source> <target>10.89.1.131:20081</target></xml>";
- #$data = "<xml> <header>gosa_new_ping</header> <target>00:0c:29:02:e5:4d</target> <source>GOSA</source> </xml>";
- $data = "<xml> <header>job_ping</header> <source>GOSA</source> <target>00:0c:29:02:e5:4d</target> <macaddress>00:0c:29:02:e5:4d</macaddress><timestamp>29700101000000</timestamp> </xml>";
+ $data = "<xml> <header>gosa_ping</header> <target>00:01:6c:9d:aa:16</target> <source>GOSA</source> </xml>";
+ #$data = "<xml> <header>job_ping</header> <source>GOSA</source> <target>00:0c:29:02:e5:4d</target> <macaddress>00:0c:29:02:e5:4d</macaddress><timestamp>29700101000000</timestamp> </xml>";
$sock->write($data);
$answer = "nothing";