Commit graph

1024 commits

Author SHA1 Message Date
Bjoern Schiessle
a2e2005e67 make sure that we always detect legacy files correctly 2015-07-17 13:30:08 +02:00
Morris Jobke
3fae984b56 Merge pull request #17282 from owncloud/s2s-catchremotelockexceptions
Throw lock exceptions if remote share returned 423 status code
2015-07-17 11:34:34 +02:00
Robin Appelman
da951ba059 Use the new IteratorDirectory instead of the fakedir wrapper 2015-07-15 13:57:53 +02:00
Vincent Petry
f62d94c4ff Throw StorageNotAvailable if propfind on root failed
If PROPFIND fails with 404 or 405 on the remote share root, it means the
storage is not available. Throw StorageNotAvailable is such case.
2015-07-13 18:28:53 +02:00
Morris Jobke
1006ec56ce Merge pull request #17481 from rullzer/mimetype-list
Move mimetypes.list.php to config/mimetypemapping.dist.json
2015-07-13 08:31:18 +02:00
Morris Jobke
d52e197b0d Merge pull request #16965 from owncloud/getUserFolder-in-IRootFolder
Add getUserFolder to IRootFolder
2015-07-09 14:29:47 +02:00
tbartenstein
c48e00294c Update fileinfo.php
Edits isMounted() to remove the check for 'local' prefix, so that folder icons are displayed correctly (see issue #10712)
2015-07-08 18:48:11 +02:00
Roeland Jago Douma
35fba1ef9f Move mimetypes.list.php to config/mimetypemapping.json
This allows users to add new mimetypemappings (extention -> mimetype)
themself. And not have to wait until a new release for updated
mimetypes.

Fixes: #15384
2015-07-08 13:18:58 +02:00
Thomas Müller
9120942bcf Merge pull request #16924 from owncloud/copy-recursive-polyfill
add recursive copy polyfill for storage backends
2015-07-06 17:05:36 +02:00
Thomas Müller
d3ac73c0c9 Remove OC_Log 2015-07-03 18:00:16 +02:00
Vincent Petry
3df27a01be Merge pull request #17379 from owncloud/kill-file-mapper
Remove file mapper - was only use in Windows and never worked properly
2015-07-03 17:53:47 +02:00
Robin Appelman
de4e4cb6ea also dont download existing on fopen when using w+ and wb+ 2015-07-03 15:53:02 +02:00
Robin Appelman
6cc65b53ab add phpdoc 2015-07-03 15:53:02 +02:00
Robin Appelman
232872e401 add flysystem adapater 2015-07-03 15:53:02 +02:00
Thomas Müller
f55aa856ad Remove file mapper - was only use in Windows and never worked properly 2015-07-03 15:41:29 +02:00
Robin Appelman
b849b7c7f2 better handling of folders 2015-07-03 13:43:22 +02:00
Morris Jobke
3e97ca3b96 Add getUserFolder to IRootFolder
* untangle DI of user specific folders
* allows to autodetect the dependency
2015-07-03 11:11:58 +02:00
Vincent Petry
f70791653c Merge pull request #17291 from owncloud/mount-manager-public
expose the mount manager in the public api
2015-07-03 07:57:31 +02:00
Vincent Petry
34043d4647 Throw lock exceptions if remote share returned 423 status code 2015-07-03 07:51:13 +02:00
Morris Jobke
f5c57e076e Merge pull request #17077 from owncloud/files-scan-absolute-path
fix getting mount points when passing a path to the files:scan command
2015-07-02 13:02:20 +02:00
Robin Appelman
57945dbc4b fix typehinting 2015-07-01 16:13:33 +02:00
Robin Appelman
faf642c31d expose the mount manager in the public api 2015-07-01 15:57:04 +02:00
Morris Jobke
1469177a3a Merge pull request #16406 from owncloud/enc-strlenperffix
Small perf tweak in strlen loop
2015-07-01 08:54:33 +02:00
Vincent Petry
16ff6cff54 Merge pull request #17256 from owncloud/locking-disablecallbackwrapperwhendisabled
Do not set callback wrapper when locking is disabled
2015-06-30 18:28:28 +02:00
Vincent Petry
0118bf04dc Merge pull request #17251 from owncloud/issue-17247-filesize-stat-failed-for-in-log
Perform the filesize on the file that exists
2015-06-30 14:51:29 +02:00
Vincent Petry
afd83caf69 Do not set callback wrapper when locking is disabled 2015-06-30 13:45:41 +02:00
Joas Schilling
9c533342fc Perform the filesize only when the file exists
Regression from 95602d4069
and 9b336765b6
2015-06-30 11:47:58 +02:00
Vincent Petry
167f57c15e Unlock first path on rename if second path is locked 2015-06-29 17:31:14 +02:00
Robin Appelman
8a2ef26b5e handle invalid results from mount providers 2015-06-29 14:42:34 +02:00
Joas Schilling
70eb20e3a7 Merge pull request #17030 from owncloud/lock-posthooks
Keep shared lock for post-hooks
2015-06-29 14:17:03 +02:00
Robin Appelman
786ec82a61 add unit test 2015-06-29 14:06:29 +02:00
Robin Appelman
8ec7e9fac7 fix getting mount points when passing a path to the files:scan command 2015-06-29 14:03:23 +02:00
Lukas Reschke
d1f0ff372e Merge pull request #17163 from owncloud/update-licenses
Update license headers
2015-06-27 20:22:23 +02:00
Vincent Petry
271ef9dedb Remove test-specific method to make Bjoern and Joas happy 2015-06-26 17:37:04 +02:00
Joas Schilling
9b336765b6 Correctly check if the real file exists, otherwise try the part file 2015-06-26 13:17:23 +02:00
Vincent Petry
538e466c30 Keep shared locks in post hooks
Instead of unlocking after the file operation, change exclusive locks
back to shared locks during post hooks, and unlock after that.

Also added unit tests to test locking in pre-hooks, during operation and
post-hooks.
2015-06-25 16:33:02 +02:00
Morris Jobke
f63915d0c8 update license headers and authors 2015-06-25 14:13:49 +02:00
Vincent Petry
58439c337c Merge pull request #17070 from owncloud/lock-movemountbug
Lock correct paths when moving mount
2015-06-24 18:37:48 +02:00
Morris Jobke
5f59393b30 Merge pull request #17110 from owncloud/share-error-handling
[sharing] handle shares of users that aren't available anymore
2015-06-24 17:38:34 +02:00
Vincent Petry
8859004a2b Rollback folder scan if an entry was locked 2015-06-24 15:42:00 +02:00
Vincent Petry
35047a2300 Fix locked paths in the moveMount case
When moving a mount point directly, the lock must be applied on the
local mount point path instead of the attached storage root.

Other operations will still lock the attached storage root.
2015-06-24 11:33:28 +02:00
Morris Jobke
4f2f8a6f28 [sharing] handle shares of users that aren't available anymore
* properly handle the case where an abandoned share is left and
  simply skip it
2015-06-23 18:22:36 +02:00
Morris Jobke
02b2b60581 Merge pull request #17095 from owncloud/proper-error-handling
Proper error handling
2015-06-23 17:40:55 +02:00
Björn Schießle
cce841c665 Merge pull request #17045 from owncloud/enc_improvements
encryption improvements
2015-06-23 14:30:21 +02:00
Bjoern Schiessle
95602d4069 make sure that we always read the header from the original file 2015-06-23 11:41:21 +02:00
Morris Jobke
fdd01cf15c Added error message on initMountpoints exception 2015-06-23 09:54:03 +02:00
Thomas Müller
ced15c44b4 Merge pull request #16657 from owncloud/view-emit-path
emit hooks from a view as long as the path is inside the default root
2015-06-22 11:29:11 +02:00
Vincent Petry
6697f9524c Merge pull request #16963 from owncloud/fileinfo-lock
Acquire read lock when getting file or directory info
2015-06-18 18:27:20 +02:00
Robin Appelman
17be0993b4 remove unneeded normalize 2015-06-18 15:33:44 +02:00
Robin Appelman
6018567df2 unlock the file if the file doesnt exists 2015-06-18 15:26:17 +02:00
Robin Appelman
d7960d5db6 dont update the cache on rename fail 2015-06-18 14:45:13 +02:00
Robin Appelman
2a50dbd1a1 update noopscanner 2015-06-18 14:42:48 +02:00
Robin Appelman
3e54696f7f extends phpdoc 2015-06-18 14:30:25 +02:00
Robin Appelman
3526b352dc update the file cache within the write lock 2015-06-18 13:47:03 +02:00
Robin Appelman
72eedda16c use old cache data when locked 2015-06-17 14:13:10 +02:00
Thomas Müller
d2305f2527 Merge pull request #16729 from owncloud/scanner-read-lock
keep a read lock while scanning a file or folder
2015-06-17 11:52:54 +02:00
Vincent Petry
102c6ffc41 Normalize path in View's lock methods 2015-06-16 17:03:12 +02:00
Vincent Petry
e5d34a2733 Merge pull request #16892 from owncloud/lock-returnfullpath
Rethrow LockedException with full path
2015-06-16 16:47:10 +02:00
Vincent Petry
0e3a3dd5d7 Rethrow LockedException with full path
Because the path is converted to md5 from the original exception,
rethrow the exception with the correct full path
2015-06-16 10:48:31 +02:00
Robin Appelman
4b181f73ca phpdoc 2015-06-15 15:41:52 +02:00
Robin Appelman
567df226e5 fix check if hooks should be emited in runHooks 2015-06-15 15:07:48 +02:00
Robin Appelman
9c0d69a3b2 ensure normalized path form when changing locks 2015-06-15 14:32:29 +02:00
Robin Appelman
a4f808b11d properly unlock in case of failed fopen 2015-06-15 14:32:29 +02:00
Robin Appelman
7d72f7d8ce keep a read lock while scanning a file or folder 2015-06-15 14:32:29 +02:00
Thomas Müller
911c43e5f9 Merge pull request #16727 from owncloud/file-put-content-lock
add proper locking to file_put_contents when using streams
2015-06-15 14:22:06 +02:00
Robin Appelman
2fb8a76705 add recursive copy polyfill for storage backends 2015-06-14 15:15:21 +02:00
Vincent Petry
4497aa4c68 Webdav PUT small file lock must be shared during hooks
Fixed code path for Webdav PUT of small files to use shared locks during
hook execution, and exclusive during the file operation

This makes it possible for versions to be copied by accessing the file
in a post_write hook.
2015-06-12 18:52:18 +02:00
Joas Schilling
5586b2db09 Don't use limit on explode to have only 1 code path 2015-06-12 11:58:26 +02:00
Joas Schilling
a7d2b3b9ae Add return value to lock methods and check it in tests 2015-06-12 11:41:05 +02:00
Joas Schilling
caf16b083e Only lock files in data/username/files/ 2015-06-12 11:09:38 +02:00
Thomas Müller
a968b8409d Merge pull request #16158 from owncloud/mountprovider-after-setup
Call newly registered mount providers after the filesystem is setup
2015-06-08 13:42:02 +02:00
Joas Schilling
bb0cb0aaec Merge pull request #15895 from owncloud/dav-getremoteetag
Get etag from remote OC server
2015-06-03 17:20:25 +02:00
Robin Appelman
bcf13aff6f change lock back to shared before updating the cache 2015-06-03 17:18:50 +02:00
Robin Appelman
6b0874203d add proper locking to file_put_contents when using streams 2015-06-03 17:18:50 +02:00
Robin Appelman
0497534a6e more type hints 2015-06-02 14:07:55 +02:00
Robin Appelman
8926bca0c7 phpdoc, strict and type hints 2015-06-02 14:07:55 +02:00
Robin Appelman
6f47a547d8 only use mount provider if we have a valid user 2015-06-02 14:07:54 +02:00
Robin Appelman
24131586d7 call mount providers that are registered after the filesystem is setup 2015-06-02 14:07:54 +02:00
Robin Appelman
4b48dd424f emit hooks from a view as long as the path is inside the default root 2015-06-02 14:07:20 +02:00
Thomas Müller
3ebc8f0564 Merge pull request #16107 from owncloud/fix-getLocalFile-encryption-master
Fix get local file encryption master
2015-06-02 13:47:37 +02:00
Vincent Petry
30d7f92763 Get etag from remote OC server 2015-06-02 11:42:03 +02:00
Robin Appelman
ce04cf6610 shared lock around hooks 2015-06-01 13:24:02 +02:00
Robin Appelman
661c9e2444 add changeLock to the storage api 2015-06-01 13:24:02 +02:00
Robin Appelman
437c0b55a6 unlock source file when we cant lock the target in a rename 2015-06-01 13:22:56 +02:00
Robin Appelman
f0b8672729 fix locking root of a view 2015-06-01 13:22:56 +02:00
Robin Appelman
2d63fd77de dont apply callback wrapper when fopen failed 2015-06-01 13:22:56 +02:00
Robin Appelman
1270c6800d dont lock on meta data operations 2015-06-01 13:22:56 +02:00
Robin Appelman
35c377f7a9 phpdoc and minor issues 2015-06-01 13:22:56 +02:00
Vincent Petry
8d53dc803f Use md5 + prefix for file locking keys in memcache
Also trim slashes from paths to make sure the locks are based on the
same paths.
2015-06-01 13:22:56 +02:00
Vincent Petry
0775e9c1ca Use md5 for lock key 2015-06-01 13:22:56 +02:00
Robin Appelman
a1a25a9b5b fix unlocking when moving mount points 2015-06-01 13:22:56 +02:00
Robin Appelman
7e418c7d69 high level locking wip 2015-06-01 13:22:56 +02:00
Robin Appelman
bf7002bc65 add locking to the view apo 2015-06-01 13:22:56 +02:00
Robin Appelman
536e187e51 add locking to the storage api 2015-06-01 13:22:56 +02:00
Vincent Petry
e114d00242 Only use quota stream wrapper on "files"
Prevent using the quota stream wrapper on trashbin folders and other
metadata folders
2015-05-28 18:31:20 +02:00
Vincent Petry
ded62ff693 Merge pull request #16501 from owncloud/enc_fix_move_versions_between_storages
[encryption] fix move versions between storages
2015-05-28 15:28:25 +02:00
Bjoern Schiessle
0de59acb49 only request encryption module for files which are not excluded 2015-05-27 15:47:40 +02:00
Thomas Müller
4513cf5967 Revert "Revert "Revert "FIX for webdav.mediencenter.t-online.de""" 2015-05-26 14:40:07 +02:00
Oliver Kohl D.Sc
f8938f004d Revert "Revert "FIX for webdav.mediencenter.t-online.de"" 2015-05-26 13:36:45 +02:00
Björn Schießle
ab0747113c Merge pull request #16452 from owncloud/enc_ftp_upload
always write file, if fseek doesn't work we write the whole file
2015-05-26 12:02:41 +02:00
jknockaert
a577e723b0 flush() comments + perf opt 2015-05-26 10:22:52 +02:00
Bjoern Schiessle
c63f2286c0 copy keys before we move a file between storages to make sure that the new target file reuses the old file key, otherwise versions will break 2015-05-22 15:41:28 +02:00
Vincent Petry
b82d902e18 Merge pull request #16493 from owncloud/cache-movewithcorrectmimetype
Get correct mimetype when moving and changing extension
2015-05-22 11:37:11 +02:00
Joas Schilling
d7b2bc9e2f Merge pull request #16516 from owncloud/fix-phpdoc-trait
Fix PHPDoc
2015-05-22 09:47:59 +02:00
Lukas Reschke
3d8ea96e55 Fix PHPDoc
Use correct parameters
2015-05-22 00:17:38 +02:00
jknockaert
bf6151e799 fix calculation of $count, $count is always 8129 so we need to check this
against the unencrypted file size
2015-05-21 14:15:26 +02:00
Bjoern Schiessle
5a20edac82 test to simulate a non-seekable stream wrapper 2015-05-21 14:15:26 +02:00
jknockaert
fb51880a4a encrypted filesize calculation in flush() 2015-05-21 14:15:26 +02:00
Vincent Petry
22968e806c Get correct mimetype when moving and changing extension
Fixes issue when restoring folders from trash cross-storage, as such
folders have an extension ".d12345678".

Fixes issue when moving folders between storages and at the same time
changing their extension.
2015-05-21 10:57:58 +02:00
Morris Jobke
39d1e99228 Merge pull request #16322 from owncloud/trash-view
dont go trough the view when moving to trash
2015-05-20 14:44:01 +02:00
Thomas Müller
f9d04f62a8 Merge pull request #16440 from owncloud/scrutinizer-patch-1
Scrutinizer Auto-Fixes
2015-05-19 22:12:35 +02:00
Joas Schilling
d832c4ae23 Fix unexisting class and broken doc 2015-05-19 15:27:50 +02:00
Robin Appelman
9c751f1d87 use copy when doing a crossStorageCopy on the same storage 2015-05-19 14:21:58 +02:00
Scrutinizer Auto-Fixer
fdbc21fc6c Scrutinizer Auto-Fixes
This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
2015-05-19 11:23:06 +00:00
Björn Schießle
1c411baf17 Merge pull request #16412 from owncloud/jknockaert-patch-1
fix #16356
2015-05-18 19:26:40 +02:00
Clark Tomlinson
f9b6ee86cd Merge pull request #16399 from owncloud/enc_rmdir_fix
[encryption] only try to delete file keys if it is a valid path
2015-05-18 11:09:36 -04:00
jknockaert
2834971a77 fix #16356 2015-05-18 15:06:55 +02:00
Björn Schießle
a1e60e7882 Merge pull request #15980 from owncloud/jknockaert-patch-1
fix bug #15973
2015-05-18 15:01:16 +02:00
Vincent Petry
9d3d7ec659 Small perf tweak in strlen loop 2015-05-18 13:27:22 +02:00
Bjoern Schiessle
efa674f10d only try to delete file keys if it is a valid path 2015-05-18 11:54:51 +02:00
Bjoern Schiessle
887be709f5 a new approach to display the error message 2015-05-18 10:15:17 +02:00
Bjoern Schiessle
ccbefb6e75 delete all file keys doesn't need the encryption module as parameter; implement rmdir; getFileKeyDir should also work for part files and complete directories 2015-05-13 19:06:23 +02:00
Morris Jobke
dc362823e0 Merge pull request #16269 from owncloud/master-fix-16179
Check if cURL supports the desired features
2015-05-12 18:27:57 +02:00
Lukas Reschke
4613456a8a Check if cURL supports the desired features
Older versions of cURL that are unfortunately still bundled by distributors don't support these features which will result in errors and other possibly unpredictable behaviour.

Fixes https://github.com/owncloud/core/issues/16179 for master – stable8 requires another patch.
2015-05-12 12:00:56 +02:00
Bjoern Schiessle
0d5c7a11e2 use hooks to update encryption keys instead of the storage wrapper if a file gets renamed/restored, as long as we
are in the storage wrapper the file cache isn't up-to-date
2015-05-11 12:06:57 +02:00
Joas Schilling
aea734aaf1 Fix missing types on doc block and deduplicate the method name 2015-05-06 14:31:10 +02:00
Bjoern Schiessle
e4829a2358 update 'encrypted'-flag in file cache according to the storage settings 2015-05-06 14:20:05 +02:00
Bjoern Schiessle
dc39bda870 move/copy from storage 2015-05-06 14:20:02 +02:00
Bjoern Schiessle
83ed4ee5b6 unit tests 2015-05-06 12:28:15 +02:00
Bjoern Schiessle
e7a3911c83 check if encryption is enbaled before we start moving keys 2015-05-06 11:35:45 +02:00
Thomas Müller
35a2fd3f89 Only return cached files if existing 2015-05-06 11:16:44 +02:00
Morris Jobke
874d35b27a Merge pull request #16070 from owncloud/enc_update_file_cache_on_copy
make sure that we keep the correct encrypted-flag and the (unencrypted)size
2015-05-06 10:28:10 +02:00
Thomas Müller
a96c2b8354 Only use cached files in case encryption is enabled - in any other case let the underlying storage handle this accordingly - refs #16061 #16062 and others 2015-05-05 16:19:24 +02:00
Bjoern Schiessle
7089af96f2 make sure that we keep the correct encrypted-flag and the (unencrypted)size if a file gets copied 2015-05-05 16:17:14 +02:00
Robin Appelman
e0d151505f improve phpdoc of cache classes 2015-05-05 16:06:28 +02:00
jknockaert
f5415653fd fix #15973
Rework of stream_seek handling; there where basically two bugs: 1. seeking to the end of the current file would fail (with SEEK_SET); and 2. if seeking to an undefined position (outside 0,unencryptedSize) then newPosition was not defined. I used the opportunity to simplify the code.
2015-04-30 17:10:18 +02:00
Morris Jobke
de8c15e1a4 Merge pull request #14764 from owncloud/shared-etag-propagate
Propagate etags across shared storages
2015-04-28 10:58:50 +02:00
Thomas Müller
7d0eba7a41 Merge pull request #15886 from owncloud/fix-15848-master
Adjust isLocal() on encryption wrapper
2015-04-27 15:06:26 +02:00
Thomas Müller
678b7d7e4d Merge pull request #15860 from owncloud/enc_fallback_old_encryption
[encryption] handle encrypted files correctly which where encrypted with a old version of ownCloud (<=oc6)
2015-04-27 14:32:19 +02:00
Thomas Müller
936d564058 fixes #15848 2015-04-27 14:26:05 +02:00
Robin Appelman
45784f213f fix propagation when renaming a directly reshared folder 2015-04-27 14:07:16 +02:00
Robin Appelman
849e5521de Make the change propagator an emitter 2015-04-27 14:07:15 +02:00
Bjoern Schiessle
27683f9442 fall back to the ownCloud default encryption module and aes128 if we read a encrypted file without a header 2015-04-27 13:01:18 +02:00
Joas Schilling
d600955a51 Make getDefaultModuleId public and get module protected 2015-04-27 11:03:51 +02:00
Bjoern Schiessle
9a5783b284 fix unit tests 2015-04-24 16:47:27 +02:00
jknockaert
49df8ef525 Update encryption.php 2015-04-24 16:44:00 +02:00
jknockaert
238302ee7d fixed name 2015-04-24 16:44:00 +02:00
jknockaert
1756562501 Update encryption.php 2015-04-24 16:44:00 +02:00
jknockaert
735f6cc037 fix encryption header error
When moving back the pointer to position 0 (using stream_seek), the pointer on the encrypted stream will be moved to the position immediately after the header. Reading the header again (invoked by stream_read) will cause an error, writing the header again (invoked by stream_write) will corrupt the file. Reading/writing the header should therefore happen when opening the file rather than upon read or write. Note that a side-effect of this PR is that empty files will still get an encryption header; I think that is OK, but it is different from how it was originally implemented.
2015-04-24 16:43:16 +02:00
Joas Schilling
1592be117a Use public interfaces for type hinting 2015-04-24 13:06:03 +02:00
Bjoern Schiessle
24128d1384 only update share keys if the file was encrypted 2015-04-24 10:19:09 +02:00
Bjoern Schiessle
2646bccb83 update share keys if file gets copied 2015-04-23 17:18:48 +02:00
Bjoern Schiessle
2990b0e07e update share keys if a file is moved to a shared folder 2015-04-23 17:18:48 +02:00
Vincent Petry
903d52d45f Merge pull request #15809 from owncloud/view-null-root
dont allow using null as view root
2015-04-22 18:10:26 +02:00
Robin Appelman
bd57902d1d typo 2015-04-22 16:24:37 +02:00
Thomas Müller
750f0bc489 Merge pull request #15799 from owncloud/fix-enc-folder-move
Fix enc folder move
2015-04-22 16:04:29 +02:00
Robin Appelman
f391f88d7f dont allow using null as view root 2015-04-22 14:51:02 +02:00
Morris Jobke
a971fa8a90 Merge pull request #15549 from owncloud/jcf-fix-cache-update
don't update identical values
2015-04-22 13:34:08 +02:00
Thomas Müller
225cde2183 pass KeyStorage via ctor 2015-04-22 13:09:42 +02:00
Thomas Müller
987bc138df calling renameKeys() on directory level as well - fixes #15778 2015-04-22 12:12:27 +02:00
Thomas Müller
fc4127dd62 add $encryptionModuleId to methods of Keys/IStorage 2015-04-22 11:53:05 +02:00
Björn Schießle
570718fb6b Merge pull request #15757 from owncloud/enc-fixfeofforlastblock
Fix encryption feof to not return too early
2015-04-22 11:32:21 +02:00
Bjoern Schiessle
19e8c4fcb1 get dirname from sharePath 2015-04-21 14:58:01 +02:00
Björn Schießle
b0fcf0fa0e Merge pull request #15636 from owncloud/enc2_performance_improvement
[encryption2] set size and unencrypted size to zero at the beginning of a write operation
2015-04-21 11:01:33 +02:00
Vincent Petry
76dad297ff Fix encryption feof to not return too early
This is because stream_read will pre-cache the next block which causes
feof($this->source) to return true prematurely. So we cannot rely on it.

Fixed encryption stream wrapper unit tests to actually simulate 6k/8k
blocks to make sure we cover the matching logic.

Added two data files with 8192 and 8193 bytes.
2015-04-20 18:32:40 +02:00
Thomas Müller
32995ace1c move permission related code into getMetaData() 2015-04-20 16:50:12 +02:00
Thomas Müller
23f1bdc3d4 Introduce Storage::getMetaData() to allow storage implementations more control over the data array 2015-04-20 14:54:54 +02:00
Thomas Müller
92b60e36de Introduce Storage::getData() to allow storage implementations more control over the data array 2015-04-20 14:25:39 +02:00
Bjoern Schiessle
7fe0e09d14 set size and unencrypted size to zero on fopen 2015-04-20 11:06:13 +02:00
Bjoern Schiessle
67500d5f2f if we start writing a file from the beginning, size should start by zero; result of floor needs to be casted to int in order to compare it with ->size 2015-04-16 14:15:04 +02:00
Bjoern Schiessle
e3d77c4b01 add migration script from old encryption to new one 2015-04-16 14:15:04 +02:00
Björn Schießle
4f0437fbde Merge pull request #15598 from owncloud/fix-enc-file-size-master
Fix file size of encrypted files
2015-04-14 16:48:04 +02:00
Morris Jobke
82cab25762 Merge pull request #13360 from owncloud/cross-storage-move
Proper copy/move between multiple local storages
2015-04-14 14:35:08 +02:00
Thomas Müller
967e882757 return size from cache in case the cache entry is marked as encrypted 2015-04-14 13:08:59 +02:00
Thomas Müller
387984a0d5 preserve filesize on rename after upload 2015-04-14 12:27:12 +02:00
Robin Appelman
f605c98531 Fix cross storage move with shared storages 2015-04-13 17:10:05 +02:00
Robin Appelman
addfafd9da Fix moving mount points 2015-04-13 17:10:02 +02:00
Robin Appelman
caadc8cdd9 reuse cache move logic 2015-04-13 17:10:01 +02:00
Robin Appelman
d7b3a1a35a preserve cache data when doing a cross storage move 2015-04-13 17:10:01 +02:00
Robin Appelman
c29419e6d7 fix rebase issue 2015-04-13 15:13:03 +02:00
Robin Appelman
0772e3b4c1 Properly handle copy/move failures in cross storage copy/move 2015-04-13 15:13:03 +02:00
Robin Appelman
404773940d Detect storage full when doing cross storage copy/move 2015-04-13 15:13:03 +02:00
Robin Appelman
d26c6cab90 properly return false if we cant delete the source file 2015-04-13 15:13:03 +02:00
Robin Appelman
c4ec8fbeff Make getSourcePath accessible for storage wrappers 2015-04-13 15:13:03 +02:00
Robin Appelman
31e94708f8 Improve cross storage copy between local storages 2015-04-13 15:13:02 +02:00
Robin Appelman
8575bb2cb9 Move cross storage copy logic to the storage 2015-04-13 15:13:02 +02:00
Robin Appelman
b302592a64 Small cleanup of rename code 2015-04-13 15:11:03 +02:00
Vincent Petry
2822d0579e Properly add trailing slash to mount point
Fixes resolving mount points when shared mount point's target name has
the same prefix as the source name
2015-04-13 12:36:47 +02:00
Thomas Müller
8450b6aa2d Properly import used classes 2015-04-13 09:26:30 +02:00
Jens-Christian Fischer
9c95315a9e clarify the duplication of the $params array 2015-04-12 14:49:18 +02:00
Jens-Christian Fischer
22c6216f5c don't update identical values
The UPDATE oc_filecache statement blindly overwrites identical data.
Databases like Postgres that create a new row on an update
and mark the old one as dead will suffer from the previous
behaviour, as millions of "new" rows are created in the database.

This patch changes the WHERE clause to test for identical
values and not updating if the values in the DB are identical
to the ones being passed.
2015-04-11 18:06:21 +02:00
Thomas Müller
7b2d53603c Merge pull request #15489 from owncloud/dont_hide_exceptions_master
Dont hide exceptions master
2015-04-10 15:49:45 +02:00
Vincent Petry
73afca6207 Catch more exceptions when connecting to remote DAV server
Added InvalidArgumentException to catch HTML parsing errors when XML was
expected.
Made convertSabreException more generic to be able to handle more
exception cases.
2015-04-10 12:02:06 +02:00
Jörn Friedrich Dreyer
b069f33a72 throw exception when backends don't provide a user instead of creating legacy local storages 2015-04-10 09:12:37 +02:00
Jörn Friedrich Dreyer
8af52e3876 fixes #15326 2015-04-09 15:37:00 +02:00
Morris Jobke
4e60b81264 Merge pull request #14120 from owncloud/dav-statcache
Stat cache for DAV storage, improves s2s performance a little bit
2015-04-08 21:09:28 +02:00
Bjoern Schiessle
c379557e1d don't throw exception if a file gets uploaded and encryption is disabled 2015-04-08 16:41:20 +02:00
Morris Jobke
59322a5037 Merge pull request #15333 from owncloud/copy-cross-device
fix copying folder across devices
2015-04-08 12:35:15 +02:00
Thomas Müller
a4483243ac fixing license headers - encryption code related 2015-04-07 17:02:49 +02:00
Thomas Müller
4a70ca665c respect mount option while encrypting 2015-04-07 13:30:31 +02:00
Thomas Müller
111fbabfb4 PHPDoc cleanup - clean code \o/ 2015-04-07 13:30:31 +02:00
Thomas Müller
69e95531f8 comment change as it broke unit tests 2015-04-07 13:30:31 +02:00
Thomas Müller
ba9a797eaa Encryption storage wrapper is enabled by default - necessary to detect encrypted files even if encryption was disabled after files have been encrypted - prevents data corruption 2015-04-07 13:30:31 +02:00
Bjoern Schiessle
fe74a0cb4f implement webdav copy 2015-04-07 13:30:31 +02:00
Thomas Müller
8991272269 Using stream_get_contents in file_get_contents implementation + close handle 2015-04-07 13:30:31 +02:00
jknockaert
ff16e3dbff Adjusting count on read 2015-04-07 13:30:31 +02:00
jknockaert
02404a6a8c Fixing encryption stream wrapper seek - thanks @jknockaert 2015-04-07 13:30:30 +02:00
Thomas Müller
104d11ec4c Fixing encryption storage wrapper tests 2015-04-07 13:30:30 +02:00
Thomas Müller
d9c41b00ab Introducing trait LocalTempFileTrait 2015-04-07 13:30:30 +02:00
Thomas Müller
8ffa6db110 fixing unit tests for stream wrapper 2015-04-07 13:30:30 +02:00
Thomas Müller
9d8c07850d fixing unencrypted file size 2015-04-07 13:30:30 +02:00
Thomas Müller
c9d6ed3d7d in case the file exists we require the explicit module as specified in the file header - otherwise we need to fail hard to prevent data loss on client side 2015-04-07 13:30:30 +02:00
Thomas Müller
cac83642f2 Finally fixing encryption with public share 2015-04-07 13:30:30 +02:00
Thomas Müller
137c135664 file_put_contents has to return the number of written bytes 2015-04-07 13:30:30 +02:00
Bjoern Schiessle
83cb382b3f pass file helper to encryption wrapper 2015-04-07 13:30:29 +02:00
Bjoern Schiessle
e4895bda01 add helper class accessible for encryption modules to ask for a list of users with access to a file, needed to apply the recovery key to all files 2015-04-07 13:30:29 +02:00
Thomas Müller
1b42b492dc kill OC_FileProxy 💥 2015-04-07 13:30:28 +02:00
Thomas Müller
99255ff3a9 Fix - public sharing: in case on user is available - get it from the path 2015-04-07 13:30:28 +02:00
Bjoern Schiessle
0eee3a2618 remove unencrypted_size from the cache, size will contain the unencrypted size 2015-04-07 13:30:28 +02:00
Thomas Müller
d185761d31 initializing some variables + update size after writing the headers 2015-04-07 13:30:28 +02:00
Thomas Müller
4441835d18 https://github.com/owncloud/core/pull/15305#discussion_r27382305
Conflicts:
	lib/private/files/stream/encryption.php
2015-04-07 13:30:28 +02:00
Thomas Müller
90487384f7 initializing some variables 2015-04-07 13:30:28 +02:00
Bjoern Schiessle
0c48b069ba call end() before closing the file 2015-04-07 13:30:28 +02:00
Thomas Müller
498625ea3a adding unit tests for stream wrapper 2015-04-07 13:30:28 +02:00
Thomas Müller
a905f641b3 various fixes & start to unit test the encryption storage wrapper 2015-04-07 13:30:28 +02:00
jknockaert
3e6eb28ee3 Applying diff as of https://github.com/owncloud/core/pull/15303 2015-04-07 13:30:28 +02:00
Bjoern Schiessle
cb9980823d core: small fixes 2015-04-07 13:30:27 +02:00
Bjoern Schiessle
810ca9105c implement rename and delete of encryption keys 2015-04-07 13:30:27 +02:00
Joas Schilling
a8d1ede347 Fix the exception messages 2015-04-02 18:40:06 +02:00
Robin Appelman
f585994c4b setup mount manager before wrappers 2015-04-02 13:28:36 +02:00
Robin Appelman
068c624b0d fix copying folder across devices 2015-03-31 13:50:11 +02:00
Thomas Müller
722e50a112 Merge pull request #15240 from owncloud/storage-wrapper-priority
add priority to storage wrappers
2015-03-27 15:18:44 +01:00
Bjoern Schiessle
c6be1ba8d3 fix check if a file is excluded from encryption or not 2015-03-27 11:51:50 +01:00
Vincent Petry
670ca68453 Added stat cache for DAV storage
The stat cache stored known states of files/folders to avoid requerying
the DAV server multiple times.
2015-03-26 23:15:53 +01:00
Robin McCorkell
c2909355bf Merge pull request #14925 from owncloud/ext-mountoptions-ui
Mount options GUI for external storage
2015-03-26 21:36:34 +00:00
Robin Appelman
cb9ead7dde add priority to storage wrappers 2015-03-26 21:26:38 +01:00
Thomas Müller
232518ac54 Merge pull request #15234 from owncloud/encryption2_core
core part of encryption 2.0
2015-03-26 21:14:59 +01:00
Bjoern Schiessle
ff9c85ce60 implement basic encryption functionallity in core to enable multiple encryption modules 2015-03-26 20:56:51 +01:00
Vincent Petry
58b4c2c0e5 Make sure mountOptions keep their data type
str_replace for $user substitution was converting the data type of
mountOptions to string. This fix prevents this to happen by making sure
only strings are processed by substitution.

Also added a int conversion when reading the watcher policy
2015-03-26 19:24:37 +01:00
Jenkins for ownCloud
b585d87d9d Update license headers 2015-03-26 11:44:36 +01:00
Morris Jobke
24d0dfc727 Revert "FIX for webdav.mediencenter.t-online.de" 2015-03-26 00:56:06 +01:00
Oliver Kohl D.Sc.
9323285987 FIX for webdav.mediencenter.t-online.de
https://webdav.mediencenter.t-online.de returns invalid response code.

e.g.
{"reqId":"f9a1c394b98108e4e5ca62bf47829c64","remoteAddr":"81.189.45.224","app":"PHP","message":"Undefined offset: 2 at \/var\/www\/owncloud\/3rdparty\/sabre\/dav\/lib\/Sabre\/DAV\/Client.php#569","level":3,"time":"2015-03-25T18:25:48+00:00","method":"GET","url":"\/index.php\/apps\/files\/ajax\/getstoragestats.php?dir=External%2FT-Cloud%2FTests"}

e.g.
{"reqId":"3407d66672b3cef206b0af883e49bff4","remoteAddr":"46.74.125.245","app":"PHP","message":"Undefined index: {DAV:}getlastmodified at \/var\/www\/owncloud\/lib\/private\/files\/storage\/dav.php#563","level":3,"time":"2015-03-25T16:33:21+00:00"}
2015-03-25 21:29:29 +01:00
Robin Appelman
d11f01fa0f Add getNonExistingName() to the node api 2015-03-24 15:00:36 +01:00
Vincent Petry
67160e0861 Do not automatically add "update" permission to shared mounts
In the past it seems the update permission was needed to be able to
rename shared mounts, but it doesn't seem to be the case any more.

Removing the "update" permission that used to be added automatically
fixes the read-only permission check when trying to overwrite a
read-only file over WebDAV.
2015-03-20 12:33:59 +01:00
Robin Appelman
73874ca27f Merge pull request #14704 from owncloud/storage-wrapper-mount
pass mountpoint to storage wrapper callback
2015-03-19 16:20:38 +01:00
Lukas Reschke
bb5c5a3691 Remove unreqired backtick removal
Without this files with a ` (backtick) in the beginning of the filenames where simply not correctly referenced as the ` got removed. This can lead to all possible havoc situations.

Should get backported to stable8 and in future we might consider if it is really worth to backport such changes when it is just for SQLite 🙈

Regression of https://github.com/owncloud/core/pull/14734
2015-03-18 12:38:19 +01:00
Lukas Reschke
f13216d275 Use FILTER_UNSAFE_RAW instead of FILTER_SANITIZE_STRING
`FILTER_SANITIZE_STRING` will still encode everything else.
2015-03-17 21:56:16 +01:00
Morris Jobke
997a7a2668 Merge pull request #14766 from owncloud/fix-insertifnotexists-poc
Allow specifying the compare-array for insertIfNotExists()
2015-03-16 10:31:36 +01:00
Thomas Müller
6927773648 Merge pull request #14776 from owncloud/fix-14629-master
verify the file name length not to exceed 255 characters + verify path d...
2015-03-16 09:58:41 +01:00
Thomas Müller
5855108e9b drop any fallback code related to curl - refs https://github.com/owncloud/core/pull/14838#issuecomment-78586447 2015-03-12 21:43:41 +01:00