Commit graph

209 commits

Author SHA1 Message Date
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
Thomas Müller
ad4ec414c9 use system function to recursive remove the directory used by temporary storage 2014-06-06 09:29:31 +02:00
Jörn Friedrich Dreyer
f1bf06f8cf Merge pull request #8884 from owncloud/move-flock-to-app
remove file locking - code will continue to live in it's own app
2014-06-05 10:54:24 +02:00
Thomas Müller
da3974bcb2 - drop permissions table and related code
- the file/folder's permission is now stored in the file cache
- BackGroundWatcher has been removed - this has meanwhile be replaced by occ files:scan which can be executed in a cron jobs
- increase version to trigger database migration
2014-06-05 08:22:01 +02:00
Thomas Müller
ec7225da66 remove file locking - code will continue to live in it's own app 2014-06-04 20:11:54 +02:00
Bjoern Schiessle
48eb0515e9 only lock if unlink is called for a file 2014-06-04 07:55:46 +02:00
Bjoern Schiessle
ab6680e9ab name the storage wrapper to make sure that we don't apply the wrapper multiple times 2014-06-04 07:55:46 +02:00
ringmaster
54865815f5 Move Lock to private namespace, add interface. Update PHPDoc. 2014-06-04 07:55:45 +02:00
ringmaster
392a1b6662 Removed unused vars/declarations, update PHPDoc. 2014-06-04 07:55:45 +02:00
ringmaster
896bc526e6 Remove unused methods. 2014-06-04 07:55:44 +02:00
ringmaster
f9dbdb7c5c Add actual locking and log changes necessary for debugging. 2014-06-04 07:55:44 +02:00
ringmaster
dc1e3620d2 Continued flock work. 2014-06-04 07:55:44 +02:00
ringmaster
5365ae416e flock changes. Work in progress. 2014-06-04 07:55:44 +02:00
Thomas Müller
31ad1cbdd8 Merge pull request #5365 from owncloud/filesize-improvements-32bit
Add LargeFileHelper / Add CURL filesize workaround / Fix some 32-bit filesize issues
2014-05-30 16:13:48 +02:00
Andreas Fischer
0417e52134 Increase file size limit from 2 GiB to 4 GiB when workarounds are unavailable. 2014-05-29 16:26:02 +02:00
Andreas Fischer
fb7ec2bb22 Only call $this->filesize() for files. 2014-05-29 16:26:01 +02:00
Andreas Fischer
c8fa1fd687 Refactor Large File handling code. 2014-05-29 16:26:01 +02:00
Andreas Fischer
3f8f8027d2 Cast to numeric instead of float, i.e. use an integer if possible. 2014-05-29 16:17:13 +02:00
Andreas Fischer
6195f13bda Use CURL to get filesize on 32bit systems. 2014-05-29 16:17:13 +02:00
Robin Appelman
998fa2d9be Pass any methods custom to specific storage implementations to the wrapped storage 2014-05-29 16:13:05 +02:00
Robin Appelman
8c5521fdfc Add $storage->instanceOfStorage to handle instanceof for storage wrappers 2014-05-29 13:45:50 +02:00
Robin Appelman
467e9c2bb0 Remove code duplication 2014-05-28 18:16:24 +02:00
Robin Appelman
af35b6ad9d Fix LocalStorage->unlink to work on folder as expected 2014-05-28 18:16:24 +02:00
Robin Appelman
8187164fe1 re-use rescursive copy from common storage 2014-05-28 18:16:24 +02:00
Robin Appelman
488fc402e4 remove unneeded check 2014-05-28 18:16:23 +02:00
Robin Appelman
d15ed9b4d3 use \OC\Files\Filesystem::isIgnoredDir 2014-05-28 18:16:23 +02:00
Robin Appelman
ea44f0e20f fix recursive copy and rename for common storage backend 2014-05-28 18:16:23 +02:00
Robin Appelman
c3c9612c99 fix recursive copy and rename for mapped local storage backend 2014-05-28 18:16:23 +02:00
Robin Appelman
03ba497a8c add recursive copy to local storage backend 2014-05-28 18:16:23 +02:00
Robin Appelman
38c1da0976 fix recursive rename for local storage backend 2014-05-28 18:16:23 +02:00
Robin Appelman
e83b41493f remove unneeded delTree 2014-05-28 18:16:23 +02:00
Frank Karlitschek
48d0cebc42 Merge pull request #8674 from owncloud/watch-policy
Add a config option for setting the filesystem watcher policy
2014-05-26 10:48:44 +02:00
Robin Appelman
151c48494e Add a config option fro setting the filesystem watcher policy 2014-05-23 12:20:31 +02:00
Bjoern Schiessle
12338e0ef0 allow admin to disable sharing for specific groups of users 2014-05-22 10:43:44 +02:00
Morris Jobke
dc36d30953 Remove all occurences of @brief and @returns from PHPDoc
* test case added to avoid adding them later
2014-05-19 17:50:53 +02:00
Robin McCorkell
87b548ed91 Fix all PHPDoc types and variable names, in /lib 2014-05-13 19:08:14 +01:00
Sjors van der Pluijm
e8a287f5bb refs #8376; spaces=>tabs 2014-04-28 19:52:06 +02:00
Sjors van der Pluijm
54f482ff9c refs #8376; added comment and applied patch on other files 2014-04-28 19:32:25 +02:00
Sjors van der Pluijm
d7ec1fe447 rewind iterator before iteration starts 2014-04-28 13:05:20 +02:00
Sjors van der Pluijm
d8be9d96ed fixes #8376 2014-04-28 10:20:24 +02:00
Morris Jobke
a2a0eb370b Merge pull request #8222 from owncloud/type-hinting
Type hinting fixes
2014-04-17 16:08:15 +02:00
Bart Visscher
a4b7f5155f Fix PHPdoc in lib/private
using scrutinizer patch
2014-04-15 22:55:20 +02:00
Robin McCorkell
eeee9eacea Prevent error from cache update on deleted files 2014-04-13 16:17:13 +01:00
Vincent Petry
8d05848391 Merge pull request #7825 from owncloud/hash-stream
Use streams when generating hashes of remote files
2014-04-10 10:42:04 +02:00
Robin Appelman
1c7a71ca77 use binary safe read 2014-04-02 04:38:54 +02:00
Robin Appelman
54a15a8001 Use streams when generating hashes of remote files 2014-04-02 04:38:54 +02:00
Vincent Petry
0067a4eac2 Added missing fclose in file_get_contents and file_put_contents 2014-04-01 10:08:16 +02:00
Vincent Petry
d6ce45fe61 Correctly read the full stream in file_get_contents
When using user-defined stream wrappers, PHP will
return a maximum of 8192 bytes even if more was
requested.

This fix uses stream_get_contents to make sure the full stream is read
and not only the first 8 KB.

Added unit test with a bigger test file to cover this case.
2014-04-01 10:07:16 +02:00
Thomas Müller
70db348475 Merge pull request #7824 from owncloud/hash-parameter-order
Fix parameter order for Storage\Local::hash
2014-03-28 13:06:07 +01:00
Thomas Müller
ed97d872af Merge pull request #7325 from owncloud/recursive-mkdir-local
Recursive mkdir fixes #7047
2014-03-25 22:45:14 +01:00
Robin Appelman
7a8f1389fe fix temporary file based common hash 2014-03-21 13:23:14 +01:00
Robin Appelman
fffe330bbc Fix parameter order for Storage\Local::hash 2014-03-20 15:32:12 +01:00
Vincent Petry
66bc0f0848 Still return quota value when free space is unknown
Fixed the quota storage wrapper to correctly return the quota value when
the free space is not known (which usually happens when the disk_free_space
function is disabled)
2014-03-19 19:07:11 +01:00
Vincent Petry
c1cb9ee9b0 Merge pull request #7650 from owncloud/quota-totalspace
Fixed total space display when data size exceeds quota
2014-03-11 12:40:59 +01:00
Vincent Petry
010eef95c0 Fixed total space display when data size exceeds quota
The total space display in the personal page now shows the quota value
instead of used space when used space exceeds the quota (soft quota).
2014-03-10 17:59:14 +01:00
Vincent Petry
26513bc17b Merge pull request #7624 from owncloud/enc-encryptedusedspacefix
[master] Fixed used space to be based on unencrypted size
2014-03-10 09:38:24 +01:00
Vincent Petry
48d63a6278 Return unencrypted_size of folder when queried
This fixes the "used space" to be based on the unencrypted size, not
encrypted size, to be consistent with how quota/space is handled when
encryption is enabled
2014-03-07 14:59:09 +01:00
Robin Appelman
a8c67dc675 Add caching for getLocalFile on remote storages 2014-03-04 15:44:58 +01:00
Vincent Petry
a23ef25010 Removed unused deleteAll method on Common storage class
The "deleteAll" method on the Common storage class isn't used anywhere.
Also, it isn't defined on the Storage interface so this fix removes it
completely.
2014-02-24 12:21:48 +01:00
Robin Appelman
f86dffd56c Merge branch 'master' into recursive-mkdir-local 2014-02-21 15:43:54 +01:00
Thomas Müller
ec45a3c0e2 Merge pull request #6962 from owncloud/quota-space-root
Allow passing a root folder to get the used space from in the quota wrapper
2014-02-20 16:47:59 +01:00
Robin Appelman
d1c392d9ad Also make "regular" local storage's mkdir recursive 2014-02-20 15:36:30 +01:00
Joshua Medeiros
76aa4714cf Recursive mkdir fixes #7047 2014-02-20 15:35:00 +01:00
Scrutinizer Auto-Fixer
adaee6a5a1 Scrutinizer Auto-Fixes
This patch was automatically generated as part of the following inspection:
https://scrutinizer-ci.com/g/owncloud/core/inspections/cdfecc4e-a37e-4233-8025-f0d7252a8720

Enabled analysis tools:
 - PHP Analyzer
 - JSHint
 - PHP Copy/Paste Detector
 - PHP PDepend
2014-02-19 09:31:54 +01:00
Thomas Müller
9fac95c2ab Merge branch 'master' into scrutinizer_documentation_patches
Conflicts:
	lib/private/appconfig.php
2014-02-14 23:03:27 +01:00
Vincent Petry
788c8540aa Added isLocal() method to storage, used for xsendfile
Added isLocal() method to Storage to find out whether the storage is
local or not.
This method is used for the x-sendfile logic to find out whether to add
the headers.
2014-02-06 20:53:15 +01:00
Jörn Friedrich Dreyer
2a6a9a8cef polish documentation based on scrutinizer patches 2014-02-06 17:02:21 +01:00
Robin Appelman
20c2aaab00 Actually rename the variable 2014-01-27 16:26:54 +01:00
Robin Appelman
c8207312c7 Fix phpdoc 2014-01-27 16:00:10 +01:00
Robin Appelman
a521949baf Allow passing a root folder to get the used space from in the quota wrapper 2014-01-27 15:41:56 +01:00
Vincent Petry
1af7dab535 Fixed quota wrapper to not wrap failed fopen streams
When calling fopen() on some storage types, these return false instead
of throwing an exception.

This fix makes sure that in case the stream wasn't opened (for example
when a file doesn't exist any more) the stream isn't wrapped.

Also added 'rb' as another case that doesn't need to be wrapped.

Fixes #6832
2014-01-19 18:51:36 +01:00
Robin Appelman
25370fcb82 Return SPACE_UNKNOWN if disk_free_space is disabled when getting the free space on a local storage 2014-01-02 13:19:10 +01:00
Vincent Petry
6cf9844e9c Added unit test for the test() method
This is to make sure that method isn't broken
2013-12-03 14:35:53 +01:00
Vincent Petry
c62cce8269 Moved default isReadable/isUpdatable impl into Common class
Also adjusted all ext storage backends to not override these when the
default behavior is expected.
2013-11-22 18:21:17 +01:00
Vincent Petry
69e8e7dbd5 Now using the "Home" storage detection approach for quota
To find out whether to apply a quota, we now try and detect whether the
storage to wrap is a "Home" storage.
2013-11-21 12:17:47 +01:00
Robin Appelman
a0d570b4cc Change default mimetype detection for storage backends to only use filename 2013-11-20 15:25:29 +01:00
Vincent Petry
34c92f6656 Now using HomeStorage for legacy home storage ids
Legacy home storage ids with the format "local://path/to/datadir/user1"
are now also wrapped by the HomeStorage.
2013-11-12 18:01:02 +01:00
Robin Appelman
32a703ab36 Do not use -1 as the size for the root folder of the home storage 2013-11-12 16:15:43 +01:00
Thomas Mueller
e37047b2a0 WIN: fixing Fatal error: Call to a member function logicToPhysical() on a non-object in C:\jenkins2\workspace\server-stable5-windows\database\mssql\label\WINDOWS\lib\files\storage\mappedlocal.php on line 311 2013-11-02 20:22:12 +01:00
Robin Appelman
f1e6e80eb1 add specialized storage backend for home folders 2013-10-29 00:14:23 +01:00
Vincent Petry
c8df27de73 Fixed quota stream to not wrap read-only fopen calls 2013-10-25 12:33:16 +02:00
Thomas Müller
51b581a84d php 5.3 compatibility for \OC\Files\Storage 2013-10-08 23:00:41 +02:00
Thomas Müller
9c9dc276b7 move the private namespace OC into lib/private - OCP will stay in lib/public
Conflicts:
	lib/private/vcategories.php
2013-09-30 16:36:59 +02:00