diff options
author | Julius Härtl <jus@bitgrid.net> | 2021-02-02 11:58:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-02 11:58:43 +0100 |
commit | 5b898fa60e8b96c80bf9a00dc34b3e7d20663fd2 (patch) | |
tree | 9e801c60fb66741cdcd5189474838cce07a9b520 | |
parent | 5c8be9ac665d965fe2bad67b3cc79656b17218db (diff) | |
parent | 6f6f45b77b5f1e9d623784ed5a7d775e30e7b89e (diff) | |
download | nextcloud-server-5b898fa60e8b96c80bf9a00dc34b3e7d20663fd2.tar.gz nextcloud-server-5b898fa60e8b96c80bf9a00dc34b3e7d20663fd2.zip |
Merge pull request #25422 from nextcloud/backport/25383/stable19
[stable19] Properly handle SMB ACL blocking scanning a directory
-rw-r--r-- | apps/dav/lib/Connector/Sabre/Directory.php | 3 | ||||
-rw-r--r-- | apps/files_external/lib/Lib/Storage/SMB.php | 9 |
2 files changed, 10 insertions, 2 deletions
diff --git a/apps/dav/lib/Connector/Sabre/Directory.php b/apps/dav/lib/Connector/Sabre/Directory.php index f41bbbbf130..a9eb206dc00 100644 --- a/apps/dav/lib/Connector/Sabre/Directory.php +++ b/apps/dav/lib/Connector/Sabre/Directory.php @@ -40,6 +40,7 @@ use OCA\DAV\Connector\Sabre\Exception\InvalidPath; use OCP\Files\FileInfo; use OCP\Files\ForbiddenException; use OCP\Files\InvalidPathException; +use OCP\Files\NotPermittedException; use OCP\Files\StorageNotAvailableException; use OCP\Lock\ILockingProvider; use OCP\Lock\LockedException; @@ -340,6 +341,8 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node implements \Sabre\DAV\ICol return $this->quotaInfo; } catch (\OCP\Files\StorageNotAvailableException $e) { return [0, 0]; + } catch (NotPermittedException $e) { + return [0, 0]; } } diff --git a/apps/files_external/lib/Lib/Storage/SMB.php b/apps/files_external/lib/Lib/Storage/SMB.php index f3e4a62094b..6c8d9e0a062 100644 --- a/apps/files_external/lib/Lib/Storage/SMB.php +++ b/apps/files_external/lib/Lib/Storage/SMB.php @@ -61,6 +61,7 @@ use OCP\Constants; use OCP\Files\EntityTooLargeException; use OCP\Files\Notify\IChange; use OCP\Files\Notify\IRenameChange; +use OCP\Files\NotPermittedException; use OCP\Files\Storage\INotifyStorage; use OCP\Files\StorageAuthException; use OCP\Files\StorageNotAvailableException; @@ -235,7 +236,11 @@ class SMB extends Common implements INotifyStorage { protected function getFolderContents($path): iterable { try { $path = ltrim($this->buildPath($path), '/'); - $files = $this->share->dir($path); + try { + $files = $this->share->dir($path); + } catch (ForbiddenException $e) { + throw new NotPermittedException(); + } foreach ($files as $file) { $this->statCache[$path . '/' . $file->getName()] = $file; } @@ -595,7 +600,7 @@ class SMB extends Common implements INotifyStorage { $files = $this->getFolderContents($path); } catch (NotFoundException $e) { return false; - } catch (ForbiddenException $e) { + } catch (NotPermittedException $e) { return false; } $names = array_map(function ($info) { |