Skip to content

Commit 969fc45

Browse files
rullzerMorrisJobke
authored andcommitted
Do not allow invalid users to be created
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
1 parent 6331f17 commit 969fc45

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

lib/private/User/Manager.php

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

0 commit comments

Comments
 (0)