diff options
author | blizzz <blizzz@owncloud.com> | 2012-12-02 22:43:43 +0400 |
---|---|---|
committer | blizzz <blizzz@owncloud.com> | 2012-12-02 22:43:43 +0400 |
commit | d57b870f3e910d3b753296653bba034f06c55d9a (patch) | |
tree | 2f99d159e2f38c472ffdd5237d19ce6c861ce70f | |
parent | 85962267879f7d2383ec5e7fd1ebf57865da07ea (diff) | |
parent | 44119e205168966b511482c593eb99c05b505344 (diff) |
Merge pull request #662 from owncloud/fix_ldap_escape_dn_2
LDAP: ldap_explode_dn escaped too much, fix it by manual replacement. ...
-rw-r--r-- | apps/user_ldap/lib/access.php | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/apps/user_ldap/lib/access.php b/apps/user_ldap/lib/access.php index 35b9f3726ec..7702f16df5c 100644 --- a/apps/user_ldap/lib/access.php +++ b/apps/user_ldap/lib/access.php @@ -118,10 +118,17 @@ abstract class Access { //escape DN values according to RFC 2253 – this is already done by ldap_explode_dn //to use the DN in search filters, \ needs to be escaped to \5c additionally //to use them in bases, we convert them back to simple backslashes in readAttribute() - $aDN = ldap_explode_dn($dn, false); - unset($aDN['count']); - $dn = implode(',', $aDN); - $dn = str_replace('\\', '\\5c', $dn); + $replacements = array( + '\,' => '\5c2C', + '\=' => '\5c3D', + '\+' => '\5c2B', + '\<' => '\5c3C', + '\>' => '\5c3E', + '\;' => '\5c3B', + '\"' => '\5c22', + '\#' => '\5c23', + ); + $dn = str_replace(array_keys($replacements),array_values($replacements), $dn); return $dn; } |