ACLs without \ in the username throw exception

Getting:
Error: Undefined offset: 1 at /var/www/html/nextcloud/apps/files_external/lib/Lib/Storage/SMB.php#222
 for every ACL with no \ in the username
This change deals with users eg. S-5-1-xxx just returning no username for them. Returning a plain username eg. ['', $user] could be a security risk or at least would be incorrect
This commit is contained in:
Ant Nikrooz 2021-02-09 08:38:59 +00:00 committed by GitHub
parent 9eea1e56dc
commit 1f95f9b479
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -219,7 +219,7 @@ class SMB extends Common implements INotifyStorage {
private function getACL(IFileInfo $file): ?ACL { private function getACL(IFileInfo $file): ?ACL {
$acls = $file->getAcls(); $acls = $file->getAcls();
foreach ($acls as $user => $acl) { foreach ($acls as $user => $acl) {
[, $user] = explode('\\', $user); // strip domain [, $user] = strpos($user, '\\') ? explode('\\', $user) : ['','']; // strip domain
if ($user === $this->server->getAuth()->getUsername()) { if ($user === $this->server->getAuth()->getUsername()) {
return $acl; return $acl;
} }