Commit graph

941 commits

Author SHA1 Message Date
Robin Appelman
0edce619c8 tell mysql to ignore the sort index for search queries
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-04-25 11:56:48 +00:00
blizzz
d455b2d21b
Merge pull request #31974 from nextcloud/backport/31878/stable22
[stable22] Fix incorrect if conditions in View
2022-04-14 22:01:27 +02:00
blizzz
75a4579cd7
Merge pull request #31819 from nextcloud/backport/31574/stable22
[stable22] use the nextcloud certificate bundle for s3
2022-04-14 14:38:17 +02:00
Côme Chilliet
8b1e16c4df Fix incorrect if conditions in View
($something->getPermissions() && Constants::PERMISSION_READ) does not
  make sense as PERMISSION_READ contant is 1 this will always evaluate to
  true.
getPersmissions is returning an int which is a bitwise combination as
  documented in the interface, so it should be used with bit operators.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-04-14 11:48:26 +00:00
Joas Schilling
4eff6b1c81 Deduplicate storage ids in list before reusing
Signed-off-by: Joas Schilling <coding@schilljs.com>
2022-04-04 17:17:38 +00:00
Robin Appelman
5725e38328 don't try to get custom certs for s3 primary storage
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-04-04 10:14:09 +00:00
Robin Appelman
63dd72fda0 use the nextcloud certificate bundle for s3
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-04-04 10:14:04 +00:00
Robin Appelman
cb3dc01163 fix fs cache test user setup
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-03-21 13:55:08 +00:00
Robin Appelman
1cfb740d68 pass user object during fs init
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-03-21 13:55:08 +00:00
Robin Appelman
3c413025b7 only setup part of the filesystem for appdata requests
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-03-21 13:55:08 +00:00
blizzz
06600f6036
Merge pull request #29565 from nextcloud/backport/25332/stable22
[stable22] Fix removing remote shares when the remote server is unreachable
2022-03-10 14:38:40 +01:00
Carl Schwan
0262cc33d7
Fix psalm
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-01-24 13:34:48 +01:00
acsfer
ad5ea4eb06 [stable22] Check for disk_free_space
Backport of https://github.com/nextcloud/server/pull/29758
2022-01-17 19:56:35 +00:00
Jonas Meurer
5d1157c37c
updateEncryptedVersion: cleanup on target if cache already got renamed
When moving a file to trash with encryption enabled, the cache gets
moved before the actual file. According to @icewind1991 this is in order
to not break object storage.

When moving a file from an unencrypted storage (e.g. a collectives
storage) to the encrypted trashbin storage, this causes errors, see

This commit fixes it by doing `updateEncryptedVersion()` on the target
cache entry *if* the source cache entry doesn't exist anymore, but the
corresponding target cache entry does exist already.

Fixes: #26544

Signed-off-by: Jonas Meurer <jonas@freesources.org>
2022-01-15 13:40:01 +01:00
Carl Schwan
5c155d1e53 Fix psalm issues
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-01-14 14:17:04 +00:00
Carl Schwan
79289c55f2 Add helper method in Wrapper
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-01-14 14:17:01 +00:00
John Molakvoæ
295348446b
Implement multibucket shift for ObjectStore
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
2022-01-14 08:32:04 +01:00
Vincent Petry
e455b71ecd Fix fail when keys/files folder already exists
Fixes an issue with transfer ownership in move mode where the folder
"files_encryption/keys/files" already exists.

Instead of failing, its existence is checked before calling mkdir.

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
2022-01-11 08:19:50 +00:00
Vincent Petry
76e5b1af7c Check resource before closing in encryption wrapper
In case of error there is no guarantee that $source or $target is set or
is a resource when handling an error.

Without this fix, there's a risk that fclose will fail and the actual
exception will not be thrown, making it impossible to find out about the
root cause.

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
2021-12-10 00:07:49 +00:00
Robin Appelman
73a8ea2d4e background scan the source storage when a background scan on a storage jail is triggered
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-12-06 01:11:44 +01:00
Joas Schilling
696e4f16a5
Check for invalid characters before trimming
Signed-off-by: Joas Schilling <coding@schilljs.com>
2021-11-25 15:39:19 +01:00
Robin Appelman
c4fa59c540 properly handle cases where cache wrappers block access
`CacheWrapper::formatCacheEntry` can return false for files that should be filtered out

Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-11-24 20:17:55 +01:00
Vincent Petry
a721d346b9 Normalize directory entries in Encoding wrapper
Directory entry file names are now normalized in getMetaData(),
getDirectoryContents() and opendir().

This makes the scanner work properly as it assumes pre-normalized names.

In case the names were not normalized, the scanner will now skip the
entries and display a warning when applicable.

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
2021-11-19 14:51:40 +00:00
Vincent Petry
2b4badf768 Move storage encoding compatibility warning logic
The encoding check for file names is now happening the Scanner, and an
event will be emitted only if the storage doesn't contain the encoding
compatibility wrapper.

The event is listened to by the occ scan command to be able to display a
warning in case of file name mismatches when they have NFD encoding.

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
2021-11-19 14:51:40 +00:00
Vincent Petry
787d7956cb Normalize file name before existence check in scanner
The scanner would not find a NFD-encoded file name in an
existing file list that is normalized.

This normalizes the file name before scanning.

Fixes issues where scanning repeatedly would make NFD files flicker in
and out of existence in the file cache.

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
2021-11-19 14:51:39 +00:00
Vincent Petry
8206b38f00 Update lib/private/Files/Storage/Wrapper/Availability.php add void
Signed-off-by: Vincent Petry <vincent@nextcloud.com>

Co-authored-by: Carl Schwan <carl@carlschwan.eu>
2021-11-05 14:06:18 +00:00
Vincent Petry
2421282497 Return false in hasUpdated when storage is not available
Technically, saying that a storage has no updates when it's not
available is correct.

This makes it possible to retrieve the cache entry for the mount point
and also to list and remove unavailable federated shares.

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
2021-11-05 14:06:18 +00:00
Sijmen Schoon
071eda7baa Move query outside the loop and reduce chunk size to 1000
This involved changing CacheQueryBuilder\whereParentIn to take a
parameter name, renaming the function accordingly.

Signed-off-by: Sijmen Schoon <me@sijmenschoon.nl>
2021-11-01 11:08:32 +00:00
Sijmen Schoon
ec3b1ccd91 Limit parameter count per query in Cache.removeChildren
Signed-off-by: Sijmen Schoon <me@sijmenschoon.nl>
2021-11-01 11:08:31 +00:00
Carl Schwan
8993cf86f1
Merge pull request #29475 from nextcloud/backport/29115/stable22
[stable22] Fix permissions when copying from ObjectStorage
2021-10-30 11:20:07 +02:00
MichaIng
5bd6a4fd29
Merge pull request #29415 from nextcloud/backport/27440/stable22
[stable22] Handle files with `is_file` instead of `file_exists`
2021-10-30 00:19:28 +02:00
Carl Schwan
7bf4a45f49 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-30 00:18:26 +02:00
acsfer
3a5d1c1faf 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:13 +00:00
Robin Appelman
5f438375a9 more reliable return value for Watcher::checkUpdate
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-10-22 12:34:30 +00:00
Robin Appelman
a4a4097068 s3 external storage listing rework
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-10-22 12:34:30 +00:00
Carl Schwan
887f4ba2fb 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:20 +00:00
acsfer
50791c61d3 Simplify :) 2021-10-18 07:59:00 +00:00
acsfer
269d9b5e0b Replace file_exists() method by is_file() 2021-10-18 07:58:59 +00:00
acsfer
698527d197 Get filesize() if file_exists()
Should make sense.
2021-10-18 07:58:59 +00:00
Julius Härtl
96abf31c3b
Merge pull request #29160 from nextcloud/backport/24185/stable22 2021-10-12 09:12:11 +02:00
Julius Härtl
9163894634
Merge pull request #29133 from nextcloud/backport/28907/stable22 2021-10-11 22:22:59 +02:00
Julius Härtl
3246eea0b6 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:10 +00:00
Daniel Kesselberg
15417f3824 explicitly close source stream on encryption storage
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2021-10-08 08:04:34 +00:00
Daniel Kesselberg
8ce2a320a1 explicitly close source stream on local storage
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2021-10-08 08:04:34 +00:00
Robin Appelman
d4fb676dd7 generate a better optimized query for path prefix search filters
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-10-07 15:19:58 +00:00
blizzz
9410141747
Merge pull request #28683 from nextcloud/backport/26463/stable22
[stable22] Fix S3 ObjectStore proxy option
2021-09-23 10:24:54 +02:00
Pauli Järvinen
11695164c6 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:25 +00:00
Maxime Besson
d99a72b801 fix(proxy): use accessor
Signed-off-by: Maxime Besson <maxime.besson@worteks.com>
2021-09-01 08:23:18 +00:00
Maxime Besson
956bccc1c0 fix(proxy): reaching s3 storage behind some http proxy
Signed-off-by: Maxime Besson <maxime.besson@worteks.com>
2021-09-01 08:23:18 +00:00
Samuel
4c9e7e2d39 fix(proxy): reaching s3 storage behind some http proxy
Signed-off-by: Maxime Besson <maxime.besson@worteks.com>
2021-09-01 08:23:18 +00:00