Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2021-02-02 22:44:31 +0300
committerGitHub <noreply@github.com>2021-02-02 22:44:31 +0300
commite70ad108f6f48556428a80e21a3fd680bf407f07 (patch)
tree14fd7f77dc35ab72c91c60bf7ed5f3d1dcd7a791
parent9bb32124334f959f8d3abf98c924ba52329c58d1 (diff)
parentfcfa39183c2419608950bc00c359aea8365cf24b (diff)
Merge pull request #25421 from nextcloud/backport/25383/stable20
[stable20] Properly handle SMB ACL blocking scanning a directory
-rw-r--r--apps/dav/lib/Connector/Sabre/Directory.php3
-rw-r--r--apps/files_external/lib/Lib/Storage/SMB.php9
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 8718933bcde..e23c7a236ab 100644
--- a/apps/dav/lib/Connector/Sabre/Directory.php
+++ b/apps/dav/lib/Connector/Sabre/Directory.php
@@ -41,6 +41,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;
@@ -343,6 +344,8 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node implements \Sabre\DAV\ICol
return [0, 0];
} 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 c7e2583f08d..ef6ecb6cc74 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) {