Skip to content

Commit 98c8cd5

Browse files
authored
Merge pull request #25383 from nextcloud/bugfix/24893
Properly handle SMB ACL blocking scanning a directory
2 parents 8fcc0e8 + e9ae943 commit 98c8cd5

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

apps/dav/lib/Connector/Sabre/Directory.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
use OCP\Files\FileInfo;
4242
use OCP\Files\ForbiddenException;
4343
use OCP\Files\InvalidPathException;
44+
use OCP\Files\NotPermittedException;
4445
use OCP\Files\StorageNotAvailableException;
4546
use OCP\Lock\ILockingProvider;
4647
use OCP\Lock\LockedException;
@@ -343,6 +344,8 @@ public function getQuotaInfo() {
343344
return [0, 0];
344345
} catch (\OCP\Files\StorageNotAvailableException $e) {
345346
return [0, 0];
347+
} catch (NotPermittedException $e) {
348+
return [0, 0];
346349
}
347350
}
348351

apps/files_external/lib/Lib/Storage/SMB.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
use OCP\Files\EntityTooLargeException;
6262
use OCP\Files\Notify\IChange;
6363
use OCP\Files\Notify\IRenameChange;
64+
use OCP\Files\NotPermittedException;
6465
use OCP\Files\Storage\INotifyStorage;
6566
use OCP\Files\StorageAuthException;
6667
use OCP\Files\StorageNotAvailableException;
@@ -235,7 +236,11 @@ private function getACL(IFileInfo $file): ?ACL {
235236
protected function getFolderContents($path): iterable {
236237
try {
237238
$path = ltrim($this->buildPath($path), '/');
238-
$files = $this->share->dir($path);
239+
try {
240+
$files = $this->share->dir($path);
241+
} catch (ForbiddenException $e) {
242+
throw new NotPermittedException();
243+
}
239244
foreach ($files as $file) {
240245
$this->statCache[$path . '/' . $file->getName()] = $file;
241246
}
@@ -595,7 +600,7 @@ public function opendir($path) {
595600
$files = $this->getFolderContents($path);
596601
} catch (NotFoundException $e) {
597602
return false;
598-
} catch (ForbiddenException $e) {
603+
} catch (NotPermittedException $e) {
599604
return false;
600605
}
601606
$names = array_map(function ($info) {

0 commit comments

Comments
 (0)