From a317750b8a698e35a5690309633b51332bf42d03 Mon Sep 17 00:00:00 2001 From: rettenbe Date: Wed, 26 Mar 2008 11:18:26 +0000 Subject: [PATCH] bugfix: bind to ldap git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9988 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-si/gosa-si-server | 12 +++++++----- gosa-si/server/events/logHandling.pm | 27 ++++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server index cb759af22..3522b8fb6 100755 --- a/gosa-si/gosa-si-server +++ b/gosa-si/gosa-si-server @@ -965,8 +965,10 @@ sub _start { my ($kernel) = $_[KERNEL]; &trigger_db_loop($kernel); $global_kernel = $kernel; - $kernel->yield('create_fai_server_db', $fai_server_tn ); - $kernel->yield('create_fai_release_db', $fai_release_tn ); + ################################# + # out commented, just for testing + #$kernel->yield('create_fai_server_db', $fai_server_tn ); + #$kernel->yield('create_fai_release_db', $fai_release_tn ); $kernel->sig(USR1 => "sig_handler"); } @@ -1300,6 +1302,7 @@ sub get_ldap_handle { if ($session_id == 0) { daemon_log("$session_id DEBUG: get_ldap_handle invoked without a session_id, create a new ldap_handle", 7); $ldap_handle = Net::LDAP->new( $ldap_uri ); + $ldap_handle->bind($ldap_admin_dn, password => $ldap_admin_password); } else { my $session_reference = $global_kernel->ID_id_to_session($session_id); @@ -1315,12 +1318,11 @@ sub get_ldap_handle { if (not exists $heap->{ldap_handle}) { # create new ldap handle $ldap_handle = Net::LDAP->new( $ldap_uri ); + $ldap_handle->bind($ldap_admin_dn, password => $ldap_admin_password); # add ldap handle to heap $heap->{ldap_handle} = $ldap_handle; } } - - return $ldap_handle; } @@ -1349,7 +1351,7 @@ sub change_fai_state { my $state= $mapActions{ $st }; - my $ldap_handle = get_ldap_handle($session_id); + my $ldap_handle = &get_ldap_handle($session_id); if( defined($ldap_handle) ) { # Build search filter for hosts diff --git a/gosa-si/server/events/logHandling.pm b/gosa-si/server/events/logHandling.pm index 8b9af8f74..07e8c1adf 100644 --- a/gosa-si/server/events/logHandling.pm +++ b/gosa-si/server/events/logHandling.pm @@ -40,6 +40,8 @@ sub show_log_by_date { my $source = @{$msg_hash->{source}}[0]; my $date_l = $msg_hash->{date}; + #my $date_h; + #map {$date_h->{$_}++} @{$date_l}; if (not -d $main::client_fai_log_dir) { &main::daemon_log("$session_id ERROR: client fai log directory '$main::client_fai_log_dir' do not exist", 1); @@ -53,7 +55,30 @@ sub show_log_by_date { opendir(DIR, $main::client_fai_log_dir); my @avail_macs = readdir(DIR); closedir(DIR); - + + # goto each mac directory + # select all dates which matches the parameter dates + my %res_h; + foreach my $date ($date_l) { + + # go through all mac addresses + foreach my $mac (@avail_macs) { + my $mac_dir = File::Spec->catdir($main::client_fai_log_dir, $mac); + + opendir(DIR, $mac_dir); + my @avail_dates = readdir(DIR); + closedir(DIR); + + # go through all dates of one mac address + foreach my $avail_date (@avail_dates) { + if ($avail_date =~ /$date/i) { + if (not exists %res) + push(%res_h->{$mac}, ); + } + } + } + } + } sub show_log_by_mac { -- 2.30.2