Code

Fixed functions inc get_ou
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 2 Apr 2008 08:33:46 +0000 (08:33 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 2 Apr 2008 08:33:46 +0000 (08:33 +0000)
-Do not append ',' to fetched department names, if department is absolute (ou=sudoers,dc=gonicus,dc=de)

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10102 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/include/functions.inc

index 5caf26ea7018b6192af03cdecb4ed4e02c0adbb0..1926e94f04238174a9dcf3c42c867b84d8e1e544 100644 (file)
@@ -1166,10 +1166,17 @@ function get_ou($name)
  
   if ($ou != ""){
     if (!preg_match('/^[^=]+=[^=]+/', $ou)){
-      return @LDAP::convert("ou=$ou,");
+      $ou = @LDAP::convert("ou=$ou");
     } else {
-      return @LDAP::convert("$ou,");
+      $ou = @LDAP::convert("$ou");
     }
+
+    if(preg_match("/".normalizePreg($config->current['BASE'])."$/",$ou)){
+      return($ou);
+    }else{
+      return("$ou,");
+    }
+  
   } else {
     return "";
   }