summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4380768)
raw | patch | inline | side by side (parent: 4380768)
author | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 19 May 2008 10:51:05 +0000 (10:51 +0000) | ||
committer | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 19 May 2008 10:51:05 +0000 (10:51 +0000) |
* under construction
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10949 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10949 594d385d-05f5-0310-b6e9-bd551577e9d8
index 3e96edf461178f9a69630b7f15f58d32f2398035..b48fe22a362d764fadf8fb83ce2a1b41b4e3a8ec 100755 (executable)
foreach my $server (@tmp_servers) {
unshift(@foreign_server_list, $server);
}
+# eliminate duplicate entries
+@foreign_server_list = &del_doubles(@foreign_server_list);
+
my $all_foreign_server = join(", ", @foreign_server_list);
daemon_log("0 INFO: found foreign server in config file and DNS: $all_foreign_server", 5);
print STDERR "foreign_server: $foreign_server\n";
my %data= ('known_clients' => "",
'key' => "",
- );
+ );
my $foreign_server_msg = &build_msg('new_server', $server_address, $foreign_server, \%data);
my $error = &send_msg_to_target($foreign_server_msg, $foreign_server, $foreign_server_key, "new_server", 0);
if ($error != 0 ) {
index 0202e824ffecf2df3b4a32899cfef80c7687b3d1..56f0d61780e9137ecc0617805dbf02ce2099d984 100644 (file)
my ($gosa_ip, $gosa_mac_address, $gosa_port, $gosa_passwd, $network_interface);
my ($job_queue_timeout, $job_queue_file_name);
-my $gosa_server;
-my $event_hash;
-
my %cfg_defaults = (
"server" => {
"ip" => [\$server_ip, "0.0.0.0"],
#y $gosa_cipher = &create_ciphering($gosa_passwd);
my $xml = new XML::Simple();
+# import local events
+my ($error, $result, $event_hash) = &import_events($event_dir);
+if ($error == 0) {
+ foreach my $log_line (@$result) {
+ &main::daemon_log("0 INFO: GosaPackages - $log_line", 5);
+ }
+} else {
+ foreach my $log_line (@$result) {
+ &main::daemon_log("0 ERROR: GosaPackages - $log_line", 1);
+ }
+}
-# import events
-&import_events();
## FUNCTIONS #################################################################
}
-sub import_events {
- if (not -e $event_dir) {
- &main::daemon_log("G ERROR: cannot find directory or directory is not readable: $event_dir", 1);
- }
- opendir (DIR, $event_dir) or die "ERROR while loading gosa-si-events from directory $event_dir : $!\n";
-
- while (defined (my $event = readdir (DIR))) {
- if( $event eq "." || $event eq ".." ) { next; }
- 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("G ERROR: import of event module '$event' failed", 1);
- &main::daemon_log("$@", 1);
- next;
- }
-
- $event =~ /(\S*?).pm$/;
- my $event_module = $1;
- my $events_l = eval( $1."::get_events()") ;
- foreach my $event_name (@{$events_l}) {
- $event_hash->{$event_name} = $event_module;
- }
- my $events_string = join( ", ", @{$events_l});
- &main::daemon_log("G DEBUG: GosaPackages from '$1' imported events $events_string", 8);
- }
-}
+#sub import_events {
+# if (not -e $event_dir) {
+# &main::daemon_log("G ERROR: cannot find directory or directory is not readable: $event_dir", 1);
+# }
+# opendir (DIR, $event_dir) or die "ERROR while loading gosa-si-events from directory $event_dir : $!\n";
+#
+# while (defined (my $event = readdir (DIR))) {
+# if( $event eq "." || $event eq ".." ) { next; }
+# 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("G ERROR: import of event module '$event' failed", 1);
+# &main::daemon_log("$@", 1);
+# next;
+# }
+#
+# $event =~ /(\S*?).pm$/;
+# my $event_module = $1;
+# my $events_l = eval( $1."::get_events()") ;
+# foreach my $event_name (@{$events_l}) {
+# $event_hash->{$event_name} = $event_module;
+# }
+# my $events_string = join( ", ", @{$events_l});
+# &main::daemon_log("G DEBUG: GosaPackages from '$1' imported events $events_string", 8);
+# }
+#}
#=== FUNCTION ================================================================
index c9b6f865ed6d0f774d24f9fdf180c8adf5d32449..41e02ac61853196e222d68f8f73b97799e1bc314 100644 (file)
"get_server_addresses",
"get_logged_in_users",
"import_events",
+ "del_doubles",
);
@EXPORT = @functions;
use strict;
return;
}
-
+sub del_doubles {
+ my %all;
+ $all{$_}=0 for @_;
+ return (keys %all);
+}
#=== FUNCTION ================================================================
sub import_events {
- my ($event_dir)= @_;
+ my ($event_dir) = @_;
+ my $event_hash;
my $error = 0;
my @result = ();
-
if (not -e $event_dir) {
$error++;
push(@result, "cannot find directory or directory is not readable: $event_dir");
if ($error == 0) {
while (defined (my $event = readdir (DIR))) {
if( $event eq "." || $event eq ".." ) { next; }
- if ($event ne "server_server_com.pm") { next; }
# try to import event module
eval{ require $event; };
}
}
- return ($error, \@result);
+ return ($error, \@result, $event_hash);
}
index 39c26cf448f4360355389b831550a444d95e9116..5e6fdeebbebb40249bdd3492b5a05f59b0e9e749 100644 (file)
my ($server_ip, $server_port, $SIPackages_key, $max_clients, $ldap_uri, $ldap_base, $ldap_admin_dn, $ldap_admin_password, $server_interface);
my ($bus_activ, $bus_key, $bus_ip, $bus_port);
my $server;
-my $event_hash;
my $network_interface;
my $no_bus;
my (@ldap_cfg, @pam_cfg, @nss_cfg, $goto_admin, $goto_secret);
$network_interface= &get_interface_for_ip($server_ip);
$main::server_mac_address= &get_mac($network_interface);
-&import_events();
+
+# import local events
+my ($error, $result, $event_hash) = &import_events($event_dir);
+if ($error == 0) {
+ foreach my $log_line (@$result) {
+ &main::daemon_log("0 INFO: SIPackages - $log_line", 5);
+ }
+} else {
+ foreach my $log_line (@$result) {
+ &main::daemon_log("0 ERROR: SIPackages - $log_line", 1);
+ }
+
+}
# Unit tag can be defined in config
if((not defined($main::gosa_unit_tag)) || length($main::gosa_unit_tag) == 0) {
my $ldap_handle = &main::get_ldap_handle();
if( defined($ldap_handle) ) {
- &main::daemon_log("INFO: Searching for servers gosaUnitTag with mac address $main::server_mac_address",5);
+ &main::daemon_log("0 INFO: Searching for servers gosaUnitTag with mac address $main::server_mac_address",5);
# Perform search for Unit Tag
$mesg = $ldap_handle->search(
base => $ldap_base,
my $unit_tag= $entry->get_value("gosaUnitTag");
$main::ldap_server_dn= $mesg->entry(0)->dn;
if(defined($unit_tag) && length($unit_tag) > 0) {
- &main::daemon_log("INFO: Detected gosaUnitTag $unit_tag for creating entries", 5);
+ &main::daemon_log("0 INFO: Detected gosaUnitTag $unit_tag for creating entries", 5);
$main::gosa_unit_tag= $unit_tag;
}
} else {
# Perform another search for Unit Tag
my $hostname= `hostname -f`;
chomp($hostname);
- &main::daemon_log("INFO: Searching for servers gosaUnitTag with hostname $hostname",5);
+ &main::daemon_log("0 INFO: Searching for servers gosaUnitTag with hostname $hostname",5);
$mesg = $ldap_handle->search(
base => $ldap_base,
scope => 'sub',
@@ -105,14 +116,14 @@ if((not defined($main::gosa_unit_tag)) || length($main::gosa_unit_tag) == 0) {
my $unit_tag= $entry->get_value("gosaUnitTag");
$main::ldap_server_dn= $mesg->entry(0)->dn;
if(defined($unit_tag) && length($unit_tag) > 0) {
- &main::daemon_log("INFO: Detected gosaUnitTag $unit_tag for creating entries", 5);
+ &main::daemon_log("0 INFO: Detected gosaUnitTag $unit_tag for creating entries", 5);
$main::gosa_unit_tag= $unit_tag;
}
} else {
# Perform another search for Unit Tag
$hostname= `hostname -s`;
chomp($hostname);
- &main::daemon_log("INFO: Searching for servers gosaUnitTag with hostname $hostname",5);
+ &main::daemon_log("0 INFO: Searching for servers gosaUnitTag with hostname $hostname",5);
$mesg = $ldap_handle->search(
base => $ldap_base,
scope => 'sub',
@@ -128,12 +139,12 @@ if((not defined($main::gosa_unit_tag)) || length($main::gosa_unit_tag) == 0) {
$main::gosa_unit_tag= $unit_tag;
}
} else {
- &main::daemon_log("WARNING: No gosaUnitTag detected. Not using gosaUnitTag", 3);
+ &main::daemon_log("0 WARNING: No gosaUnitTag detected. Not using gosaUnitTag", 3);
}
}
}
} else {
- &main::daemon_log("INFO: Using gosaUnitTag from config-file: $main::gosa_unit_tag",5);
+ &main::daemon_log("0 INFO: Using gosaUnitTag from config-file: $main::gosa_unit_tag",5);
}
}
}
-sub import_events {
- if (not -e $event_dir) {
- &main::daemon_log("S ERROR: cannot find directory or directory is not readable: $event_dir", 1);
- }
- opendir (DIR, $event_dir) or die "ERROR while loading gosa-si-events from directory $event_dir : $!\n";
-
- while (defined (my $event = readdir (DIR))) {
- if( $event eq "." || $event eq ".." ) { next; }
- if( $event eq "gosaTriggered.pm" ) { next; } # only GOsa specific events
-
- eval{ require $event; };
- if( $@ ) {
- &main::daemon_log("S ERROR: import of event module '$event' failed", 1);
- &main::daemon_log("$@", 8);
- next;
- }
- $event =~ /(\S*?).pm$/;
- my $event_module = $1;
- my $events_l = eval( $1."::get_events()") ;
- foreach my $event_name (@{$events_l}) {
- $event_hash->{$event_name} = $event_module;
- }
- my $events_string = join( ", ", @{$events_l});
- &main::daemon_log("S DEBUG: SIPackages imported events $events_string", 8);
- }
-}
+# outcommented from rettenbe: moved to GosaSupportDaemon.pm
+#sub import_events {
+# if (not -e $event_dir) {
+# &main::daemon_log("S ERROR: cannot find directory or directory is not readable: $event_dir", 1);
+# }
+# opendir (DIR, $event_dir) or die "ERROR while loading gosa-si-events from directory $event_dir : $!\n";
+#
+# while (defined (my $event = readdir (DIR))) {
+# if( $event eq "." || $event eq ".." ) { next; }
+# if( $event eq "gosaTriggered.pm" ) { next; } # only GOsa specific events
+#
+# eval{ require $event; };
+# if( $@ ) {
+# &main::daemon_log("S ERROR: import of event module '$event' failed", 1);
+# &main::daemon_log("$@", 8);
+# next;
+# }
+#
+# $event =~ /(\S*?).pm$/;
+# my $event_module = $1;
+# my $events_l = eval( $1."::get_events()") ;
+# foreach my $event_name (@{$events_l}) {
+# $event_hash->{$event_name} = $event_module;
+# }
+# my $events_string = join( ", ", @{$events_l});
+# &main::daemon_log("S DEBUG: SIPackages imported events $events_string", 8);
+# }
+#}
#=== FUNCTION ================================================================
index 6c4f27583bb01652caf6b0c34bbbfa070bd3700c..4a4ddf643ab742be8707e5f679eb4802b18e5b50 100644 (file)
### START #####################################################################
-# read configfile and import variables
-#&read_configfile();
+# import local events
+my ($error, $result, $event_hash) = &import_events($event_dir);
+if ($error == 0) {
+ foreach my $log_line (@$result) {
+ &main::daemon_log("0 INFO: ServerPackages - $log_line", 5);
+ }
+} else {
+ foreach my $log_line (@$result) {
+ &main::daemon_log("0 ERROR: ServerPackages - $log_line", 1);
+ }
+}
+
+### FUNCTIONS #####################################################################
sub get_module_info {
- my @info = ($server_address,
- $SIPackages_key,
- );
+ my @info = ($main::server_address,
+ );
return \@info;
}
index bd44acbe5eeb3cd89b1722ce3a59b3690faaa378..5b4145f51e4e21a23ad08ec37011da2c2bad3a03 100755 (executable)
--- a/gosa-si/tests/client.php
+++ b/gosa-si/tests/client.php
#$data = "<xml> <header>gosa_trigger_action_reboot</header> <target>00:01:6c:9d:b9:fa</target> <source>GOSA</source> </xml>";
#$data = "<xml> <header>job_trigger_action_reinstall</header> <source>GOSA</source> <target>00:01:6c:9d:b9:fa</target> <macaddress>00:01:6c:9d:b9:fa</macaddress> <timestamp>19700101000000</timestamp> </xml>";
#$data = "<xml> <header>job_trigger_action_instant_update</header> <target>00:01:6c:9d:b9:fa</target> <source>GOSA</source> <timestamp>19700101000000</timestamp> </xml>";
- #$data = "<xml> <header>gosa_ping</header> <target>00:01:6c:9d:b9:fa</target> <source>GOSA</source> </xml>";
+ $data = "<xml> <header>gosa_new_ping</header> <target>00:01:6c:9d:b9:fa</target> <source>GOSA</source> </xml>";
# get_login_usr_for_client
###########
# messaging
-
+ #$data = "<xml> <header>gosa_send_user_msg</header> <target>GOSA</target> <source>GOSA</source> <subject>".base64_encode("eine wichtige nachricht")."</subject> <from>admin</from> <to>polle</to> <to>rettenbe</to> <delivery_time>20130101235959</delivery_time> <message>".base64_encode("kaffeepause")."</message> </xml>";
#$data = "<xml> <header>gosa_send_user_msg</header> <target>GOSA</target> <source>GOSA</source> <subject>".base64_encode("eine wichtige nachricht")."</subject> <from>admin</from> <to>polle</to> <to>rettenbe</to> <delivery_time>20130101235959</delivery_time> <message>".base64_encode("kaffeepause")."</message> </xml>";
################
#########
# Kerberos test query
-# $data = "<xml> <header>gosa_krb5_create_principal</header> <target>00:01:6c:9d:aa:16</target> <principal>horst@WIRECARD.SYS</principal><source>GOSA</source><max_life>666</max_life></xml>";
- $data = "<xml> <header>gosa_krb5_modify_principal</header> <target>00:01:6c:9d:aa:16</target> <principal>horst@WIRECARD.SYS</principal><source>GOSA</source><max_life>666</max_life></xml>";
+ #$data = "<xml> <header>gosa_krb5_create_principal</header> <target>00:01:6c:9d:aa:16</target> <principal>horst@WIRECARD.SYS</principal><source>GOSA</source><max_life>666</max_life></xml>";
+ #$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>";
$sock->write($data);
$answer = "nothing";