summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-09-04 14:42:39 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-09-04 14:46:49 +0100
commit0a7b32758a8cb2014e08b053855b1dac2eb8841f (patch)
treed057bbd5c55562743ccb3cd26232a484785b37a2
parentfaef45587db295a49fa0802b71dd0127724ad65c (diff)
downloadwebadmin-0a7b32758a8cb2014e08b053855b1dac2eb8841f.tar.gz
Set the default folder to include a domain name for some parts of the search, and only set the localpart / domain if any is actually specified
-rw-r--r--lib/ext/Net/LDAP3.php23
1 files changed, 14 insertions, 9 deletions
diff --git a/lib/ext/Net/LDAP3.php b/lib/ext/Net/LDAP3.php
index f917dec..a69e283 100644
--- a/lib/ext/Net/LDAP3.php
+++ b/lib/ext/Net/LDAP3.php
@@ -748,7 +748,8 @@ class Net_LDAP3
return $this->result;
}
- public function login($username, $password) {
+ public function login($username, $password, $domain = null) {
+ $this->_debug("Net_LDAP3::login(\$username = '" . $username . "', \$password = '****', \$domain = '" . $domain . "')");
$_bind_dn = $this->config_get('service_bind_dn');
$_bind_pw = $this->config_get('service_bind_pw');
@@ -793,13 +794,17 @@ class Net_LDAP3
return NULL;
}
- if (count(explode('@', $username)) > 1) {
- $__parts = explode('@', $username);
- $localpart = $__parts[0];
- $domain = $__parts[1];
- } else {
- $localpart = $username;
- $domain = '';
+ $localpart = $username;
+
+ if (empty($domain) ) {
+ if (count(explode('@', $username)) > 1) {
+ $__parts = explode('@', $username);
+ $localpart = $__parts[0];
+ $domain = $__parts[1];
+ } else {
+ $localpart = $username;
+ $domain = '';
+ }
}
$realm = $domain;
@@ -809,7 +814,7 @@ class Net_LDAP3
$filter = $this->config_get("filter", NULL);
}
if (empty($filter)) {
- $filter = "(&(|(mail=%s)(alias=%s)(uid=%s))(objectclass=inetorgperson))";
+ $filter = "(&(|(mail=%s)(mail=%U@%d)(alias=%s)(alias=%U@%d)(uid=%s))(objectclass=inetorgperson))";
}
$this->_debug("Net::LDAP3::login() original filter: " . $filter);