[Pkg-owncloud-commits] [owncloud] 166/394: LDAP: ldap_explode_dn escaped too much, fix it by manual replacement. Fixes different problems, esp. with non-ascii characters in the dn (#631)

David Prévot taffit at alioth.debian.org
Fri Nov 8 23:11:55 UTC 2013


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag v4.5.10
in repository owncloud.

commit 44119e205168966b511482c593eb99c05b505344
Author: Arthur Schiwon <blizzz at owncloud.com>
Date:   Sat Dec 1 00:27:48 2012 +0100

    LDAP: ldap_explode_dn escaped too much, fix it by manual replacement. Fixes different problems, esp. with non-ascii characters in the dn (#631)
---
 apps/user_ldap/lib/access.php |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/apps/user_ldap/lib/access.php b/apps/user_ldap/lib/access.php
index 35b9f37..7702f16 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;
 	}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list