Code

Filters require brakets ()
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 1 Jun 2010 12:04:27 +0000 (12:04 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 1 Jun 2010 12:04:27 +0000 (12:04 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18820 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/dyngroup/addons/dyngroup/classDynamicLdapGroup.inc

index 02c74dd503f3d87a77fcc12fe650c5bf6ffff9e8..28ebd67b0f73b5063065e8844903a60fb3e1c625 100644 (file)
@@ -124,6 +124,16 @@ class DynamicLdapGroup extends plugin
             // A filter is required
             if(empty($entry['filter'])){
                 $messages[] = msgPool::required(_("Filter")." {$nr}");
+            }else{
+
+                // Check if filter is valid
+                $ldap = $this->config->get_ldap_link();
+                $ldap->cd($this->config->current['BASE']);
+                $ldap->search($entry['filter']);
+                if(!$ldap->success()){
+                    $messages[] = sprintf(_("The given filter '%s' for entry %s seems to be invalid!"),
+                            bold($entry['filter']), $nr);
+                }
             }
         }
  
@@ -198,7 +208,7 @@ class DynamicLdapGroup extends plugin
                         'base' => 'ldap:///'.$this->dn,
                         'attr' => 'memberUid', 
                         'scope' => 2,
-                        'filter' => 'objectClass=posixGroup');
+                        'filter' => '(objectClass=posixGroup)');
         }
 
         // Remove a labeled Uri and get posts