Code

Fixed loading of releases
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 22 Feb 2008 15:43:49 +0000 (15:43 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 22 Feb 2008 15:43:49 +0000 (15:43 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9085 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-si/modules/SIPackages.pm

index 64c72c0a36f0c3a4905a8df6b0ff164159b847b9..7812d63f6072697401fd2eac73e55dbad4e95a01 100644 (file)
@@ -786,7 +786,7 @@ sub new_ldap_config {
        # Perform search
        $mesg = $ldap->search( base   => $ldap_base,
                scope  => 'sub',
-               attrs => ['dn', 'gotoLdapServer', 'gosaUnitTag'],
+               attrs => ['dn', 'gotoLdapServer', 'gosaUnitTag', 'FAIclass'],
                filter => "(&(objectClass=GOhard)(macaddress=$macaddress))");
        #$mesg->code && die $mesg->error;
        if($mesg->code) {
@@ -811,12 +811,19 @@ sub new_ldap_config {
        my @ldap_uris;
        my $server;
        my $base;
+       my $release;
+
+       # Fill release if available
+       my $FAIclass= $entry->get_value("FAIclass");
+       if (defined $FAIclass && $FAIclass =~ /^.* :([A-Za-z0-9\/.]+).*$/) {
+               $release= $1;
+       }
 
        # Do we need to look at an object class?
        if (length(@servers) < 1){
                $mesg = $ldap->search( base   => $ldap_base,
                        scope  => 'sub',
-                       attrs => ['dn', 'gotoLdapServer'],
+                       attrs => ['dn', 'gotoLdapServer', 'FAIclass'],
                        filter => "(&(objectClass=gosaGroupOfNames)(member=$dn))");
                #$mesg->code && die $mesg->error;
                if($mesg->code) {
@@ -833,6 +840,13 @@ sub new_ldap_config {
                $entry= $mesg->entry(0);
                $dn= $entry->dn;
                @servers= $entry->get_value("gotoLdapServer");
+
+               if (not defined $release){
+                       $FAIclass= $entry->get_value("FAIclass");
+                       if (defined $FAIclass && $FAIclass =~ /^.* :([A-Za-z0-9\/.]+).*$/) {
+                               $release= $1;
+                       }
+               }
        }
 
        @servers= sort (@servers);
@@ -854,6 +868,9 @@ sub new_ldap_config {
        # Assemble data package
        my %data = ( 'ldap_uri'  => \@ldap_uris, 'ldap_base' => $base,
                'ldap_cfg' => \@ldap_cfg, 'pam_cfg' => \@pam_cfg,'nss_cfg' => \@nss_cfg );
+       if (defined $release){
+               $data{'release'}= $release;
+       }
 
        # Need to append GOto settings?
        if (defined $goto_admin and defined $goto_secret){
@@ -867,7 +884,7 @@ sub new_ldap_config {
                # Find admin base and department name
                $mesg = $ldap->search( base   => $ldap_base,
                        scope  => 'sub',
-                       attrs => ['dn', 'ou', 'FAIclass'],
+                       attrs => ['dn', 'ou'],
                        filter => "(&(objectClass=gosaAdministrativeUnit)(gosaUnitTag=$unit_tag))");
                #$mesg->code && die $mesg->error;
                if($mesg->code) {
@@ -889,12 +906,6 @@ sub new_ldap_config {
                $data{'unit_tag'}= $unit_tag;
        }
 
-       # Fill release if available
-       my $FAIclass= $entry->get_value("FAIclass");
-       if (defined $FAIclass && $FAIclass =~ /^.* :([A-Za-z0-9\/.]+).*$/) {
-               $data{'release'}= $1;
-       }
-
 
        # Unbind
        $mesg = $ldap->unbind;