Skip to content

Commit c6937fe

Browse files
rullzerBackportbot
authored andcommitted
Do not allow invalid users to be created
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
1 parent 96a981e commit c6937fe

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lib/private/User/Manager.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,10 @@ public function searchDisplayName($pattern, $limit = null, $offset = null) {
280280
* @return bool|IUser the created user or false
281281
*/
282282
public function createUser($uid, $password) {
283+
if (!$this->verifyUid($uid)) {
284+
return false;
285+
}
286+
283287
$localBackends = [];
284288
foreach ($this->backends as $backend) {
285289
if ($backend instanceof Database) {
@@ -599,4 +603,14 @@ public function getByEmail($email) {
599603
return ($u instanceof IUser);
600604
}));
601605
}
606+
607+
private function verifyUid(string $uid): bool {
608+
$appdata = 'appdata_' . $this->config->getSystemValueString('instanceid');
609+
610+
if ($uid === '.htaccess' || $uid === 'files_external' || $uid === '.ocdata' || $uid === 'owncloud.log' || $uid === 'nextcloud.log' || $uid === $appdata) {
611+
return false;
612+
}
613+
614+
return true;
615+
}
602616
}

0 commit comments

Comments
 (0)