From: janw Date: Mon, 11 May 2009 15:05:30 +0000 (+0000) Subject: Add ou=incoming to ldap base if not exists at start. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=a671d057b8bb3d5a371a8f1dcb1e8a1291dab978;p=gosa.git Add ou=incoming to ldap base if not exists at start. Closes #630 git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13646 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-si/modules/ClientPackages.pm b/gosa-si/modules/ClientPackages.pm index 62662fa3b..4a83e1664 100644 --- a/gosa-si/modules/ClientPackages.pm +++ b/gosa-si/modules/ClientPackages.pm @@ -152,6 +152,31 @@ if((not defined($main::gosa_unit_tag)) || length($main::gosa_unit_tag) == 0) { my $server_address = "$server_ip:$server_port"; $main::server_address = $server_address; +{ + # Check if ou=incoming exists + # TODO: This should be transferred to a module init-function + my $ldap_handle = &main::get_ldap_handle(); + if( defined($ldap_handle) ) { + &main::daemon_log("0 DEBUG: Searching for ou=incoming container for new clients", 9); + # Perform search + my $mesg = $ldap_handle->search( + base => $ldap_base, + scope => 'one', + filter => "(&(ou=incoming)(objectClass=organizationalUnit))" + ); + if(not defined($mesg->count) or $mesg->count == 0) { + my $incomingou = Net::LDAP::Entry->new(); + $incomingou->dn('ou=incoming,'.$ldap_base); + $incomingou->add('objectClass' => 'organizationalUnit'); + my $result = $incomingou->update($ldap_handle); + if($result != 0) { + &main::daemon_log("0 ERROR: Problem adding ou=incoming: '".$result->errorMessage."'!", 1); + } + } + } + &main::release_ldap_handle($ldap_handle); +} + ### functions #################################################################