Branch 'kolab-webadmin-3.1' - 2 commits - lib/ext lib/kolab_api_service.php
Aleksander Machniak
machniak at kolabsys.com
Wed Dec 4 08:50:16 CET 2013
lib/ext/Net/LDAP3.php | 9 ++++++++-
lib/kolab_api_service.php | 1 +
2 files changed, 9 insertions(+), 1 deletion(-)
New commits:
commit 19627e08d6a5bee73e19ad40d16402cb927e8208
Author: Aleksander Machniak <alec at alec.pl>
Date: Wed Dec 4 08:49:01 2013 +0100
Skip unique attribute searches when searching string doesn't look like UUID
diff --git a/lib/ext/Net/LDAP3.php b/lib/ext/Net/LDAP3.php
index e661edb..9a4ecb2 100644
--- a/lib/ext/Net/LDAP3.php
+++ b/lib/ext/Net/LDAP3.php
@@ -823,8 +823,8 @@ class Net_LDAP3
$this->_debug("$subject is not a dn");
- if (strlen($subject) < 16) {
- $this->_debug("$subject is too short to be a unique identifier");
+ if (strlen($subject) < 32 || preg_match('/[^a-fA-F0-9-]/', $subject)) {
+ $this->_debug("$subject is not a unique identifier");
return;
}
commit f6102545ebfbc07e638c44ca2bcc30f25dd5f39a
Author: Aleksander Machniak <alec at alec.pl>
Date: Tue Sep 17 19:47:09 2013 +0200
Skip searching for nsuniqueid if searched value is too short to be a unique identifier (Bug #2216)
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]);
More information about the commits
mailing list