mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Added minor documentation
This commit is contained in:
parent
265f3654af
commit
dd987a8bd1
3 changed files with 15 additions and 23 deletions
|
|
@ -183,18 +183,23 @@ class Proxy extends \OC_FileProxy {
|
|||
// If file is encrypted, decrypt using crypto protocol
|
||||
if ( Crypt::mode() == 'server' && $util->isEncryptedPath( $path ) ) {
|
||||
|
||||
file_put_contents('/home/samtuke/newtmp.txt', "bar" );
|
||||
|
||||
$tmp = fopen( 'php://temp' );
|
||||
|
||||
\OCP\Files::streamCopy( $result, $tmp );
|
||||
|
||||
fclose( $result );
|
||||
|
||||
$encrypted = $view->file_get_contents( $path );
|
||||
|
||||
//file_put_contents('/home/samtuke/newtmp.txt', "\$path = $path, \$data = $data" );
|
||||
|
||||
// Replace the contents of
|
||||
\OC_Filesystem::file_put_contents( $path, $tmp );
|
||||
|
||||
fclose( $tmp );
|
||||
|
||||
//file_put_contents('/home/samtuke/newtmp.txt', file_get_contents( 'crypt://' . $path ) );
|
||||
|
||||
$result = fopen( 'crypt://' . $path, $meta['mode'] );
|
||||
|
||||
// file_put_contents('/home/samtuke/newtmp.txt', "mode= server" );
|
||||
|
|
@ -242,6 +247,9 @@ class Proxy extends \OC_FileProxy {
|
|||
|
||||
}*/
|
||||
|
||||
// Re-enable the proxy
|
||||
\OC_FileProxy::$enabled = true;
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ namespace OCA\Encryption;
|
|||
|
||||
/**
|
||||
* @brief Provides 'crypt://' stream wrapper protocol.
|
||||
* @note We use a stream wrapper because it is the most secure way to handle decrypted content transfers. There is no safe way to decrypt the entire file somewhere on the server, so we have to encrypt and decrypt blocks on the fly.
|
||||
* @note Paths used with this protocol MUST BE RELATIVE, due to limitations of OC_FilesystemView. crypt:///home/user/owncloud/data <- will put keyfiles in [owncloud]/data/user/files_encryption/keyfiles/home/user/owncloud/data and will not be accessible by other functions.
|
||||
* @note Data read and written must always be 8192 bytes long, as this is the buffer size used internally by PHP. The encryption process makes the input data longer, and input is chunked into smaller pieces in order to result in a 8192 encrypted block size.
|
||||
*/
|
||||
|
|
@ -52,6 +53,8 @@ class Stream {
|
|||
|
||||
public function stream_open( $path, $mode, $options, &$opened_path ) {
|
||||
|
||||
file_put_contents('/home/samtuke/newtmp.txt', 'stream_open('.$path.')' );
|
||||
|
||||
// Get access to filesystem via filesystemview object
|
||||
if ( !self::$view ) {
|
||||
|
||||
|
|
@ -141,9 +144,7 @@ class Stream {
|
|||
|
||||
public function stream_read( $count ) {
|
||||
|
||||
trigger_error("\$count = $count");
|
||||
|
||||
file_put_contents('/home/samtuke/newtmp.txt', "\$count = $count" );
|
||||
// file_put_contents('/home/samtuke/newtmp.txt', "\$count = $count" );
|
||||
|
||||
$this->writeCache = '';
|
||||
|
||||
|
|
@ -275,7 +276,7 @@ class Stream {
|
|||
*/
|
||||
public function stream_write( $data ) {
|
||||
|
||||
//file_put_contents('/home/samtuke/newtmp.txt', 'stream_write('.$data.')' );
|
||||
// file_put_contents('/home/samtuke/newtmp.txt', 'stream_write('.$data.')' );
|
||||
|
||||
// Disable the file proxies so that encryption is not automatically attempted when the file is written to disk - we are handling that separately here and we don't want to get into an infinite loop
|
||||
\OC_FileProxy::$enabled = false;
|
||||
|
|
|
|||
|
|
@ -1,17 +0,0 @@
|
|||
PHPUnit 3.6.12 by Sebastian Bergmann.
|
||||
|
||||
......
|
||||
|
||||
$testarray = Array
|
||||
(
|
||||
[0] => Syz/Pg==00iv002QCKh0n9d8/x9Fk7xx
|
||||
)
|
||||
.
|
||||
|
||||
$filename = tmp-1350488042
|
||||
|
||||
.......
|
||||
|
||||
Time: 1 second, Memory: 6.00Mb
|
||||
|
||||
OK (14 tests, 29 assertions)
|
||||
Loading…
Reference in a new issue