[Pkg-owncloud-commits] [owncloud] 27/63: Hardening home folder retrieval in user_ldap
David Prévot
taffit at moszumanska.debian.org
Tue Dec 22 16:50:56 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch stable8.0
in repository owncloud.
commit 582ca0a50dda3c3b1924cab7932764ae736c2466
Author: Morris Jobke <hey at morrisjobke.de>
Date: Tue Jun 16 13:46:51 2015 +0200
Hardening home folder retrieval in user_ldap
* if the home folder naming rule is specified it should not fallback
to the "use owncloud username as home folder" scenario
* this does not allow the mixed setup of users with the attribute
and some users without the attribute (which then would fallback to
"use owncloud username as home folder" rule) anymore
---
apps/user_ldap/user_ldap.php | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/apps/user_ldap/user_ldap.php b/apps/user_ldap/user_ldap.php
index 69c4af0..9c35ec9 100644
--- a/apps/user_ldap/user_ldap.php
+++ b/apps/user_ldap/user_ldap.php
@@ -262,7 +262,8 @@ class USER_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserIn
if($this->access->connection->isCached($cacheKey)) {
return $this->access->connection->getFromCache($cacheKey);
}
- if(strpos($this->access->connection->homeFolderNamingRule, 'attr:') === 0) {
+ if(strpos($this->access->connection->homeFolderNamingRule, 'attr:') === 0 &&
+ $this->access->connection->homeFolderNamingRule !== 'attr:') {
$attr = substr($this->access->connection->homeFolderNamingRule, strlen('attr:'));
$homedir = $this->access->readAttribute(
$this->access->username2dn($uid), $attr);
@@ -289,6 +290,8 @@ class USER_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserIn
//TODO: if home directory changes, the old one needs to be removed.
return $homedir;
}
+ // a naming rule attribute is defined, but it doesn't exist for that LDAP user
+ throw new \Exception('Home dir attribute can\'t be read from LDAP for uid: ' . $uid);
}
//false will apply default behaviour as defined and done by OC_User
--
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