summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2012-09-05 14:40:44 +0200
committerAleksander Machniak <alec@alec.pl>2012-09-05 14:40:44 +0200
commit052ee511388c7525edd126abfcb5d7232f4bd1bb (patch)
treeb9e91796e696b10d006db38bea6763e5c2429981
parent4c191f31bed15fea60c3e754383288ea7adbb195 (diff)
parent83537043c792be58aec58eb548acedafb1f0eb98 (diff)
downloadwebadmin-052ee511388c7525edd126abfcb5d7232f4bd1bb.tar.gz
Merge branch 'master' of ssh://git.kolab.org/git/kolab-wap
-rw-r--r--lib/Auth/LDAP.php15
-rw-r--r--lib/api/kolab_api_service_form_value.php22
2 files changed, 25 insertions, 12 deletions
diff --git a/lib/Auth/LDAP.php b/lib/Auth/LDAP.php
index 14059c6..2afd737 100644
--- a/lib/Auth/LDAP.php
+++ b/lib/Auth/LDAP.php
@@ -502,7 +502,7 @@ class LDAP extends Net_LDAP3 {
}
$base_dn = $this->_subject_base_dn("role");
-
+ Log::trace("Auth::LDAP::list_roles() using \$base_dn: " . var_export($base_dn, TRUE));
// TODO: From config
$filter = "(&(objectclass=ldapsubentry)(objectclass=nsroledefinition))";
@@ -904,7 +904,9 @@ class LDAP extends Net_LDAP3 {
if (empty($subject_base_dn)) {
$subject_base_dn = $this->conf->get_raw("ldap", $subject . "_base_dn");
}
- $base_dn = $this->conf->expand($subject_base_dn, array("base_dn" => $base_dn));
+ if (!empty($subject_base_dn)) {
+ $base_dn = $this->conf->expand($subject_base_dn, array("base_dn" => $base_dn));
+ }
}
$this->_log(LOG_DEBUG, "subject_base_dn for subject $subject results in $base_dn");
@@ -1384,9 +1386,12 @@ class LDAP extends Net_LDAP3 {
$result = $this->search($entry_dn, '(objectclass=*)', 'base');
- $this->_log(LOG_DEBUG, "Auth::LDAP::_read() result: " . var_export($result->entries(TRUE), TRUE));
-
- return $result ? $result->entries(TRUE) : FALSE;
+ if ($result) {
+ $this->_log(LOG_DEBUG, "Auth::LDAP::_read() result: " . var_export($result->entries(TRUE), TRUE));
+ return $result->entries(TRUE);
+ } else {
+ return FALSE;
+ }
}
private function _search($base_dn, $filter = '(objectclass=*)', $attributes = Array('*')) {
diff --git a/lib/api/kolab_api_service_form_value.php b/lib/api/kolab_api_service_form_value.php
index d5eaf87..4936f30 100644
--- a/lib/api/kolab_api_service_form_value.php
+++ b/lib/api/kolab_api_service_form_value.php
@@ -781,13 +781,21 @@ class kolab_api_service_form_value extends kolab_api_service
if (!empty($postdata['id'])) {
$subjects = $auth->search($base_dn, '(' . $unique_attr . '=' . $postdata['id'] . ')')->entries(TRUE);
- $subject = array_shift($subjects);
- $subject_dn = key($subject);
- $subject_dn_components = ldap_explode_dn($subject_dn, 0);
- unset($subject_dn_components['count']);
- array_shift($subject_dn_components);
- $default = strtolower(implode(',', $subject_dn_components));
- } else {
+
+ if ($subjects) {
+ $subject = array_shift($subjects);
+ $subject_dn = key($subject);
+ $subject_dn_components = ldap_explode_dn($subject_dn, 0);
+
+ if ($subject_dn_components) {
+ unset($subject_dn_components['count']);
+ array_shift($subject_dn_components);
+ $default = strtolower(implode(',', $subject_dn_components));
+ }
+ }
+ }
+
+ if (empty($default)) {
$default = $base_dn;
}