Skip to content

Commit

Permalink
ACLs without \ in the username throw exception
Browse files Browse the repository at this point in the history
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
  • Loading branch information
anikrooz authored Feb 9, 2021
1 parent 9eea1e5 commit 1f95f9b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion apps/files_external/lib/Lib/Storage/SMB.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ protected function throwUnavailable(\Exception $e) {
private function getACL(IFileInfo $file): ?ACL {
$acls = $file->getAcls();
foreach ($acls as $user => $acl) {
[, $user] = explode('\\', $user); // strip domain
[, $user] = strpos($user, '\\') ? explode('\\', $user) : ['','']; // strip domain
if ($user === $this->server->getAuth()->getUsername()) {
return $acl;
}
Expand Down

1 comment on commit 1f95f9b

@Snafu
Copy link

@Snafu Snafu commented on 1f95f9b Apr 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, I found your commit while looking for a fix regarding an error message in nextcloud.
When I wanted to add it I realized that there exists a splitUser() function that basically does the same. The only difference is you return an empty string in case no domain is found whereas splitUser() returns the username part.

Please sign in to comment.