Commit Graph

91 Commits (c0cce94d22f79dfdf5472845ea4e0712cd9fca2d)

Author SHA1 Message Date
Robin Appelman 3b0bebd8ad fix: handle smb timeouts as storage not available
Signed-off-by: Robin Appelman <robin@icewind.nl>
2025-08-06 15:17:47 +07:00
Robin Appelman 6cece4f4e1 feat: improve logging of fopen failures for smb
Signed-off-by: Robin Appelman <robin@icewind.nl>
2025-06-19 21:17:48 +07:00
provokateurin 6aea50c8b8 fix(files_external): Stop building path twice when checking if file exists on case insensitive SMB storage
Signed-off-by: provokateurin <kate@provokateurin.de>
2025-03-11 10:47:37 +07:00
Robin Appelman 5c0d4a4bea fix: detect deleted items as updated for smb storage
Signed-off-by: Robin Appelman <robin@icewind.nl>
2025-01-27 09:22:03 +07:00
Robin Appelman cc39714fb5
fix: smb: don't fail hard if we can't load acls for a file
Signed-off-by: Robin Appelman <robin@icewind.nl>
2024-11-14 16:01:36 +07:00
provokateurin 0de4843b73 refactor(Storage): Align all Storage constructors
Signed-off-by: provokateurin <kate@provokateurin.de>
2024-10-23 13:24:18 +07:00
provokateurin 14e6734547
refactor(files_external): Add Storage parameter strong types
Signed-off-by: provokateurin <kate@provokateurin.de>
2024-10-07 15:00:07 +07:00
Robin Appelman 103b464eea fix: use nc's binary finding logic for smb
Signed-off-by: Robin Appelman <robin@icewind.nl>
2024-10-04 15:56:31 +07:00
provokateurin 1302b48ca2
fix(files_external): Fix all IStorage return types
Signed-off-by: provokateurin <kate@provokateurin.de>
2024-09-26 17:29:48 +07:00
Marcel Klehr c8a90e941a fix(files_external): Catch correct exception
SMB#getFileInfo used to throw an icewind/smb exception, but nowadays throws \OCP\Files\ForbiddenException. This fixes downstream methods to catch the new exception.

Signed-off-by: Marcel Klehr <mklehr@gmx.net>
2024-09-26 09:03:08 +07:00
Côme Chilliet 1a4978c4ea
chore: Apply rector configuration to apps folder
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2024-09-20 17:51:00 +07:00
Daniel Kesselberg af6de04e9e
style: update codestyle for coding-standard 1.2.3
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2024-08-25 19:34:58 +07:00
Andy Scherzinger c1555fc33e
chore: Add SPDX header
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
2024-06-06 18:05:37 +07:00
Benjamin Gaussorgues 2cb0bf5437
fix(files_external): list root when using SMB case-insensitive option
Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
2024-02-05 11:24:12 +07:00
Benjamin Gaussorgues a45e12abc8
fix(files_external): on case insensitive system, block case change
When a file/directory is renamed to the same name with only case change,
the rename fail. We block this kind of rename.
The user will have to rename to another name first.

Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
2023-10-23 10:32:28 +07:00
Benjamin Gaussorgues 9b03dc52a4
Migrate files external to PSR LoggerInterface
Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
2023-08-01 09:44:57 +07:00
Faraz Samapoor 94f2f57519
Update apps/files_external/lib/Lib/Storage/SMB.php
Co-authored-by: Côme Chilliet <91878298+come-nc@users.noreply.github.com>
Signed-off-by: Faraz Samapoor <f.samapoor@gmail.com>
2023-06-05 16:21:14 +07:00
Faraz Samapoor cfb921b26c Refactors "strpos" calls in /apps/files_external to improve code readability.
Signed-off-by: Faraz Samapoor <f.samapoor@gmail.com>
2023-06-02 19:54:49 +07:00
Robin Appelman b1f352c614
improve handling of files we can't access in the scanner
instead of erroring, remove the items from the cache.

this situation can be triggered if a user has access to a file but looses it afterwards

Signed-off-by: Robin Appelman <robin@icewind.nl>
2023-04-05 14:44:55 +07:00
Carl Schwan a5ea677370 Rename file1 and file2 to source and target in Storage abstraction
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-10-18 17:21:47 +07:00
Carl Schwan 74e6976779 Use argument name from parent class
This will be an issue with php 8, so best to fix it now

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-10-17 10:58:27 +07:00
Carl Schwan ff4c8e9bee Force cast getCode to int
Otherwise psalm complains that the type can also be a non-falsy-string

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-10-16 23:38:31 +07:00
Carl Schwan d5c23dbb9f Move CappedMemoryCache to OCP
This is an helpful helper that should be used in more place than just
server and this is already the case with groupfodlers, deck, user_oidc
and more using it, so let's make it public

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-07-14 15:54:31 +07:00
Carl Schwan ec6b83cc18 Add stricter psalm type for CappedMemoryCache
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-05-12 15:06:18 +07:00
Vincent Petry bccb69f806
Merge pull request #30860 from nextcloud/smb-getdirectory-content-catch
handle notfound and notpermitted error in Smb::getDirectoryContent
2022-04-14 20:26:17 +07:00
Robin Appelman a6f245f6ff
type hint as generator
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-03-04 16:26:08 +07:00
Robin Appelman 5b77099612
handle invilid type when listing directory in smb
just handle it as an empty directory

Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-03-04 15:49:00 +07:00
Robin Appelman e2aa283dba
handle notfound and notpermitted error in Smb::getDirectoryContent
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-02-11 17:23:54 +07:00
Carl Schwan 365f5e425f
Add additional logging on SMB failure to read folder content
Currently we discard the error comming from the SMB library and create a
new exception for nextcloud. This patch makes sure that the
access/permission exception from the SMB library are logged correctly.

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2021-10-01 17:54:27 +07:00
Richard Steinmetz 2e53cf4c1f
Gracefully handle smb acls for users without a domain
Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
2021-08-13 09:43:50 +07:00
John Molakvoæ (skjnldsv) 215aef3cbd
Update php licenses
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2021-06-04 22:02:41 +07:00
Julius Härtl 8f01bc65f1
Continue iterating over diretory contents and just hide file if denied by acl
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2021-04-20 17:17:09 +07:00
Robin Appelman 43f70e5817
ignore readonly flag for directories
see http://support.microsoft.com/kb/326549

Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-03-25 12:03:09 +07:00
Robin Appelman 5ffaa94fbc
add (hidden) option to always show smb root as writable
some smb servers are very insistent in reporting that the root of the share is readonly, even if it isn't.

This works around the problem by adding a hidden option to overwrite the permissions of the root of the share.

This can be enabled using

```bash
occ files_external:config <mount id> root_force_writable true
```

where you can find your mount id using

```bash
occ files_external:list
```

Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-03-16 15:35:35 +07:00
Robin Appelman b844293536 catch notfound and forbidden exception in smb::getmetadata
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-03-04 21:34:54 +07:00
Julius Härtl e9ae943bba
Properly handle SMB ACL blocking scanning a directory
This makes sure that a possible ForbiddenException is properly passed
through the storage as a ForbiddenException and can be catched when
trying to fetch the quota info of a parent folder

Signed-off-by: Julius Härtl <jus@bitgrid.net>
2021-01-29 11:26:22 +07:00
Christoph Wurst 73c7d0dc81
Bump icewind/streams from 0.7.1 to 0.7.2
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-12-29 09:07:36 +07:00
Christoph Wurst d89a75be0b
Update all license headers for Nextcloud 21
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-12-16 18:48:22 +07:00
Robin Appelman 43b3049a4f
improve handling of out of space errors for smb
Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-09-17 17:23:33 +07:00
Morris Jobke fedf9c69d9
Use matching parameter names form interfaces and implementations
Found by Psalm 3.14.1

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2020-08-19 18:16:35 +07:00
Robin Appelman 23e2baeb95
Add option to check share ACL's when listing directories
If a file or folder in a directory doesn't have read permissions they
will not be shown

Note that enabling this option incurs a performance penalty additional
requests need to be made to get all the acl.

Additionally the acl resolving logic is fairly primitive at the moment
and might not work correctly in all setups (it should error to showing
the entry)

Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-04-21 16:26:12 +07:00
Robin Appelman 9735b5d61f
Add method to storage backends to get directory content with metadata
Currently you need to use `opendir` and then call `getMetadata` for
every file, which adds overhead because most storage backends already
get the metadata when doing the `opendir`.

While storagebackends can (and do) use caching to relief this problem,
this adds cache invalidation dificulties and only a limited number of
items are generally cached (to prevent memory usage exploding when
scanning large storages)

With this new methods storage backends can use the child metadata they
got from listing the folder to return metadata without having to keep
seperate caches.

Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-04-20 15:45:04 +07:00
Christoph Wurst caff1023ea
Format control structures, classes, methods and function
To continue this formatting madness, here's a tiny patch that adds
unified formatting for control structures like if and loops as well as
classes, their methods and anonymous functions. This basically forces
the constructs to start on the same line. This is not exactly what PSR2
wants, but I think we can have a few exceptions with "our" style. The
starting of braces on the same line is pracrically standard for our
code.

This also removes and empty lines from method/function bodies at the
beginning and end.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-10 14:19:56 +07:00
Christoph Wurst 14c996d982
Use elseif instead of else if
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-10 10:35:09 +07:00
Christoph Wurst 1a9330cd69
Update the license headers for Nextcloud 19
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-03-31 14:52:54 +07:00
John Molakvoæ fa4162e86f
Merge pull request #20208 from nextcloud/smb-folder-contents-normalize-path
normalize smb path while listing folder contents
2020-03-30 10:06:39 +07:00
Robin Appelman ef7bb5225a
normalize smb path while listing folder contents
currently when listing `'/'`, it will include a double slash in the paths used for the listing logic
this causes unneeeded cache misses in the statCache

Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-03-27 17:04:53 +07:00
Christoph Wurst b80ebc9674
Use the short array syntax, everywhere
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-03-26 16:34:56 +07:00
Christoph Wurst 5bf3d1bb38
Update license headers
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2019-12-05 15:38:45 +07:00
Roeland Jago Douma 88b6dc5eaf
Merge pull request #17258 from nextcloud/smb-timeout-config
add (hidden) option to configure smb timeout
2019-09-27 12:29:56 +07:00