[Pkg-owncloud-commits] [owncloud] 123/394: LDAP: also prepare for DN for login due to the escape changes for #419. Hopefully we're really done now..

David Prévot taffit at alioth.debian.org
Fri Nov 8 23:11:43 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 95cee0eb5d39ceb0c47c053c81134d039ab514d6
Author: Arthur Schiwon <blizzz at owncloud.com>
Date:   Tue Nov 20 17:36:25 2012 +0100

    LDAP: also prepare for DN for login due to the escape changes for #419. Hopefully we're really done now..
---
 apps/user_ldap/lib/access.php |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/apps/user_ldap/lib/access.php b/apps/user_ldap/lib/access.php
index 34cad9c..35b9f37 100644
--- a/apps/user_ldap/lib/access.php
+++ b/apps/user_ldap/lib/access.php
@@ -56,7 +56,7 @@ abstract class Access {
 			return false;
 		}
 		//Slashes should only be escaped in filters, not bases.
-		$dn = $dn = str_replace('\\5c', '\\', $dn);
+		$dn = $this->DNasBaseParameter($dn);
 		$rr = @ldap_read($cr, $dn, 'objectClass=*', array($attr));
 		if(!is_resource($rr)) {
 			\OCP\Util::writeLog('user_ldap', 'readAttribute failed for DN '.$dn, \OCP\Util::DEBUG);
@@ -649,6 +649,7 @@ abstract class Access {
 	}
 
 	public function areCredentialsValid($name, $password) {
+		$name = $this->DNasBaseParameter($name);
 		$testConnection = clone $this->connection;
 		$credentials = array(
 			'ldapAgentName' => $name,
@@ -735,4 +736,16 @@ abstract class Access {
 
 		return strtoupper($hex_guid_to_guid_str);
 	}
+
+	/**
+	 * @brief converts a stored DN so it can be used as base parameter for LDAP queries
+	 * @param $dn the DN
+	 * @returns String
+	 *
+	 * converts a stored DN so it can be used as base parameter for LDAP queries
+	 * internally we store them for usage in LDAP filters
+	 */
+	private function DNasBaseParameter($dn) {
+		return str_replace('\\5c', '\\', $dn);
+	}
 }
\ No newline at end of file

-- 
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