check if user has write access to a given file before updating the filekey

This commit is contained in:
Bjoern Schiessle 2012-08-13 11:31:15 +02:00
parent 3ec6dc56c9
commit 34f93ac765
2 changed files with 7 additions and 1 deletions

View File

@ -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 );

View File

@ -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