summaryrefslogtreecommitdiff
path: root/lib/Kolab/FreeBusy
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2014-10-30 18:13:27 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2014-10-30 18:13:27 (GMT)
commit9889e6561f7cabfdb7ddb69848b55ac52151e21f (patch)
tree97269feeafbb01a21cd32637a140abb4bdb96770 /lib/Kolab/FreeBusy
parentc864d8b95d776276cbddddb71a6a9d5130d83ddc (diff)
downloadkolab-freebusy-9889e6561f7cabfdb7ddb69848b55ac52151e21f.tar.gz
Quote filter attribute value; add fallback domain name for LDAP queries
Diffstat (limited to 'lib/Kolab/FreeBusy')
-rw-r--r--lib/Kolab/FreeBusy/DirectoryLDAP.php3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Kolab/FreeBusy/DirectoryLDAP.php b/lib/Kolab/FreeBusy/DirectoryLDAP.php
index 0a4ecff..c155d98 100644
--- a/lib/Kolab/FreeBusy/DirectoryLDAP.php
+++ b/lib/Kolab/FreeBusy/DirectoryLDAP.php
@@ -101,9 +101,10 @@ class DirectoryLDAP extends Directory
if ($this->ready) {
// search with configured base_dn and filter
list($u, $d) = explode('@', $user);
+ if (empty($d)) $d = $this->config['primary_domain'];
$replaces = array('%dc' => 'dc=' . str_replace('.', ',dc=', $d), '%u' => $u);
$base_dn = strtr($this->config['base_dn'], $replaces);
- $filter = preg_replace('/%s/i', $user, strtr($this->config['filter'], $replaces));
+ $filter = str_replace('%s', Net_LDAP3::quote_string($user), strtr($this->config['filter'], $replaces));
$ldapresult = $this->ldap->search($base_dn, $filter, 'sub', Config::convert($this->config['attributes'], Config::ARR));
// got a valid result