From 84fecc2d73310eb6931ea508896d5a86c4daeb89 Mon Sep 17 00:00:00 2001 From: wolffc Date: Mon, 13 Sep 2010 14:46:28 +0000 Subject: [PATCH] Detect type of LDAP server (Sun LDAP and OpenLDAP for now) on login by querying the Root DSE. Use this information to choose appropriate escaping of commas (\, vs. \2C) in filters in order to update object group memberships during renames and moves of systems. git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@19649 594d385d-05f5-0310-b6e9-bd551577e9d8 --- trunk/gosa-core/html/index.php | 18 ++++++++++++++++++ trunk/gosa-core/include/class_plugin.inc | 7 ++++++- .../admin/systems/class_divListSystem.inc | 7 ++++++- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/trunk/gosa-core/html/index.php b/trunk/gosa-core/html/index.php index f247a370e..629266e27 100644 --- a/trunk/gosa-core/html/index.php +++ b/trunk/gosa-core/html/index.php @@ -286,6 +286,24 @@ if (($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['login'])) || $htacces } } + /* Determine LDAP server comma escaping style */ + if (!isset($config->comma_escape_style)) { + $comma_escape_style = "unknown"; + $ldap = $config->get_ldap_link(); + $ldap->cd(""); + $ldap->cat(""); + $attrs = $ldap->fetch(); + if (isset($attrs["vendorName"]) && $attrs["vendorName"][0] == "Sun Microsystems, Inc.") { + $comma_escape_style = "comma"; + } + for($i = 0 ; $i < $attrs['objectClass']['count']; $i++){ + if ($attrs['objectClass'][$i] == "OpenLDAProotDSE") { + $comma_escape_style = "2C"; + } + } + $config->comma_escape_style = $comma_escape_style; + } + /* Check for locking area */ $ldap->cat($config->get_cfg_value("config"), array("dn")); $attrs= $ldap->fetch(); diff --git a/trunk/gosa-core/include/class_plugin.inc b/trunk/gosa-core/include/class_plugin.inc index d517efd5b..75690a7f5 100644 --- a/trunk/gosa-core/include/class_plugin.inc +++ b/trunk/gosa-core/include/class_plugin.inc @@ -957,7 +957,12 @@ class plugin /* Walk through all objectGroups and check if there are members matching the source dn */ - $src_dn=str_replace('\\,', '\\2C', LDAP::fix($src_dn)); + if ($this->config->comma_escape_style == "comma" || + $this->config->comma_escape_style == "unknown") { + $src_dn=LDAP::fix($src_dn); + } else { + $src_dn=str_replace('\\,', '\\2C', LDAP::fix($src_dn)); + } foreach($ogroups as $ogroup){ if(isset($ogroup['member'])){ diff --git a/trunk/gosa-plugins/systems/admin/systems/class_divListSystem.inc b/trunk/gosa-plugins/systems/admin/systems/class_divListSystem.inc index e2178ec8c..a48afab15 100644 --- a/trunk/gosa-plugins/systems/admin/systems/class_divListSystem.inc +++ b/trunk/gosa-plugins/systems/admin/systems/class_divListSystem.inc @@ -398,7 +398,12 @@ class divListSystem extends MultiSelectWindow $cnts[$type] ++; /* Create each field */ - $filtered_dn = str_replace('\\,', '\\2C', LDAP::fix($val['dn'])); + if ($this->config->comma_escape_style == "comma" || + $this->config->comma_escape_style == "unknown") { + $filtered_dn = LDAP::fix($val['dn']); + } else { + $filtered_dn = str_replace('\\,', '\\2C', LDAP::fix($val['dn'])); + } $field0 = array("string" => "" , "attach" => "style='width:20px;'"); $field1 = array("string" => sprintf($img['img'],$val['dn']), -- 2.30.2