summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-09-17 19:47:09 +0200
committerAleksander Machniak <alec@alec.pl>2013-09-17 20:01:18 +0200
commite467788e6ee6b0f12ccd65dd0b419ebb18d80d60 (patch)
tree10dd3133e995c0dbc1d8874b2537360dc963e9c4 /lib
parent3fcb988bff8bc2ebbf9ad87ab0c3c4759051e49b (diff)
downloadwebadmin-e467788e6ee6b0f12ccd65dd0b419ebb18d80d60.tar.gz
Skip searching for nsuniqueid if searched value is too short to be a unique identifier (Bug #2216)
Diffstat (limited to 'lib')
-rw-r--r--lib/ext/Net/LDAP3.php9
-rw-r--r--lib/kolab_api_service.php1
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/ext/Net/LDAP3.php b/lib/ext/Net/LDAP3.php
index 6e0ccc6..533fd15 100644
--- a/lib/ext/Net/LDAP3.php
+++ b/lib/ext/Net/LDAP3.php
@@ -815,12 +815,19 @@ class Net_LDAP3
{
$this->_debug("entry_dn on subject $subject");
$is_dn = ldap_explode_dn($subject, 1);
- $this->_debug($is_dn ? "entry_dn is a dn" : "entry_dn is not a dn");
if (is_array($is_dn) && array_key_exists("count", $is_dn) && $is_dn["count"] > 0) {
+ $this->_debug("$subject is a dn");
return $subject;
}
+ $this->_debug("$subject is not a dn");
+
+ if (strlen($subject) < 16) {
+ $this->_debug("$subject is too short to be a unique identifier");
+ return;
+ }
+
$unique_attr = $this->config_get('unique_attribute', 'nsuniqueid');
$this->_debug("Using unique_attribute " . var_export($unique_attr, TRUE) . " at " . __FILE__ . ":" . __LINE__);
diff --git a/lib/kolab_api_service.php b/lib/kolab_api_service.php
index a154f7d..5ba4109 100644
--- a/lib/kolab_api_service.php
+++ b/lib/kolab_api_service.php
@@ -504,6 +504,7 @@ abstract class kolab_api_service
$attrs = array_merge($attrs, $extra_attrs);
}
}
+
// Replace unique attribute with 'id' key
$attrs['id'] = $attrs[$unique_attr];
unset($attrs[$unique_attr]);