summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-09-17 17:47:09 (GMT)
committerAleksander Machniak <alec@alec.pl>2013-12-04 07:49:50 (GMT)
commitf6102545ebfbc07e638c44ca2bcc30f25dd5f39a (patch)
tree41886d0e102a426388d20e6aa9002af97fd250dd
parentfba5cba31781aac48075fff5f837350ae6d60ac0 (diff)
downloadkolab-wap-f6102545ebfbc07e638c44ca2bcc30f25dd5f39a.tar.gz
Skip searching for nsuniqueid if searched value is too short to be a unique identifier (Bug #2216)
-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 344df44..e661edb 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 4e5a029..858e643 100644
--- a/lib/kolab_api_service.php
+++ b/lib/kolab_api_service.php
@@ -508,6 +508,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]);