X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-si%2Fgosa-si-server;h=ada883ba08d8c225d9040d5cb39a4217c8586dd2;hb=6d4f9c12acf600c263f6350a2300bac383b967b8;hp=d73b3c7630b1b65a00ccb0a060de25ce07bba640;hpb=b8ffeb310daed11ceceb744d1b9c5999c1a32883;p=gosa.git diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server index d73b3c763..ada883ba0 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 { @@ -596,8 +621,8 @@ sub check_outgoing_xml_validity { } }; if($@) { - daemon_log("$session_id WARNING: outgoing msg is not gosa-si envelope conform: ", 5); - daemon_log("$@ ".(defined($msg) && length($msg)>0)?$msg:"Empty Message", 5); + daemon_log("$session_id ERROR: outgoing msg is not gosa-si envelope conform: ", 1); + daemon_log("$@ ".(defined($msg) && length($msg)>0)?$msg:"Empty Message", 1); $msg_hash = undef; } @@ -825,36 +850,6 @@ sub open_socket { } -# moved to GosaSupportDaemon: 03-06-2008: rettenbe -#=== FUNCTION ================================================================ -# NAME: get_ip -# PARAMETERS: interface name (i.e. eth0) -# RETURNS: (ip address) -# DESCRIPTION: Uses ioctl to get ip address directly from system. -#=============================================================================== -#sub get_ip { -# my $ifreq= shift; -# my $result= ""; -# my $SIOCGIFADDR= 0x8915; # man 2 ioctl_list -# my $proto= getprotobyname('ip'); -# -# socket SOCKET, PF_INET, SOCK_DGRAM, $proto -# or die "socket: $!"; -# -# if(ioctl SOCKET, $SIOCGIFADDR, $ifreq) { -# my ($if, $sin) = unpack 'a16 a16', $ifreq; -# my ($port, $addr) = sockaddr_in $sin; -# my $ip = inet_ntoa $addr; -# -# if ($ip && length($ip) > 0) { -# $result = $ip; -# } -# } -# -# return $result; -#} - - sub get_local_ip_for_remote_ip { my $remote_ip= shift; my $result="0.0.0.0"; @@ -1048,8 +1043,8 @@ sub msg_to_decrypt { if(( !$msg ) || ( !$msg_hash ) || ( !$module )){ # if an incoming msg could not be decrypted (maybe a wrong key), send client a ping. If the client # could not understand a msg from its server the client cause a re-registering process - daemon_log("$session_id INFO cannot understand incoming msg, send 'ping'-msg to all host with ip '".$heap->{remote_ip}. - "' to cause a re-registering of the client if necessary", 5); + daemon_log("$session_id WARNING cannot understand incoming msg, send 'ping'-msg to all host with ip '".$heap->{remote_ip}. + "' to cause a re-registering of the client if necessary", 3); my $sql_statement = "SELECT * FROM $main::known_clients_tn WHERE (hostname LIKE '".$heap->{'remote_ip'}."%')"; my $query_res = $known_clients_db->select_dbentry( $sql_statement ); while( my ($hit_num, $hit) = each %{ $query_res } ) { @@ -1306,6 +1301,7 @@ sub handle_task_done { sub process_task { no strict "refs"; + #CHECK: Not @_[...]? my ($session, $heap, $task) = @_; my $error = 0; my $answer_l; @@ -1481,6 +1477,7 @@ sub session_start { sub watch_for_done_jobs { + #CHECK: $heap for what? my ($kernel,$heap) = @_[KERNEL, HEAP]; my $sql_statement = "SELECT * FROM ".$job_queue_tn." WHERE ((status='done') AND (modified='0'))"; @@ -2044,9 +2041,9 @@ sub change_goto_state { sub run_recreate_packages_db { my ($kernel, $session, $heap) = @_[KERNEL, SESSION, HEAP]; my $session_id = $session->ID; - &main::daemon_log("$session_id INFO: Recreating FAI Packages DB ('$fai_release_tn', '$fai_server_tn', '$packages_list_tn')", 4); - $kernel->yield('create_fai_release_db'); - $kernel->yield('create_fai_server_db'); + &main::daemon_log("$session_id INFO: Recreating FAI Packages DB ('$fai_release_tn', '$fai_server_tn', '$packages_list_tn')", 5); + $kernel->yield('create_fai_release_db', $fai_release_tn); + $kernel->yield('create_fai_server_db', $fai_server_tn); return; } @@ -3035,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, @@ -3086,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;