Commit graph

870 commits

Author SHA1 Message Date
MichaIng
e250aef6b4
Merge pull request #29416 from nextcloud/backport/27440/stable21
[stable21] Handle files with `is_file` instead of `file_exists`
2021-10-30 00:19:35 +02:00
Carl Schwan
00a9b0c1db Fix permissions when copying from ObjectStorage
Make sure that when a user copy a file from a directory they don't have
all permissions to a directory where they have more permissions, the
permissions are correctly set to the one from the parent taget folder.

This was caused by the ObjectStoreStorage::copyFromStorage using
the jailed storage and cache entry instead of the unjailed one like other
storages (the local one).
Steps to reproduce

+ Use object storage
+ Create a groupfolder with one group having full permission and another one
  who can just read files.
+ With an user who is in the second group, copy a file from the groupfolder to
  the home folder of this user.
+ The file in the home folder of the user will be read only and can't be deleted
  even though it is in their home folder and they are the owner. In oc_filecache,
  the permissions stored for this file are 1 (READ)

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2021-10-28 12:55:53 +00:00
Robin Appelman
99ba96524e
more reliable return value for Watcher::checkUpdate
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-10-26 14:45:08 +02:00
Robin Appelman
f18a76fec9
s3 external storage listing rework
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-10-26 14:41:46 +02:00
acsfer
eea1c23719 Handle files with is_file instead of file_exists
Should fix things like `fread(): read of 8192 bytes failed with errno=21 Is a directory`
2021-10-23 09:28:25 +00:00
Carl Schwan
ec8b2a90e6 Fix security issues when copying groupfolder with advanced ACL
Using advanced ACL, it is possible that an user has access to a
directory but not to a subdirectory, so the copying use
Common::copyFromStorage instead of Local::copyFromStorage.

Fix https://github.com/nextcloud/groupfolders/issues/1692

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2021-10-21 16:34:46 +00:00
acsfer
f57bbaf146 Simplify :) 2021-10-18 08:02:44 +00:00
acsfer
aeb0ad8cea Replace file_exists() method by is_file() 2021-10-18 08:02:44 +00:00
acsfer
0c1ccde7d2 Get filesize() if file_exists()
Should make sense.
2021-10-18 08:02:44 +00:00
Daniel
1ea652d611
Merge pull request #29159 from nextcloud/backport/24185/stable21
[stable21] Properly handle folder deletion on external s3 storage
2021-10-15 11:36:56 +02:00
Vincent Petry
5735a55509
Merge pull request #29080 from nextcloud/path-prefix-filter-21
[21] generate a better optimized query for path prefix search filters
2021-10-13 08:37:28 +02:00
Robin Appelman
916a838873
[21] generate a better optimized query for path prefix search filters
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-10-12 15:55:57 +02:00
Julius Härtl
df3ed040e4 Make sure that a empty directory can still be deleted when copied from another storage
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2021-10-11 08:01:08 +00:00
Daniel Kesselberg
b77b1d6bbd
explicitly close source stream on encryption storage
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2021-10-08 14:30:27 +02:00
Daniel Kesselberg
98d3836650
explicitly close source stream on local storage
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2021-10-08 14:30:27 +02:00
Vincent Petry
9722bb5c54
Fix psalm issue in Encryption stream
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
2021-10-08 12:15:04 +02:00
Robin Appelman
4180ca7a0b handle case where storage can't be created in getStorageRootId
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-09-30 13:21:40 +02:00
MichaIng
ea39319d2e
Merge pull request #28905 from nextcloud/backport/26832/stable21
[stable21] explicitly close source stream on object store upload even if count…
2021-09-24 13:35:41 +02:00
Pauli Järvinen
61acaf1fbd Support seeking also from the end of file on S3 storage
The PR https://github.com/nextcloud/server/pull/20033 added support
for `fseek` for  the S3 storage backend. However, the seek mode SEEK_END
was left out that time. This PR fills this gap.

Signed-off-by: Pauli Järvinen <pauli.jarvinen@gmail.com>
2021-09-20 18:13:18 +00:00
Daniel Kesselberg
dd9a08fa82
explicitly close source stream on object store upload even if countwrapper isn't needed
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2021-09-20 18:27:12 +02:00
Jasper Knockaert
bb092dd7cc fix even more brackets
Signed-off-by: Jasper Knockaert jasper@knockaert.nl
2021-09-03 13:40:42 +00:00
Jasper Knockaert
c1dcd06fe1 fix brakcets 2021-09-03 13:40:42 +00:00
Jasper Knockaert
5f9663d2c8 consolidation of boolean expression 2021-09-03 13:40:41 +00:00
Jasper Knockaert
82482adb48 avoid fread on directories and unencrypted files
Reworking the logic in order to first check the filecache and only then reading the fileheader.
This in order to solve #21578.
2021-09-03 13:40:40 +00:00
Vincent Petry
2032ca7457
Unregister enc stream wrapper for any exception
This prevents side effects in tests by properly cleaning up
even with expected exceptions.

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
2021-08-26 14:20:04 +02:00
Robin Appelman
ca3a6251d2
better cleanup of user files on user deletion
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-08-12 18:16:51 +02:00
Robin Appelman
4c954e7dd1 fix Folder->getById() when a single storage is mounted multiple times
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-08-09 17:32:20 +00:00
Robin Appelman
a9fbd0b41b
dont apply jail search filter is on the root
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-07-29 14:22:38 +02:00
John Molakvoæ
218a96ebf9
Revert "[stable21] better cleanup of filecache when deleting an external storage" 2021-07-27 15:51:10 +02:00
John Molakvoæ
606b5fe154
Merge pull request #27205 from nextcloud/backport/26936/stable21
[stable21] better cleanup of filecache when deleting an external storage
2021-07-27 14:04:25 +02:00
Robin Appelman
feb640cd64
better cleanup of filecache when deleting an external storage
this way it can delete the cache entries even with per-user credentials

Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-07-13 08:54:30 +02:00
Julius Härtl
c16d5b1077 Reset checksum when writing files to object store
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2021-07-01 15:36:07 +00:00
Julius Härtl
420d395947
Merge pull request #27415 from nextcloud/backport/26494/stable21 2021-06-14 09:48:41 +02:00
Julius Härtl
6e190b1a55
Merge pull request #27303 from nextcloud/backport/27062/stable21
[stable21] properly use limit and offset for search in Jail wrapper
2021-06-09 08:07:49 +02:00
Richard de Boer
9f3824b884 Check whether output buffering is active before turning it off
Before we just turned it off and @suppressed the error if ob was not active.
In PHP 8 this error is no longer suppressed, so try to not cause it at all.

Signed-off-by: Richard de Boer <git@tubul.net>
2021-06-07 21:33:53 +00:00
Richard de Boer
7e9d459fea Fix functions taking optional parameters before required ones
PHP 8 shows deprecation warnings about this, see #25806
Removes the "default" values, as they actually are required parameters anyway.

Signed-off-by: Richard de Boer <git@tubul.net>
2021-06-07 21:33:52 +00:00
Robin Appelman
287edf0e61
Set umask before operations that create local files
this solves issues where "other php stuff" is messing with the umask

Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-06-04 15:43:16 +02:00
Robin Appelman
a21eb8d6d2 properly use limit and offset for search in Jail wrapper
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-05-31 12:28:12 +00:00
Florent
ede67149ea Avoid reading ~/.aws/config when using S3 provider
When using S3 storage, we sometimes have open_basedir errors due to aws-sdk-php trying to read ~/.aws/config which is out of open_basedir restrictions.
Christoph Wurst already added csm=false config in #21406 but it wasn't enough, we also need to set use_arn_region=false, added in this commit.

Signed-off-by: Florent <florent@coppint.com>
2021-05-25 08:59:03 +00:00
Julius Härtl
80cda3b174 Fix log error when creating files from an empty template
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2021-05-19 07:03:27 +00:00
Julius Härtl
e2fffcda44 Fail when creating new files with an empty path
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2021-04-28 10:06:03 +00:00
Julius Härtl
dc8e819915 Properly handle creating the template directory in a subfolder (fixes #25787)
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2021-04-01 13:31:55 +00:00
Julius Härtl
89a19a338e Get the parent directory before creating a file from a template
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2021-04-01 13:31:55 +00:00
Julius Härtl
fc2e09b667 Properly end iterating over the file once the target has been reached
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2021-03-30 19:22:47 +00:00
Roeland Jago Douma
d65ce19f6e
Merge pull request #26291 from nextcloud/backport/21484/stable21
[stable21] show better error messages when a file with a forbidden path is encountered
2021-03-26 10:44:43 +01:00
Morris Jobke
cf8be87e47 Log when a storage is marked as unavailable
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2021-03-25 16:10:28 +00:00
Robin Appelman
fdf7eb10a2 show better error messages when a file with a forbidden path is encountered
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-03-25 10:56:59 +00:00
Morris Jobke
ffb7c51ca6
Merge pull request #26257 from nextcloud/backport/26198/stable21
[stable21] Handle limit offset and sorting in files search
2021-03-24 17:32:36 +01:00
John Molakvoæ (skjnldsv)
e9fafce71b Catch invalid cache source storage path
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2021-03-24 11:03:30 +00:00
Robin Appelman
d4381c0eac handle ordering in folder search
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-03-23 13:41:18 +00:00