From 34f93ac765690c956fb7f7be1ab087c6b65c6f3b Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Mon, 13 Aug 2012 11:31:15 +0200 Subject: [PATCH] check if user has write access to a given file before updating the filekey --- apps/files_encryption/lib/keymanager.php | 6 ++++++ lib/ocs.php | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/files_encryption/lib/keymanager.php b/apps/files_encryption/lib/keymanager.php index 42aaf9b60b..10b673f31a 100644 --- a/apps/files_encryption/lib/keymanager.php +++ b/apps/files_encryption/lib/keymanager.php @@ -167,6 +167,12 @@ class Keymanager { $targetpath_parts=explode( '/',$targetpath ); $user = $targetpath_parts[1]; + + $rootview = new \OC_FilesystemView( '/'); + if (!$rootview->is_writable($targetpath)) { + \OC_Log::write( 'Encryption library', "File Key not updated because you don't have write access for the corresponding file" , \OC_Log::ERROR ); + return false; + } $targetpath = str_replace( '/'.$user.'/files/', '', $targetpath ); diff --git a/lib/ocs.php b/lib/ocs.php index 0fc208516e..5d4e19c0c4 100644 --- a/lib/ocs.php +++ b/lib/ocs.php @@ -767,7 +767,7 @@ class OC_OCS { } /** - * set the encryption keyn of a file + * set the encryption key of a file * @param string $format * @param string $file * @param string $key