Code

new function: GOsa can trigger new ldap config supply to client
authorrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 22 Feb 2008 09:04:18 +0000 (09:04 +0000)
committerrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 22 Feb 2008 09:04:18 +0000 (09:04 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9052 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-si/client/events/corefunctions.pm
gosa-si/gosa-si-server
gosa-si/modules/GosaPackages.pm
gosa-si/modules/SIPackages.pm
gosa-si/server/events/gosaTriggered.pm
gosa-si/server/events/siTriggered.pm
gosa-si/tests/client.php

index 72031d64998b3873684c2d63c12997ecd9859d98..3a8d24502f45232fbb8b1cebda2685eb1dd45fa0 100644 (file)
@@ -1,7 +1,17 @@
 package corefunctions;
 use Exporter;
 @ISA = qw(Exporter);
-my @events = qw(get_events registered new_ldap_config new_key generate_hw_digest detect_hardware confirm_new_key ping import_events);
+my @events = (
+    "get_events",
+    "registered",
+    "new_ldap_config",
+    "new_key",
+    "generate_hw_digest",
+    "detect_hardware",
+    "confirm_new_key",
+    "ping",
+    "import_events",
+    );
 @EXPORT = @events;
 
 use strict;
@@ -270,6 +280,7 @@ sub new_ldap_config {
 
 }
 
+
 sub new_key {
     # my ($msg_hash) = @_ ;
     my $new_server_key = &main::create_passwd();
index 2ffe6f7d09343c5489ac5f60ecc1caffc768d24a..91a627c56dd2aaf2f599ef3ced5fd7c152565fc6 100755 (executable)
@@ -785,7 +785,7 @@ sub send_msg_to_target {
     # opensocket
     my $socket = &open_socket($address);
     if( !$socket ) {
-        daemon_log("cannot send ".$header."msg to $address , host not reachable", 1);
+        daemon_log("ERROR: cannot send ".$header."msg to $address , host not reachable", 1);
         $error++;
     }
     
@@ -793,7 +793,7 @@ sub send_msg_to_target {
         # send xml msg
         print $socket $crypted_msg."\n";
 
-        daemon_log("send ".$header."msg to $address", 1);
+        daemon_log("INFO: send ".$header."msg to $address", 5);
         daemon_log("message:\n$msg", 8);
         
     }
@@ -850,7 +850,6 @@ sub send_msg_to_target {
             }
         }
     }
-
     return $error; 
 }
 
index 14c5209aeff674a366cb23b7991f6274eda6e196..b3b6e2d847059315af60db588fa386f4485aa3af 100644 (file)
@@ -229,12 +229,13 @@ sub import_events {
 
     while (defined (my $event = readdir (DIR))) {
         if( $event eq "." || $event eq ".." ) { next; }   
-        if( $event eq "siTriggered.pm" ) { next; }      # only SI specific events
+        if( $event eq "siTriggered.pm" ) { next; }      # SI specific events not needed in GosaPackages.pm
+        if( $event eq "clMessages.pm" ) { next; }                    # SI specific events not needed in GosaPackages.pm
 
         eval{ require $event; };
         if( $@ ) {
-            &main::daemon_log("import of event module '$event' failed", 1);
-            &main::daemon_log("$@", 8);
+            &main::daemon_log("ERROR: import of event module '$event' failed", 1);
+            &main::daemon_log("$@", 1);
             next;
         }
 
index f00ffbd577feaaeb9bd259022bde844459964743..933aade81f73963a07374e957e6f6490175cf823 100644 (file)
@@ -758,7 +758,7 @@ sub who_has_i_do {
 sub new_ldap_config {
        my ($address) = @_ ;
 
-       my $sql_statement= "SELECT * FROM known_clients WHERE hostname='$address'";
+       my $sql_statement= "SELECT * FROM known_clients WHERE hostname='$address' OR macaddress='$address'";
        my $res = $main::known_clients_db->select_dbentry( $sql_statement );
 
        # check hit
@@ -767,6 +767,7 @@ sub new_ldap_config {
                &main::daemon_log("ERROR: more or no hit found in known_clients_db by query by '$address'", 1);
        }
 
+    $address = $res->{1}->{hostname};
        my $macaddress = $res->{1}->{macaddress};
        my $hostkey = $res->{1}->{hostkey};
 
index 7273673aea107ffda616335ee28d67cc47dc4553..d243faf6b0519d64f5475a80163807759c48f4a1 100644 (file)
@@ -4,7 +4,7 @@ use Exporter;
 my @events = (
     "get_events", 
     "gen_smb_hash",
-    "reload_ldap_config",
+    "trigger_reload_ldap_config",
     "ping",
     "network_completition",
     "set_activated_for_installation",
@@ -111,12 +111,14 @@ sub detect_hardware {
 }
 
 
-sub reload_ldap_config {
+sub trigger_reload_ldap_config {
     my ($msg, $msg_hash) = @_ ;
     my $target = @{$msg_hash->{target}}[0];
 
+    my $out_hash = &create_xml_hash("reload_ldap_config", $main::server_address, $main::server_address, $target);
+    my $out_msg = &create_xml_string($out_hash);
     my @out_msg_l;
-    push(@out_msg_l, &new_ldap_config($target));
+    push(@out_msg_l, $out_msg);
     return @out_msg_l;
 }
 
index 92f7670f0f22a7c427ba906497060fa368df6b3f..dba8993cfb2498f59e3794a991152ce016cabea9 100644 (file)
@@ -5,6 +5,7 @@ my @events = (
     "got_ping",
     "detected_hardware",
     "trigger_wake",
+    "reload_ldap_config",
     );
 @EXPORT = @events;
 
@@ -62,6 +63,18 @@ sub read_configfile {
     }
 }
 
+
+sub reload_ldap_config {
+    my ($msg, $msg_hash, $session_id) = @_;
+    my $header = @{$msg_hash->{header}}[0];
+    my $target = @{$msg_hash->{$header}}[0];
+
+    my $out_msg = &SIPackages::new_ldap_config($target);
+    my @out_msg_l = ( $out_msg );
+    return @out_msg_l;
+}
+
+
 sub got_ping {
     my ($msg, $msg_hash, $session_id) = @_;
 
index 02efe6cb9300101e12c9155e96fc21e63a464108..75aeedbcece4f2dc94685362bf4616d3c420a055 100755 (executable)
@@ -27,10 +27,10 @@ if($sock->connected()){
 #$data = "<xml> <header>gosa_gen_smb_hash</header> <source>GOSA</source><target>GOSA</target><password>tester</password></xml>";
 
 # Reload ldap config
-$data = "<xml> <header>gosa_reload_ldap_config</header> <source>GOSA</source><target>00:1B:77:04:8A:6C</target></xml>";
+$data = "<xml> <header>gosa_trigger_reload_ldap_config</header> <source>GOSA</source><target>00:01:6c:9d:b9:fa</target></xml>";
 
 # update  
-$data = "<xml> <header>gosa_update_status_jobdb_entry</header> <source>GOSA</source><target>GOSA</target><where><clause><phrase> <macaddress>00:01:6c:9d:b9:fa</macaddress></phrase></clause> </where> <update><timestamp>23450101000000</timestamp><result>XXXXXXXXXXXXXXx</result></update></xml>";
+#$data = "<xml> <header>gosa_update_status_jobdb_entry</header> <source>GOSA</source><target>GOSA</target><where><clause><phrase> <macaddress>00:01:6c:9d:b9:fa</macaddress></phrase></clause> </where> <update><timestamp>23450101000000</timestamp><result>XXXXXXXXXXXXXXx</result></update></xml>";
 #$data = "<xml> <header>gosa_update_status_jobdb_entry</header> <source>GOSA</source><target>GOSA</target><where><clause><phrase> <status>waiting</status></phrase></clause> </where> <update><status>processing</status> <result>update</result></update></xml>";
 
 # query