summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f0bfb56)
raw | patch | inline | side by side (parent: f0bfb56)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 12 Feb 2008 13:12:40 +0000 (13:12 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 12 Feb 2008 13:12:40 +0000 (13:12 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8860 594d385d-05f5-0310-b6e9-bd551577e9d8
index a3e62fbf9fae027d869ec7d6238d375fc3156b3c..783de064115cd0535fd967b341afbe12b5eec720 100644 (file)
my $target = @{$msg_hash->{'target'}}[0];
my $source = @{$msg_hash->{'source'}}[0];
- my $Datei = "/tmp/set_activated_for_installation";
+ my $Datei = "/tmp/activated";
open(DATEI, ">$Datei");
print DATEI "$msg\n";
close DATEI;
diff --git a/gosa-si/gosa-si-client b/gosa-si/gosa-si-client
index de1958c1513acc9424394313d144ddc1ce809535..86bae5f7f0f28dfd127c59481307dc1116a0a6fc 100755 (executable)
--- a/gosa-si/gosa-si-client
+++ b/gosa-si/gosa-si-client
my $event_hash;
my @servers;
my $gotoHardwareChecksum;
+$verbose= 1;
# globalise variables which are used in imported events
our $cfg_file;
diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server
index 584d349873ac0bb027c690548e3b754176d27493..bdc990bea7e824f875f57849b8837f195610ba37 100755 (executable)
--- a/gosa-si/gosa-si-server
+++ b/gosa-si/gosa-si-server
# for each answer in answer list
foreach my $answer ( @{$answer_l} ) {
- my $error = 0;
- # check answer if gosa-si envelope conform
- if(defined($answer)) {
- my $answer_hash = $xml->XMLin($answer, ForceArray=>1);
- $answer_header = @{$answer_hash->{'header'}}[0];
- @answer_target_l = @{$answer_hash->{'target'}};
- $answer_source = @{$answer_hash->{'source'}}[0];
- if( !$answer_header ) {
- daemon_log('ERROR: module answer is not gosa-si envelope conform: no header', 1);
- daemon_log("\n$answer", 8);
- $error++;
- }
- if( 0 == length @answer_target_l ) {
- daemon_log('ERROR: module answer is not gosa-si envelope conform: no targets', 1);
- daemon_log("\n$answer", 8);
- $error++;
+ my $error = 0;
+ # check answer if gosa-si envelope conform
+ if(defined($answer)) {
+ my $answer_hash = $xml->XMLin($answer, ForceArray=>1);
+ $answer_header = @{$answer_hash->{'header'}}[0];
+ @answer_target_l = @{$answer_hash->{'target'}};
+ $answer_source = @{$answer_hash->{'source'}}[0];
+ if( !$answer_header ) {
+ daemon_log('ERROR: module answer is not gosa-si envelope conform: no header', 1);
+ daemon_log("\n$answer", 8);
+ $error++;
+ }
+ if( 0 == length @answer_target_l ) {
+ daemon_log('ERROR: module answer is not gosa-si envelope conform: no targets', 1);
+ daemon_log("\n$answer", 8);
+ $error++;
+ }
+ if( !$answer_source ) {
+ daemon_log('ERROR: module answer is not gosa-si envelope conform: no source', 1);
+ daemon_log("\n$answer", 8);
+ $error++;
+ }
+
+ if( $error != 0 ) {
+ next;
+ }
+ }
+
+ # deliver msg to all targets
+ foreach my $answer_target ( @answer_target_l ) {
+ if( $answer_target eq "*" ) {
+ # answer is for all clients
+ my $sql_statement= "SELECT * FROM known_clients";
+ my $query_res = $known_clients_db->select_dbentry( $sql_statement );
+ while( my ($hit_num, $hit) = each %{ $query_res } ) {
+ my $host_name = $hit->{hostname};
+ my $host_key = $hit->{hostkey};
+ &send_msg_to_target($answer, $host_name, $host_key, $answer_header);
}
- if( !$answer_source ) {
- daemon_log('ERROR: module answer is not gosa-si envelope conform: no source', 1);
- daemon_log("\n$answer", 8);
- $error++;
+ }
+ elsif( $answer_target eq "GOSA" ) {
+ # answer is for GOSA and has to returned to connected client
+ my $gosa_answer = &encrypt_msg($answer, $GosaPackages_key);
+ $client_answer = $gosa_answer;
+ }
+ elsif( $answer_target eq "KNOWN_SERVER" ) {
+ # answer is for all server in known_server
+ my $sql_statement= "SELECT * FROM known_server";
+ my $query_res = $known_server_db->select_dbentry( $sql_statement );
+ while( my ($hit_num, $hit) = each %{ $query_res } ) {
+ my $host_name = $hit->{hostname};
+ my $host_key = $hit->{hostkey};
+ $answer =~ s/KNOWN_SERVER/$host_name/g;
+ &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})$/i ) {
+ 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("WARNING: no host found in known_clients with mac address '$answer_target', forward msg to bus", 1);
+ my $sql_statement = "SELECT * FROM known_server WHERE hostname='$bus_address'";
+ my $query_res = $known_server_db->select_dbentry( $sql_statement );
+ while( my ($hit_num, $hit) = each %{ $query_res } ) {
+ my $bus_address = $hit->{hostname};
+ my $bus_key = $hit->{hostkey};
+ &send_msg_to_target($answer, $bus_address, $bus_key, $answer_header);
+ last;
+ }
- if( $error != 0 ) {
+ }
+ } else {
+ # ... answer is for one specific host
+
+ # get encrypt_key
+ my $encrypt_key = &get_encrypt_key($answer_target);
+ if( not defined $encrypt_key ) {
+ # unknown target, forward msg to bus
+ daemon_log("WARNING: unknown target '$answer_target', forward msg to bus", 3);
+ my $sql_statement = "SELECT * FROM known_server WHERE hostname='$bus_address'";
+ my $query_res = $known_server_db->select_dbentry( $sql_statement );
+ my $bus_key = $query_res->{1}->{hostkey};
+ &send_msg_to_target($answer, $bus_address, $bus_key, $answer_header);
next;
}
+ # send_msg
+ &send_msg_to_target($answer, $answer_target, $encrypt_key, $answer_header);
}
-
- # deliver msg to all targets
- foreach my $answer_target ( @answer_target_l ) {
- if( $answer_target eq "*" ) {
- # answer is for all clients
- my $sql_statement= "SELECT * FROM known_clients";
- my $query_res = $known_clients_db->select_dbentry( $sql_statement );
- while( my ($hit_num, $hit) = each %{ $query_res } ) {
- my $host_name = $hit->{hostname};
- my $host_key = $hit->{hostkey};
- &send_msg_to_target($answer, $host_name, $host_key, $answer_header);
- }
- }
- elsif( $answer_target eq "GOSA" ) {
- # answer is for GOSA and has to returned to connected client
- my $gosa_answer = &encrypt_msg($answer, $GosaPackages_key);
- $client_answer = $gosa_answer;
- }
- elsif( $answer_target eq "KNOWN_SERVER" ) {
- # answer is for all server in known_server
- my $sql_statement= "SELECT * FROM known_server";
- my $query_res = $known_server_db->select_dbentry( $sql_statement );
- while( my ($hit_num, $hit) = each %{ $query_res } ) {
- my $host_name = $hit->{hostname};
- my $host_key = $hit->{hostkey};
- $answer =~ s/KNOWN_SERVER/$host_name/g;
- &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})$/i ) {
- 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("WARNING: no host found in known_clients with mac address '$answer_target', forward msg to bus", 1);
- my $sql_statement = "SELECT * FROM known_server WHERE hostname='$bus_address'";
- my $query_res = $known_server_db->select_dbentry( $sql_statement );
- while( my ($hit_num, $hit) = each %{ $query_res } ) {
- my $bus_address = $hit->{hostname};
- my $bus_key = $hit->{hostkey};
- &send_msg_to_target($answer, $bus_address, $bus_key, $answer_header);
- last;
- }
-
- }
- }
- else {
- # answer is for one specific host
- # get encrypt_key
- my $encrypt_key = &get_encrypt_key($answer_target);
- if( not defined $encrypt_key ) {
- # unknown target, forward msg to bus
- daemon_log("WARNING: unknown target '$answer_target', forward msg to bus", 3);
- my $sql_statement = "SELECT * FROM known_server WHERE hostname='$bus_address'";
- my $query_res = $known_server_db->select_dbentry( $sql_statement );
- my $bus_key = $query_res->{1}->{hostkey};
- &send_msg_to_target($answer, $bus_address, $bus_key, $answer_header);
- next;
- }
- # send_msg
- &send_msg_to_target($answer, $answer_target, $encrypt_key, $answer_header);
- }
- }
- }
+ }
+ }
}
if( $client_answer ) {
- $heap->{client}->put($client_answer);
+ $heap->{client}->put($client_answer);
}
return;
index b36c412e471b43f7ffbd4792ac1b979ddf7dc913..b9752be258381f4337b932ad0814b2a60fd71b42 100755 (executable)
}
-$db_name = "/var/lib/gosa-si/server.db";
+$db_name = "/var/lib/gosa-si/servers.db";
if (-e $db_name) {
print "\n############################################################\n";
# $db_name =~ /\/([^\/]*?)\.db$/;