summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ca4974f)
raw | patch | inline | side by side (parent: ca4974f)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 19 Jan 2006 11:19:11 +0000 (11:19 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 19 Jan 2006 11:19:11 +0000 (11:19 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2527 594d385d-05f5-0310-b6e9-bd551577e9d8
include/class_ldap.inc | patch | blob | history | |
include/functions.inc | patch | blob | history | |
plugins/admin/groups/class_groupManagement.inc | patch | blob | history |
diff --git a/include/class_ldap.inc b/include/class_ldap.inc
index 73dc11253dff3eb92b7dedc352c03783942d4730..6319ee80f1ca3cd47fde9bcfae8f45141a071876 100644 (file)
--- a/include/class_ldap.inc
+++ b/include/class_ldap.inc
$rv = @ldap_get_dn($this->cid, $this->re);
$this->error = @ldap_error($this->cid);
- $rv= preg_replace("/[ ]*,[ ]*/", ",", $rv);
+ $rv= clean_dn($rv);
return($rv);
}
}else{
diff --git a/include/functions.inc b/include/functions.inc
index f0afc98b3183be30c04fea7c70e5f81752bb0454..11a949f9c2ee0d092092ed738e7697c92efcf9c7 100644 (file)
--- a/include/functions.inc
+++ b/include/functions.inc
/* Check for existing entries in lock area */
$ldap= $config->get_ldap_link();
$ldap->cd ($config->current['CONFIG']);
- $ldap->search("(&(objectClass=gosaLockEntry)(gosaUser=$user)(gosaObject=$object))",
+ $ldap->search("(&(objectClass=gosaLockEntry)(gosaUser=$user)(gosaObject=".base64encode($object)."))",
array("gosaUser"));
if (!preg_match("/Success/i", $ldap->error)){
print_red (sprintf(_("Can't set locking information in LDAP database. Please check the 'config' entry in gosa.conf! LDAP server says '%s'."), $ldap->get_error()));
$ldap->cd("cn=$name,".$config->current['CONFIG']);
$attrs["objectClass"] = "gosaLockEntry";
$attrs["gosaUser"] = $user;
- $attrs["gosaObject"] = $object;
+ $attrs["gosaObject"] = base64_encode($object);
$attrs["cn"] = "$name";
$ldap->add($attrs);
if (!preg_match("/Success/i", $ldap->error)){
/* Check for existance and remove the entry */
$ldap= $config->get_ldap_link();
$ldap->cd ($config->current['CONFIG']);
- $ldap->search ("(&(objectClass=gosaLockEntry)(gosaObject=$object))", array("gosaObject"));
+ $ldap->search ("(&(objectClass=gosaLockEntry)(gosaObject=".base64_encode($object)."))", array("gosaObject"));
$attrs= $ldap->fetch();
if ($ldap->getDN() != "" && preg_match("/Success/i", $ldap->error)){
$ldap->rmdir ($ldap->getDN());
$user= "";
$ldap= $config->get_ldap_link();
$ldap->cd ($config->current['CONFIG']);
- $ldap->search("(&(objectClass=gosaLockEntry)(gosaObject=$object))", array("gosaUser"));
+ $ldap->search("(&(objectClass=gosaLockEntry)(gosaObject=".base64_encode($object)."))", array("gosaUser"));
if (!preg_match("/Success/i", $ldap->error)){
print_red (_("Can't get locking information in LDAP database. Please check the 'config' entry in gosa.conf!"));
return("");
@@ -509,7 +509,7 @@ function get_list2($subtreeACL, $filter, $subsearch= TRUE, $base="", $attrs= arr
/* Crawl through reslut entries and perform the migration to the
result array */
while($attrs = $ldap->fetch()) {
- $dn= preg_replace("/[ ]*,[ ]*/", ",", $ldap->getDN());
+ $dn= clean_dn($ldap->getDN());
foreach ($subtreeACL as $key => $value){
if (preg_match("/$key/", $dn)){
$attrs["dn"]= convert_department_dn($dn);
@@ -554,7 +554,7 @@ function get_list($subtreeACL, $filter, $subsearch= TRUE, $base="", $attrs= arra
result array */
$result= array();
while($attrs = $ldap->fetch()) {
- $dn= preg_replace("/[ ]*,[ ]*/", ",", $ldap->getDN());
+ $dn= clean_dn($ldap->getDN());
foreach ($subtreeACL as $key => $value){
if (preg_match("/$key/", $dn)){
$attrs["dn"]= $dn;
/* Successively remove leading parts of the dn's until
it doesn't contain commas anymore */
- while (preg_match('/,/', $tmp)){
- $tmp= ltrim(strstr($tmp, ","), ",");
+ $tmp_dn= preg_replace('/\\\\,/', '<GOSA#REPLACED#KOMMA>', $tmp);
+ while (preg_match('/,/', $tmp_dn)){
+ $tmp_dn= ltrim(strstr($tmp_dn, ","), ",");
+ $tmp= preg_replace('/\<GOSA#REPLACED#KOMMA\>/', '\\,', $tmp);
/* Check for acl that may apply */
foreach ($sacl as $key => $value){
/* Build a sub-directory style list of the tree level
specified in $dn */
- foreach (split (",", $dn) as $val){
+ foreach (dn_split ($dn) as $val){
/* We're only interested in organizational units... */
if (preg_match ("/ou=/", $val)){
- $dep= preg_replace("/ou=([^,]+)/", "\\1", $val)."/$dep";
+ $dep= substr($val,3)."/$dep";
}
/* ... and location objects */
if (preg_match ("/l=/", $val)){
- $dep= preg_replace("/l=([^,]+)/", "\\1", $val)."/$dep";
+ $dep= substr($val,2)."/$dep";
}
}
if(isset($deps[$dn])){
$dn= $deps[$dn];
- $tmp = split (",", $dn);
+ $tmp = dn_split ($dn);
$dep = preg_replace("/^.*=/","",$tmp[0]);
}else{
- $tmp = split (",", $dn);
+ $tmp = dn_split ($dn);
$dep= preg_replace("%^.*/([^/]+)$%", "\\1", $tmp[0]);
}
}
+function dn_split($dn)
+{
+ $ret= array();
+ $tmp_dn= preg_replace('/\\\\,/', '##', $dn);
+ if (!preg_match('/,/', $tmp_dn)){
+ $ret[]= $dn;
+ return $ret;
+ }
+
+ while (1){
+
+ # Get next position of comma, exit if there
+ # are none left
+ $pos= strpos($tmp_dn, ',');
+ if ($pos === false){
+ break;
+ }
+
+ # Assign element
+ $ret[]= substr($dn, 0, $pos);
+ $tmp_dn= substr($tmp_dn, $pos + 1);
+ $dn= substr($dn, $pos + 1);
+ }
+
+ return ($ret);
+}
+
+
+function clean_dn($dn)
+{
+ $tmp_dn= preg_replace('/\\\\,/', '<GOSA#REPLACED#KOMMA>', $dn);
+ $tmp_dn= preg_replace('/[ ]*,[ ]*/', ",", $tmp_dn);
+ $tmp_dn= preg_replace('/\<GOSA#REPLACED#KOMMA\>/', '\\,', $tmp_dn);
+ return ($tmp_dn);
+}
+
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
?>
diff --git a/plugins/admin/groups/class_groupManagement.inc b/plugins/admin/groups/class_groupManagement.inc
index df4f76f29dc6a997a35e719a9cb759cdeadde322..05befca60da1a606b5102b542a8341c8dbb47680 100644 (file)
function execute()
{
- /* Call parent execute */
-// plugin::execute();
+ /* Call parent execute */
+ plugin::execute();
/* Save data */
$groupfilter= get_global("groupfilter");