Merge pull request #15072 from nextcloud/backport/14652/stable14

[stable14] Do not allow invalid users to be created
This commit is contained in:
Morris Jobke 2019-04-15 12:00:53 +02:00 committed by GitHub
commit cfd5cdbbf3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -280,6 +280,10 @@ class Manager extends PublicEmitter implements IUserManager {
* @return bool|IUser the created user or false
*/
public function createUser($uid, $password) {
if (!$this->verifyUid($uid)) {
return false;
}
$localBackends = [];
foreach ($this->backends as $backend) {
if ($backend instanceof Database) {
@ -599,4 +603,14 @@ class Manager extends PublicEmitter implements IUserManager {
return ($u instanceof IUser);
}));
}
private function verifyUid(string $uid): bool {
$appdata = 'appdata_' . $this->config->getSystemValue('instanceid');
if ($uid === '.htaccess' || $uid === 'files_external' || $uid === '.ocdata' || $uid === 'owncloud.log' || $uid === 'nextcloud.log' || $uid === $appdata) {
return false;
}
return true;
}
}