diff options
author | Tom Needham <needham.thomas@gmail.com> | 2012-04-03 22:31:34 +0000 |
---|---|---|
committer | Tom Needham <needham.thomas@gmail.com> | 2012-04-03 22:31:34 +0000 |
commit | acdce2b1e01f7c0a77b7e7949540e1b0ba94efd1 (patch) | |
tree | 8955df1e7890cc2f51b24251cb293bcf76b016fd /lib | |
parent | 95c2ac5d585bfd1106b173c00b4c29719c08b25f (diff) | |
download | nextcloud-server-acdce2b1e01f7c0a77b7e7949540e1b0ba94efd1.tar.gz nextcloud-server-acdce2b1e01f7c0a77b7e7949540e1b0ba94efd1.zip |
Check blacklist before saving to filesystem
Diffstat (limited to 'lib')
-rw-r--r-- | lib/base.php | 3 | ||||
-rw-r--r-- | lib/filesystem.php | 13 |
2 files changed, 16 insertions, 0 deletions
diff --git a/lib/base.php b/lib/base.php index a4a94e86968..83dd0c98f45 100644 --- a/lib/base.php +++ b/lib/base.php @@ -365,6 +365,9 @@ class OC{ OC_App::loadApps(); } } + + // Check for blacklisted files + OC_Hook::connect('OC_Filesystem','write','OC_Filesystem','isBlacklisted'); //make sure temporary files are cleaned up register_shutdown_function(array('OC_Helper','cleanTmp')); diff --git a/lib/filesystem.php b/lib/filesystem.php index 12905d189f9..b6909f5acdf 100644 --- a/lib/filesystem.php +++ b/lib/filesystem.php @@ -298,6 +298,19 @@ class OC_Filesystem{ } return true; } + + /** + * checks if a file is blacklsited for storage in the filesystem + * @param array $data from hook + */ + static public function isBlacklisted($data){ + $blacklist = array('.htaccess'); + $filename = strtolower(basename($data['path'])); + if(in_array($filename,$blacklist)){ + $data['run'] = false; + } + } + /** * following functions are equivilent to their php buildin equivilents for arguments/return values. */ |