From: cajus Date: Thu, 31 Jan 2008 09:27:49 +0000 (+0000) Subject: Completed LDAP configuration X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=4e4d7a89391a2aa4a38d7c383d4b8477440a1938;p=gosa.git Completed LDAP configuration git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8692 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-si/modules/SIPackages.pm b/gosa-si/modules/SIPackages.pm index c273341cf..4e2e0279b 100644 --- a/gosa-si/modules/SIPackages.pm +++ b/gosa-si/modules/SIPackages.pm @@ -603,23 +603,24 @@ sub new_ldap_config { # Perform search $mesg = $ldap->search( base => $ldap_base, scope => 'sub', - attrs => ['dn', 'gotoLdapServer'], + attrs => ['dn', 'gotoLdapServer', 'gosaUnitTag'], filter => "(&(objectClass=GOhard)(macaddress=$macaddress))"); $mesg->code && die $mesg->error; # Sanity check if ($mesg->count != 1) { &main::daemon_log("WARNING: client mac address $macaddress not found/not unique in ldap search", 1); - &main::daemon_log("\tbase: $ldap_base", 1); - &main::daemon_log("\tscope: sub", 1); - &main::daemon_log("\tattrs: dn, gotoLdapServer", 1); - &main::daemon_log("\tfilter: (&(objectClass=GOhard)(macaddress=$macaddress))", 1); + &main::daemon_log("\tbase: $ldap_base", 1); + &main::daemon_log("\tscope: sub", 1); + &main::daemon_log("\tattrs: dn, gotoLdapServer", 1); + &main::daemon_log("\tfilter: (&(objectClass=GOhard)(macaddress=$macaddress))", 1); return; } my $entry= $mesg->entry(0); my $dn= $entry->dn; my @servers= $entry->get_value("gotoLdapServer"); + my $unit_tag= $entry->get_value("gosaUnitTag"); my @ldap_uris; my $server; my $base; @@ -652,9 +653,6 @@ sub new_ldap_config { push (@ldap_uris, $server); } - # Unbind - $mesg = $ldap->unbind; - # Assemble data package my %data = ( 'ldap_uri' => \@ldap_uris, 'ldap_base' => $base, 'ldap_cfg' => \@ldap_cfg, 'pam_cfg' => \@pam_cfg,'nss_cfg' => \@nss_cfg ); @@ -665,6 +663,33 @@ sub new_ldap_config { $data{'goto_secret'}= $goto_secret; } + # Append unit tag if needed + if (defined $unit_tag){ + + # Find admin base and department name + $mesg = $ldap->search( base => $ldap_base, + scope => 'sub', + attrs => ['dn', 'ou'], + filter => "(&(objectClass=gosaAdministrativeUnit)(gosaUnitTag=$unit_tag))"); + $mesg->code && die $mesg->error; + + # Sanity check + if ($mesg->count != 1) { + &main::daemon_log("WARNING: cannot find administrative unit for client with tag $unit_tag", 1); + return; + } + + $entry= $mesg->entry(0); + $data{'admin_base'}= $entry->dn; + $data{'department'}= $entry->get_value("ou"); + + # Append unit Tag + $data{'unit_tag'}= $unit_tag; + } + + # Unbind + $mesg = $ldap->unbind; + # Send information return send_msg("new_ldap_config", $server_address, $address, \%data, $hostkey); }