diff options
author | Morris Jobke <hey@morrisjobke.de> | 2015-06-16 13:46:51 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2015-07-29 20:25:05 +0200 |
commit | 3fa6f6f77c3045feffc16f33ad4014868b88de0c (patch) | |
tree | 99df10f061ed8c10834afb5933b0d3ee534df641 /apps/user_ldap | |
parent | b5ea97ef817cc2b33269f4518727db259ec6c960 (diff) | |
download | nextcloud-server-3fa6f6f77c3045feffc16f33ad4014868b88de0c.tar.gz nextcloud-server-3fa6f6f77c3045feffc16f33ad4014868b88de0c.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
Diffstat (limited to 'apps/user_ldap')
-rw-r--r-- | apps/user_ldap/user_ldap.php | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/apps/user_ldap/user_ldap.php b/apps/user_ldap/user_ldap.php index caff30a0e60..c4ebace8558 100644 --- a/apps/user_ldap/user_ldap.php +++ b/apps/user_ldap/user_ldap.php @@ -266,7 +266,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); @@ -293,6 +294,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 |