Code

Count doesn't seem to work with $#.
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 30 Jan 2008 14:05:46 +0000 (14:05 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 30 Jan 2008 14:05:46 +0000 (14:05 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8667 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-si/gosa-si-client
gosa-si/modules/ServerPackages.pm

index 86e2f2afef55a5e094e2971e7945934bbef91246..d3a47578d50a4546f3c9b3e80005b684a935deb1 100755 (executable)
@@ -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;
 
index 884b8f7ffdcab166588d17d6518de15da1a054b2..c4de90d9a7ab48b691c1fdb41c6e3929cd4dce69 100644 (file)
@@ -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'],