[Pkg-owncloud-commits] [owncloud] 197/394: LDAP: don't append absolute paths to datadir when determining customized user home, fixes #763

David Prévot taffit at alioth.debian.org
Fri Nov 8 23:12:03 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 7858ee8896aa2c885ab7caffa6f29071c8b50e2c
Author: Arthur Schiwon <blizzz at owncloud.com>
Date:   Sat Dec 8 01:10:39 2012 +0100

    LDAP: don't append absolute paths to datadir when determining customized user home, fixes #763
---
 apps/user_ldap/user_ldap.php |   15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/apps/user_ldap/user_ldap.php b/apps/user_ldap/user_ldap.php
index d4f2593..8658ba0 100644
--- a/apps/user_ldap/user_ldap.php
+++ b/apps/user_ldap/user_ldap.php
@@ -171,8 +171,19 @@ class USER_LDAP extends lib\Access implements \OCP\UserInterface {
 		if(strpos($this->connection->homeFolderNamingRule, 'attr:') === 0) {
 			$attr = substr($this->connection->homeFolderNamingRule, strlen('attr:'));
 			$homedir = $this->readAttribute($this->username2dn($uid), $attr);
-			if($homedir) {
-				$homedir = \OCP\Config::getSystemValue( "datadirectory", \OC::$SERVERROOT."/data" ) . '/' . $homedir[0];
+			if($homedir && isset($homedir[0])) {
+				$path = $homedir[0];
+				//if attribute's value is an absolute path take this, otherwise append it to data dir
+				//check for / at the beginning or pattern c:\ resp. c:/
+				if(
+					'/' == $path[0]
+					|| (3 < strlen($path) && ctype_alpha($path[0]) && $path[1] == ':' && ('\\' == $path[2] || '/' == $path[2]))
+				) {
+					$homedir = $path;
+				} else {
+					$homedir = \OCP\Config::getSystemValue( "datadirectory", \OC::$SERVERROOT."/data" ) . '/' . $homedir[0];
+				}
+
 				\OCP\Config::setUserValue($uid, 'user_ldap', 'homedir', $homedir);
 				return $homedir;
 			}

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