From 4673798f4437104e94b6b96c327633fce3f0c409 Mon Sep 17 00:00:00 2001 From: rettenbe Date: Mon, 21 Jul 2008 13:25:39 +0000 Subject: [PATCH] * closes #303 * imported modules do not have to have the same password git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11734 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-si/gosa-si-server | 41 ++++++++++++++++++++++++------- gosa-si/modules/ServerPackages.pm | 2 +- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server index 250e0080b..0b41be35d 100755 --- a/gosa-si/gosa-si-server +++ b/gosa-si/gosa-si-server @@ -472,11 +472,36 @@ sub import_modules { close (DIR); } +#=== FUNCTION ================================================================ +# NAME: password_check +# PARAMETERS: nothing +# RETURNS: nothing +# DESCRIPTION: escalates an critical error if two modules exist which are avaialable by +# the same password +#=============================================================================== +sub password_check { + my $passwd_hash = {}; + while (my ($mod_name, $mod_info) = each %$known_modules) { + my $mod_passwd = @$mod_info[1]; + if (not defined $mod_passwd) { next; } + if (not exists $passwd_hash->{$mod_passwd}) { + $passwd_hash->{$mod_passwd} = $mod_name; + + # escalates critical error + } else { + &daemon_log("0 ERROR: two loaded modules do have the same password. Please modify the 'key'-parameter in config file"); + &daemon_log("0 ERROR: module='$mod_name' and module='".$passwd_hash->{$mod_passwd}."'"); + exit( -1 ); + } + } + +} + #=== FUNCTION ================================================================ # NAME: sig_int_handler # PARAMETERS: signal - string - signal arose from system -# RETURNS: noting +# RETURNS: nothing # DESCRIPTION: handels tasks to be done befor signal becomes active #=============================================================================== sub sig_int_handler { @@ -3007,6 +3032,12 @@ foreach my $foreign_server (@foreign_server_list) { } +# import all modules +&import_modules; +# check wether all modules are gosa-si valid passwd check +&password_check; + + POE::Component::Server::TCP->new( Alias => "TCP_SERVER", Port => $server_port, @@ -3058,14 +3089,6 @@ POE::Session->create( ); -# import all modules -&import_modules; - -# TODO -# check wether all modules are gosa-si valid passwd check - - - POE::Kernel->run(); exit; diff --git a/gosa-si/modules/ServerPackages.pm b/gosa-si/modules/ServerPackages.pm index ca0a1c8b7..d50cdea16 100644 --- a/gosa-si/modules/ServerPackages.pm +++ b/gosa-si/modules/ServerPackages.pm @@ -33,7 +33,7 @@ foreach my $log_line (@$result) { sub get_module_info { my @info = ($main::server_address, - $main::foreign_server_key, + $main::ServerPackages_key, ); return \@info; } -- 2.30.2