mirror of
https://github.com/nextcloud/server.git
synced 2026-05-26 11:22:28 -04:00
Merge pull request #15072 from nextcloud/backport/14652/stable14
[stable14] Do not allow invalid users to be created
This commit is contained in:
commit
cfd5cdbbf3
1 changed files with 14 additions and 0 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue