Commit Graph

62 Commits

Author SHA1 Message Date
Ant Nikrooz 40307ce117
Merge 1f95f9b479 into fdb55c65f8 2021-06-02 15:36:14 -04: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 +02: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 +01: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 +01: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 +01:00
Ant Nikrooz 1f95f9b479
ACLs without \ in the username throw exception
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
2021-02-09 08:38:59 +00: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 +01: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 +01: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 +01: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 +02: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 +02: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 +02: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 +02: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 +02: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 +02: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 +02: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 +02: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 +01: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 +01:00
Christoph Wurst 5bf3d1bb38
Update license headers
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2019-12-05 15:38:45 +01: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 +02:00
Robin Appelman 194edfc64e
add (hidden) option to configure smb timeout
hidden from ui to prevent clutter

```occ files_external:config <mount> timeout 30```

Signed-off-by: Robin Appelman <robin@icewind.nl>
2019-09-25 13:30:40 +02:00
Arthur Schiwon 43bc31bacb
set a storage availability delay on auth issues to avoid lock out
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2019-08-22 12:40:15 +02:00
Arthur Schiwon cd62b38cc8
catch auth issues also when php-smbclient is in use
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2019-08-22 11:12:43 +02:00
Morris Jobke adc2ab4bb2
Ignore forbidden exception when fetching share mtime on SMB for symlinks
See https://github.com/nextcloud/server/pull/7556#issuecomment-499028026

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2019-07-08 21:43:24 +02:00
Robin Appelman 6d5579863e
add option to show hidden files in SMB shares
Note hidden files can mean different things in smb and the option the the files web ui,
the webui only counts files starting with '.' as hidden, while smb files
can be marked as hidden regardless, any files that are marked as hidden
on smb will thus be shown in the webui regardless of the setting in the files app.

Fixes #15644

Signed-off-by: Robin Appelman <robin@icewind.nl>
2019-05-23 21:23:56 +02:00
Morris Jobke 8563ab94aa
Merge pull request #10589 from nextcloud/smb-stat-retry
retry smb stat on timeout
2018-08-24 07:00:40 +02:00
Robin Appelman bdc6d0b5a1
log entries that are hidden during file listing
Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-08-16 01:20:05 +02:00
Robin Appelman 24aaa3bc97
retry stat on timeout
Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-08-08 16:07:41 +02:00
Morris Jobke e35451fd4e
Merge pull request #10025 from nextcloud/smb-rename-invalidargument-retry
also retry rename operation on InvalidArgumentException
2018-07-11 16:25:22 +02:00
Robin Appelman 27089422e1
Improved logging of smb connection errors
Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-07-03 14:56:37 +02:00
Robin Appelman 431710a5aa
also retry rename operation on InvalidArgumentException
Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-06-27 15:33:51 +02:00
Robin Appelman 90be8f336c
Add support for using kerberos ticket to authenticate to smb servers
Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-06-22 14:25:36 +02:00
Robin Appelman 4a424f86db
update icewind/smb to 3.0.0
Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-06-21 16:02:51 +02:00
Arthur Schiwon 38a90130ce
move log constants to ILogger
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2018-04-26 10:45:52 +02:00
Roeland Jago Douma 47a3008141
Remove \OCP\Files::tmpFile
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-03-19 10:52:35 +01:00
Roland Tapken 8e251e5d5a Make SMB module more fault-tolerant
Ignore unavailable files when fetching the share's mtime
or reading directory listings. This can happen on servers using a
distributed file system (DFS) with unavailable destinations, for example
when the remote server is offline.

Signed-off-by: Roland Tapken <roland@bitarbeiter.net>
2018-02-09 17:40:00 +01:00
Morris Jobke 9ff51aafc5
Use index based string access for substr with length of 1
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2018-01-26 13:38:34 +01:00
Morris Jobke b01d20c0d7
Merge pull request #7556 from nextcloud/smb-stat-exception
handle exceptions in SMB::stat
2017-12-18 22:31:05 +01:00
Robin Appelman 3fa13b48fc
handle exceptions in SMB::stat
Signed-off-by: Robin Appelman <robin@icewind.nl>
2017-12-18 15:55:46 +01:00
Robin Appelman 4f0d03e172
additional debug logging on smb copy/rename failures
Signed-off-by: Robin Appelman <robin@icewind.nl>
2017-12-18 13:59:58 +01:00
Morris Jobke 0eebff152a
Update license headers
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-11-06 16:56:19 +01:00
Joas Schilling 7a62fbd205 Fix comparisons in the files external app
Signed-off-by: Joas Schilling <coding@schilljs.com>
2017-08-01 13:56:12 +02:00
Robin Appelman acb0903514
remove duplicate method
Signed-off-by: Robin Appelman <robin@icewind.nl>
2017-04-26 16:45:04 +02:00
Robin Appelman 43970b93d1
remove excessive logging
Signed-off-by: Robin Appelman <robin@icewind.nl>
2017-04-26 16:41:48 +02:00
Juan Pablo Villafáñez 71012b3432
Adjust SMB permissions on the root 2017-04-26 16:23:52 +02:00
Morris Jobke c54a59d51e
Remove unused use statements
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-04-22 19:23:31 -05:00
Robin Appelman d14ff70050
add unit tests for smb notify backend
Signed-off-by: Robin Appelman <robin@icewind.nl>
2017-01-27 10:44:45 +01:00
Robin Appelman 269747985e
Add a more powerful notify mechanism
Signed-off-by: Robin Appelman <robin@icewind.nl>
2017-01-27 10:44:33 +01:00
Robin Appelman 8429687788
Update icewind/smb to 2.0.0
Signed-off-by: Robin Appelman <robin@icewind.nl>
2017-01-05 09:16:03 +01:00