aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2015-06-16 13:46:51 +0200
committerMorris Jobke <hey@morrisjobke.de>2015-12-15 08:45:32 +0100
commit582ca0a50dda3c3b1924cab7932764ae736c2466 (patch)
tree5fce72812a169379c67999386ded78f6ab603971
parent79857c975c5eb62605700c5fd00e1cddea7b04f3 (diff)
downloadnextcloud-server-582ca0a50dda3c3b1924cab7932764ae736c2466.tar.gz
nextcloud-server-582ca0a50dda3c3b1924cab7932764ae736c2466.zip
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
-rw-r--r--apps/user_ldap/user_ldap.php5
1 files changed, 4 insertions, 1 deletions
diff --git a/apps/user_ldap/user_ldap.php b/apps/user_ldap/user_ldap.php
index 69c4af0ebbf..9c35ec94cca 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