Commit Graph

332 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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 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
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 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
Thomas Müller 8450b6aa2d Properly import used classes 2015-04-13 09:26:30 +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
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 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
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 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 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
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 a905f641b3 various fixes & start to unit test the encryption storage wrapper 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
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 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 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
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
Thomas Müller 80ef53eff0 verify the file name length not to exceed 255 characters + verify path during rename 2015-03-12 10:47:47 +01:00
Robin Appelman 169031d1c5 fix factory test 2015-03-11 15:07:59 +01:00
Robin Appelman e1f2a6df94 Allow setting the watcher policy as mount option 2015-03-11 15:07:23 +01:00
Robin Appelman 7adda88786 Copy mount options to the storage 2015-03-11 15:06:48 +01:00
Robin Appelman e5c8fd37df pass mountpoint to storage wrapper callback 2015-03-11 15:06:12 +01:00
Lukas Reschke 284bd6647c Merge pull request #14759 from owncloud/clean-up-code
Clean-up code and use proper exception types
2015-03-10 14:18:21 +01:00
Lukas Reschke 2ac6f3a4f5 Clean-up code and use proper exception types 2015-03-09 11:48:55 +01:00
Thomas Müller 3623f14e73 no translation service in common storage class 2015-03-09 10:38:38 +01:00
Thomas Müller 33b11682f9 translate error messages 2015-03-09 10:38:38 +01:00
Lukas Reschke 2f18a09a20 Optimize loop 2015-03-09 10:38:38 +01:00
Thomas Müller 4bac595068 adding storage specific filename verification - refs #13640 2015-03-09 10:38:37 +01:00
Morris Jobke 06aef4e8b1 Revert "Updating license headers"
This reverts commit 6a1a4880f0.
2015-02-26 11:37:37 +01:00
Vincent Petry 9f6dcb9d3e Sabre Update to 2.1
- VObject fixes for Sabre\VObject 3.3
- Remove VObject property workarounds
- Added prefetching for tags in sabre tags plugin
- Moved oc_properties logic to separate PropertyStorage backend (WIP)
- Fixed Sabre connector namespaces
- Improved files plugin to handle props on-demand
- Moved allowed props from server class to files plugin
- Fixed tags caching for files that are known to have no tags
  (less queries)
- Added/fixed unit tests for Sabre FilesPlugin, TagsPlugin
- Replace OC\Connector\Sabre\Request with direct call to
  httpRequest->setUrl()
- Fix exception detection in DAV client when using Sabre\DAV\Client
- Added setETag() on Node instead of using the static FileSystem
- Also preload tags/props when depth is infinity
2015-02-23 22:27:23 +01:00
Jenkins for ownCloud 6a1a4880f0 Updating license headers 2015-02-23 12:13:59 +01:00
Morris Jobke 1bb6de7c1b Merge pull request #13425 from owncloud/phpdoc_cleanup
Cleanup of PHPDoc return types
2015-02-10 01:14:00 +01:00
Vincent Petry 5ade2854ee Fix DAV exceptions, some will still return false now
Since the Storage interface isn't ready to work directly with exceptions
like Forbidden and NotFound, the DAV storage has been adapted to still
return false when expected.
2015-01-30 12:02:23 +01:00
Morris Jobke 87b39e8f03 Merge pull request #13525 from owncloud/s2s-fixscanfileforbrokenstorage
Catch storage exception in scanner for remote shares
2015-01-28 00:31:37 +01:00
Vincent Petry f6e644b43f Catch storage exception in scanner for remote shares
Whenever an exception occurs during scan of a remote share, the share is
checked for availability. If the storage is gone, it will be removed
automatically.

Also, getDirectoryContent() will now skip unavailable storages.
2015-01-26 13:59:49 +01:00
Robin Appelman 960ff4f136 Apply wrappers to existing mounts before registering it 2015-01-23 13:48:35 +01:00
Vincent Petry 5fb8a4715d removeStorageWrapper to unregister a storage wrapper 2015-01-23 12:20:54 +01:00
Vincent Petry 6fb553e92c Do not call wrapStorage if storate with same name added twice 2015-01-22 16:24:24 +01:00
Robin McCorkell 2b99fc76ec Cleanup of PHPDoc return types 2015-01-16 20:30:43 +00:00
Morris Jobke fd57820708 Merge pull request #13132 from aptivate/improve_debug_logging_messages
Improve debugging for ServiceUnavailable exceptions
2015-01-07 10:36:27 +01:00
Chris Wilson 402a3ed146 Improve debugging for ServiceUnavailable exceptions
I was getting a lot of these in my logs for no apparent reason, and file
uploads were failing:

	{"app":"webdav","message":"Sabre\\DAV\\Exception\\ServiceUnavailable: ","level":4,"time":"2015-01-06T15:33:39+00:00"}

In order to debug it, I had to add unique messages to all the places where
this exception was thrown, to identify which one it was, and that made the
logs much more useful:

	{"app":"webdav","message":"Sabre\\DAV\\Exception\\ServiceUnavailable: Encryption is disabled","level":4,"time":"2015-01-06T15:36:47+00:00"}
2015-01-06 15:59:38 +00:00
Jörn Friedrich Dreyer c738359a11 add paged provider 2015-01-02 10:28:41 +01:00
Thomas Müller 81243b0f5d adding getDirectDownload() to Wrapper 2014-12-28 17:17:14 +01:00
Thomas Müller 5b00bc1d6e Adding basement for the direct download url 2014-12-28 17:17:14 +01:00
Morris Jobke 5b3971f002 Merge pull request #12639 from owncloud/bad_mtime_format
Fix formatting of bad dates from external storages
2014-12-13 10:07:10 +01:00
Robin McCorkell fdbb68a3c3 Return ? if mtime is 0 or -1
Tooltip contains 'Unable to determine date'. Fixes #6395
2014-12-12 23:54:18 +00:00
Vincent Petry b1bef5cc15 Merge pull request #12587 from owncloud/dav-logerrors
Log exceptions in DAV storage
2014-12-12 11:58:04 +01:00
Robin Appelman f4701d7721 Add public api for mount configurations 2014-12-04 16:47:27 +01:00
Vincent Petry bc12d28f23 Log exceptions in DAV storage
In some cases a "NotFound" might be expected, so just return false as
before. But for other exceptions, the exception is now logged.
2014-12-03 22:20:00 +01:00
Robin Appelman 1bbb18fe87 also clear statcache in mapped local 2014-12-02 16:39:03 +01:00
Robin Appelman db3f7238dd Clear statcache before getting the mtime from local storage backends 2014-12-02 14:25:49 +01:00
Vincent Petry 8db4dd7585 Merge pull request #12469 from owncloud/issue/12460-port-local-changes2mapped
Issue/12460 port local changes2mapped
2014-12-01 10:42:39 +01:00
Robin Appelman 05a069c101 Merge pull request #12426 from owncloud/jail-mask-wrappers
Add Jail and PermissionsMask storage wrappers
2014-11-27 16:00:14 +01:00
Robin Appelman 33b64868d7 Add storage and cache wrappers to apply a permissions mask to a storage 2014-11-27 15:25:57 +01:00
Robin Appelman abb6e89c5d Add storage and cache wrappers to jail a storage to a subfolder 2014-11-27 15:25:53 +01:00
Joas Schilling 7761f0288e Also clearstatcache() in MappedLocal before using the stats
Local change 283c10f010
2014-11-27 14:59:10 +01:00
Joas Schilling 50f85bfd1f Check whether file exists before trying to touch() it
Local changes from d069ee8a8b
and 258ad38fd3
2014-11-27 14:59:09 +01:00
Joas Schilling c5427da76d Check return of disk_free_space before returning it
Local changes copied from ed83597371
and 25370fcb82
2014-11-27 14:59:08 +01:00
Joas Schilling 1062f4fe44 Check file existance in MappedLocal in hasUpdated()
Only fixed in Local by eeee9eacea
2014-11-27 14:59:07 +01:00
Joas Schilling b886d3d645 Make MappedLocal::isLocal() true like for Local
Missed in 788c8540aa
2014-11-27 14:59:07 +01:00
Joas Schilling 4f1bbc4fd5 Remove unused 2nd parameter of buildPath() and rename to getSourcePath() 2014-11-27 11:19:20 +01:00
Joas Schilling 20237fba47 Introduce getSourcePath() in Storage\Local to reduce the difference to MappedLocal 2014-11-27 11:19:18 +01:00
Joas Schilling 2c39aec8cb Replace deprecated constant with new class constant 2014-11-25 16:30:21 +01:00
Joas Schilling bb540722cd Use base class to reset the file mapper 2014-11-19 14:52:07 +01:00
Vincent Petry 4b943a4810 Fix root path handling for WebDAV ext storage
Added missing cleanPath() call that converts "/" to "" when calling
SabreDAV. This is needed because SabreDAV will discard its base URL when
passing "/".
2014-11-11 15:20:36 +01:00
Robin Appelman 283c10f010 Generate stable etags for local files 2014-10-24 16:47:58 +02:00
Vincent Petry ab5149f5df Allow specifying protocol in ext storage OC config
Allow specifying a protocol in the host field when mounting another
ownCloud instance. Note that this was already possible with the WebDAV
config but this bug made it inconsistent.
2014-10-13 17:15:58 +02:00
Jörn Friedrich Dreyer 3427976bb6 strict comparison 2014-10-08 18:49:55 +02:00
Jörn Friedrich Dreyer aa3ad898a9 fix amazon s3 issues
folder size and mtime is always unknown in s3

more s3 fixes

make rescanDelay of root dir configurable, add on the fly update of legacy storage ids, !isset -> empty when checking strings

reduce number of http calls on remove and rmdir

fix typo
2014-10-08 18:49:47 +02:00
Lukas Reschke 6eeb905871 Do only follow HTTP and HTTPS redirects
We do not want to follow redirects to other protocols since they might allow an adversary to bypass network restrictions. (i.e. a redirect to ftp:// might be used to access files of a FTP server which might be in a secure zone and not be reachable from the net but from the ownCloud server)

Get final redirect manually using get_headers()

Migrate to HTTPHelper class and add unit tests
2014-09-22 20:02:32 +02:00
Lukas Reschke 33c0d2f743 Fix mapping of relative paths 2014-09-17 11:38:10 +02:00
Robin Appelman 2f22e67570 Also check if the file itself is updatable 2014-09-17 11:35:16 +02:00
Robin Appelman d25a9a118f Check if a folder is deletable before we try to recursively delete it 2014-09-17 11:35:16 +02:00
Robin Appelman ab79caf29b Check if the parent is writable to check if a file is deletable 2014-09-17 11:35:16 +02:00
Morris Jobke b3b3354809 move to public namespace 2014-08-19 14:05:08 +02:00
Stephan Peijnik 2df52e54d7 Fix STORAGE_* constants usage by moving those constants into \OC\Files\Filesystem.
As constants not defined within a class cannot be automatically found by the
autoloader moving those constants into a class makes them accessible to
code which uses them.

Signed-off-by: Stephan Peijnik <speijnik@anexia-it.com>
2014-08-19 13:55:35 +02:00
Morris Jobke c6bf51c457 Close open file handles in files library
ref #10392
2014-08-13 15:48:32 +02:00
Robin Appelman 174805f5e3 Merge pull request #9762 from owncloud/owner-public
Return the proper owner for home storages
2014-08-12 14:29:17 +02:00
Clark Tomlinson 26af116fcd Removing unnecessary switch statements in fopen methods. 2014-07-31 09:34:27 -04:00
Robin Appelman e9de20952a Return the proper owner for home storages 2014-07-21 16:59:59 +02:00
Vincent Petry 3df7a83c72 Merge pull request #9406 from philfry/master
silently discard the response body, needed for apache/mod_dav and maybe ...
2014-07-21 12:22:06 +02:00
Robin Appelman 5a0397eb5e Fix renaming files in the root folder of a MappedLocal storage 2014-07-16 21:24:18 +02:00
Tigran Mkrtchyan 03f422153d files: storage: rename should check parent directories of old and new files
as described by POSIX.1-2008
(see http://pubs.opengroup.org/onlinepubs/9699919799/functions/rename.html)

Signed-off-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
2014-07-10 14:58:59 +02:00
Philippe Kueck ef114b6594 silently discard the response body, needed for apache/mod_dav and maybe other dav servers which return an html body 2014-07-03 12:04:38 +02:00
Vincent Petry ed29e7d160 Merge pull request #9329 from owncloud/sharing_check_target
don't move a share mount point into a different mount point
2014-07-02 21:01:03 +02:00
Bjoern Schiessle 735eac6c9d add a explicit interface for the home storage 2014-07-01 17:31:33 +02:00
Robin Appelman d78a2a9f78 Add StorageNotAvailableException 2014-06-30 15:46:37 +02:00
icewind1991 1a3e698294 Merge pull request #9263 from owncloud/remote-share-update
Better detecting of remote changes for external shares
2014-06-27 19:31:18 +02:00
Robin Appelman db3f0cee4a Fix parsing of webdav permissions 2014-06-27 17:28:56 +02:00
Robin Appelman 6f5d5b9a30 Also check for updated permissions for webdav storages 2014-06-27 17:27:47 +02:00
Robin Appelman 5b8c2ac750 Use the etag to check for updates in webdav storages where available 2014-06-27 17:10:46 +02:00
Vincent Petry fd8b5680dd Merge pull request #8383 from owncloud/object_storage
Object storage
2014-06-27 16:53:03 +02:00
Jörn Friedrich Dreyer ab93f1949d update hasUpdated description, overwrtie testStat for objectstore test 2014-06-27 12:14:31 +02:00
Thomas Müller 171475b95a fix autoloader 2014-06-27 08:52:40 +02:00
Thomas Müller c745240543 Move \OC\Files\Storage\DAV to core in order to reduce inter-app dependencies 2014-06-27 08:52:28 +02:00
Robin Appelman 87e311b996 Fix storage being passed to cache/watcher and scanner when using storage wrappers 2014-06-14 10:14:08 +02:00