From 66d32c253504b3b3b76b7163ae58e875d7ee9eb0 Mon Sep 17 00:00:00 2001 From: cajus Date: Wed, 30 Jan 2008 14:05:46 +0000 Subject: [PATCH] Count doesn't seem to work with $#. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8667 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-si/gosa-si-client | 37 +++++++++++++++++++++++++------ gosa-si/modules/ServerPackages.pm | 3 ++- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/gosa-si/gosa-si-client b/gosa-si/gosa-si-client index 86e2f2afe..d3a47578d 100755 --- a/gosa-si/gosa-si-client +++ b/gosa-si/gosa-si-client @@ -1078,6 +1078,9 @@ sub new_ldap_config { my @nss_options; my $goto_admin; my $goto_secret; + my $admin_base= ""; + my $department= ""; + my $unit_tag= ""; # Transform input into array while ( my ($key, $value) = each(%$msg_hash) ) { @@ -1114,9 +1117,28 @@ sub new_ldap_config { push (@nss_options, "$element"); next; } + if ($key =~ /^admin_base$/) { + $admin_base= $element; + next; + } + if ($key =~ /^department$/) { + $department= $element; + next; + } + if ($key =~ /^unit_tag$/) { + $unit_tag= $element; + next; + } } } + # Unit tagging enabled? + if ($unit_tag != ""){ + push (@pam_options, "pam_filter gosaUnitTag=$unit_tag"); + push (@nss_options, "nss_base_passwd $admin_base?sub?gosaUnitTag=$unit_tag"); + push (@nss_options, "nss_base_group $admin_base?sub?gosaUnitTag=$unit_tag"); + } + # Setup ldap.conf my $file1; my $file2; @@ -1169,13 +1191,14 @@ sub new_ldap_config { daemon_log("wrote /etc/goto/secret", 5); } - - # TODO: write these values to /etc/ldap/ldap-shell.conf - # LDAP_BASE= - # ADMIN_BASE= - # DEPARTMENT= - # UNIT_TAG= - # UNIT_TAG_FILTER= + # Write shell based config + open(file1, "> /etc/ldap/ldap-shell.conf"); + print file1 "LDAP_BASE=\"$ldap_base\"\n"; + print file1 "ADMIN_BASE=\"$admin_base\"\n"; + print file1 "DEPARTMENT=\"$department\"\n"; + print file1 "UNIT_TAG=\"$unit_tag\"\n"; + print file1 "UNIT_TAG_FILTER=\"".($unit_tag!="" ? "(gosaUnitTag=$unit_tag)" : "")."\"\n"; + close(file1); return; diff --git a/gosa-si/modules/ServerPackages.pm b/gosa-si/modules/ServerPackages.pm index 884b8f7ff..c4de90d9a 100644 --- a/gosa-si/modules/ServerPackages.pm +++ b/gosa-si/modules/ServerPackages.pm @@ -744,7 +744,8 @@ sub new_ldap_config { my $base; # Do we need to look at an object class? - if ($#servers < 1){ + my $cnt= @servers; + if ($cnt < 1){ $mesg = $ldap->search( base => $ldap_base, scope => 'sub', attrs => ['dn', 'gotoLdapServer'], -- 2.30.2