From c704e8077f40c41c02f0a1644ca84b9b0605dc11 Mon Sep 17 00:00:00 2001 From: BlackEagle Date: Fri, 25 May 2012 21:08:04 +0200 Subject: [PATCH 01/13] remote.php :: use non apache-only env vars - fixes following error when using nginx + php-fpm [error] *6568 FastCGI sent in stderr: "PHP message: PHP Warning: strpos(): Offset not contained in string in /some-path/owncloud/remote.php on line 10" Signed-off-by: BlackEagle --- remote.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/remote.php b/remote.php index 44b85f762f..63a45321eb 100644 --- a/remote.php +++ b/remote.php @@ -5,7 +5,7 @@ require_once('lib/base.php'); if (array_key_exists('PATH_INFO', $_SERVER)){ $path_info = $_SERVER['PATH_INFO']; }else{ - $path_info = substr($_SERVER['PHP_SELF'], strpos($_SERVER['PHP_SELF'], basename(__FILE__)) + strlen(basename(__FILE__))); + $path_info = substr($_SERVER['REQUEST_URI'], strlen($_SERVER['SCRIPT_NAME'])); } if (!$pos = strpos($path_info, '/', 1)) { $pos = strlen($path_info); @@ -22,4 +22,4 @@ $app=$parts[2]; OC_App::loadApp($app); $baseuri = OC::$WEBROOT . '/remote.php/'.$service.'/'; -require_once(OC::$APPSROOT . $file); \ No newline at end of file +require_once(OC::$APPSROOT . $file); From 27efdbd58f284c054ae9150ff2a2b0dcb5fab70f Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Fri, 15 Jun 2012 17:04:37 +0200 Subject: [PATCH 02/13] Use setter for FileinfoCache --- lib/connector/sabre/directory.php | 10 ++++------ lib/connector/sabre/node.php | 12 +++++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/connector/sabre/directory.php b/lib/connector/sabre/directory.php index 5aa70392d7..6af4dd3656 100644 --- a/lib/connector/sabre/directory.php +++ b/lib/connector/sabre/directory.php @@ -69,15 +69,13 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa if (!$info) throw new Sabre_DAV_Exception_NotFound('File with name ' . $path . ' could not be located'); if ($info['mimetype'] == 'httpd/unix-directory') { - - return new OC_Connector_Sabre_Directory($path, $info); - + $node = new OC_Connector_Sabre_Directory($path); } else { - - return new OC_Connector_Sabre_File($path, $info); - + $node = new OC_Connector_Sabre_File($path); } + $node->setFileinfoCache($info); + return $node; } /** diff --git a/lib/connector/sabre/node.php b/lib/connector/sabre/node.php index e5c059f0c8..8a860242f2 100644 --- a/lib/connector/sabre/node.php +++ b/lib/connector/sabre/node.php @@ -41,11 +41,8 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr * @param string $path * @return void */ - public function __construct($path, $fileinfo_cache = null) { + public function __construct($path) { $this->path = $path; - if ($fileinfo_cache) { - $this->fileinfo_cache = $fileinfo_cache; - } } @@ -85,8 +82,13 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr } + public function setFileinfoCache($fileinfo_cache) + { + $this->fileinfo_cache = $fileinfo_cache; + } + /** - * Set the stat cache + * Make sure the fileinfo cache is filled. Uses OC_FileCache or a direct stat */ protected function getFileinfoCache() { if (!isset($this->fileinfo_cache)) { From 463a506fcb2ec9c5e219434654ec5c5e0d8f834b Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Fri, 15 Jun 2012 17:05:10 +0200 Subject: [PATCH 03/13] Fix webdav property name compare --- lib/connector/sabre/node.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/connector/sabre/node.php b/lib/connector/sabre/node.php index 8a860242f2..7a9d8198ae 100644 --- a/lib/connector/sabre/node.php +++ b/lib/connector/sabre/node.php @@ -139,7 +139,7 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr } } else { - if( strcmp( $propertyName, "lastmodified")) { + if( strcmp( $propertyName, "lastmodified") === 0) { $this->touch($propertyValue); } else { if(!array_key_exists( $propertyName, $existing )){ From e905b14758d18c5254ecf2fbe8e867ea96293877 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Fri, 15 Jun 2012 17:05:27 +0200 Subject: [PATCH 04/13] Spelling fix --- lib/filecache.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/filecache.php b/lib/filecache.php index 7c9c4dc41f..32c6929ff6 100644 --- a/lib/filecache.php +++ b/lib/filecache.php @@ -34,7 +34,7 @@ class OC_FileCache{ * @param string root (optional) * @return array * - * returns an assiciative array with the following keys: + * returns an associative array with the following keys: * - size * - mtime * - ctime From e11c5a23d52ba0bfe082f36311a504c72278aa40 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Fri, 15 Jun 2012 17:51:56 +0200 Subject: [PATCH 05/13] Optimize WebDav access by preloading dav custom properties --- lib/connector/sabre/directory.php | 22 ++++++++++++++++++++-- lib/connector/sabre/node.php | 30 +++++++++++++++++++++--------- 2 files changed, 41 insertions(+), 11 deletions(-) diff --git a/lib/connector/sabre/directory.php b/lib/connector/sabre/directory.php index 6af4dd3656..9832449af3 100644 --- a/lib/connector/sabre/directory.php +++ b/lib/connector/sabre/directory.php @@ -85,10 +85,28 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa */ public function getChildren() { - $nodes = array(); $folder_content = OC_FileCache::getFolderContent($this->path); + $paths = array(); foreach($folder_content as $info) { - $nodes[] = $this->getChild($info['name'], $info); + $paths[] = $this->path.'/'.$info['name']; + } + $placeholders = join(',', array_fill(0, count($paths), '?')); + $query = OC_DB::prepare( 'SELECT * FROM *PREFIX*properties WHERE userid = ?' . ' AND propertypath IN ('.$placeholders.')' ); + array_unshift($paths, OC_User::getUser()); // prepend userid + $result = $query->execute( $paths ); + $properties = array_fill_keys($paths, array()); + while($row = $result->fetchRow()) { + $propertypath = $row['propertypath']; + $propertyname = $row['propertyname']; + $propertyvalue = $row['propertyvalue']; + $properties[$propertypath][$propertyname] = $propertyvalue; + } + + $nodes = array(); + foreach($folder_content as $info) { + $node = $this->getChild($info['name'], $info); + $node->setPropertyCache($properties[$this->path.'/'.$info['name']]); + $nodes[] = $node; } return $nodes; } diff --git a/lib/connector/sabre/node.php b/lib/connector/sabre/node.php index 7a9d8198ae..be315a0ffd 100644 --- a/lib/connector/sabre/node.php +++ b/lib/connector/sabre/node.php @@ -30,10 +30,15 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr */ protected $path; /** - * file stat cache + * node fileinfo cache * @var array */ protected $fileinfo_cache; + /** + * node properties cache + * @var array + */ + protected $property_cache = null; /** * Sets up the node, expects a full path name @@ -101,6 +106,11 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr } } + public function setPropertyCache($property_cache) + { + $this->property_cache = $property_cache; + } + /** * Returns the last modification time, as a unix timestamp * @@ -153,6 +163,7 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr } } + $this->setPropertyCache(null); return true; } @@ -168,23 +179,24 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr * @return void */ function getProperties($properties) { - // At least some magic in here :-) - $query = OC_DB::prepare( 'SELECT * FROM *PREFIX*properties WHERE userid = ? AND propertypath = ?' ); - $result = $query->execute( array( OC_User::getUser(), $this->path )); + if (is_null($this->property_cache)) { + $query = OC_DB::prepare( 'SELECT * FROM *PREFIX*properties WHERE userid = ? AND propertypath = ?' ); + $result = $query->execute( array( OC_User::getUser(), $this->path )); - $existing = array(); - while( $row = $result->fetchRow()){ - $existing[$row['propertyname']] = $row['propertyvalue']; + $this->property_cache = array(); + while( $row = $result->fetchRow()){ + $this->property_cache[$row['propertyname']] = $row['propertyvalue']; + } } // if the array was empty, we need to return everything if(count($properties) == 0){ - return $existing; + return $this->property_cache; } $props = array(); foreach($properties as $property) { - if (isset($existing[$property])) $props[$property] = $existing[$property]; + if (isset($this->property_cache[$property])) $props[$property] = $this->property_cache[$property]; } return $props; } From cb833e45c230effac2194ae79e48a5d710c4d064 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 15 Jun 2012 21:59:40 +0200 Subject: [PATCH 06/13] get rid of php4 style constructors in mdb2 --- 3rdparty/MDB2/Schema/Parser.php | 27 --------------------------- 3rdparty/MDB2/Schema/Parser2.php | 27 --------------------------- 3rdparty/MDB2/Schema/Validate.php | 22 ---------------------- 3rdparty/MDB2/Schema/Writer.php | 17 ----------------- 4 files changed, 93 deletions(-) diff --git a/3rdparty/MDB2/Schema/Parser.php b/3rdparty/MDB2/Schema/Parser.php index cfd0c37d8a..3c4345661b 100644 --- a/3rdparty/MDB2/Schema/Parser.php +++ b/3rdparty/MDB2/Schema/Parser.php @@ -146,33 +146,6 @@ class MDB2_Schema_Parser extends XML_Parser ); } - /** - * PHP 4 compatible constructor - * - * @param array $variables mixed array with user defined schema - * variables - * @param bool $fail_on_invalid_names array with reserved words per RDBMS - * @param array $structure multi dimensional array with - * database schema and data - * @param array $valid_types information of all valid fields - * types - * @param bool $force_defaults if true sets a default value to - * field when not explicit - * @param int $max_identifiers_length maximum allowed size for entities - * name - * - * @return void - * - * @access public - * @static - */ - function MDB2_Schema_Parser($variables, $fail_on_invalid_names = true, - $structure = false, $valid_types = array(), $force_defaults = true, - $max_identifiers_length = null - ) { - $this->__construct($variables, $fail_on_invalid_names, $structure, $valid_types, $force_defaults); - } - /** * Triggered when reading a XML open tag * diff --git a/3rdparty/MDB2/Schema/Parser2.php b/3rdparty/MDB2/Schema/Parser2.php index b415b4a336..f27dffbabf 100644 --- a/3rdparty/MDB2/Schema/Parser2.php +++ b/3rdparty/MDB2/Schema/Parser2.php @@ -143,33 +143,6 @@ class MDB2_Schema_Parser2 extends XML_Unserializer parent::XML_Unserializer($this->options); } - /** - * PHP 4 compatible constructor - * - * @param array $variables mixed array with user defined schema - * variables - * @param bool $fail_on_invalid_names array with reserved words per RDBMS - * @param array $structure multi dimensional array with - * database schema and data - * @param array $valid_types information of all valid fields - * types - * @param bool $force_defaults if true sets a default value to - * field when not explicit - * @param int $max_identifiers_length maximum allowed size for entities - * name - * - * @return void - * - * @access public - * @static - */ - function MDB2_Schema_Parser2($variables, $fail_on_invalid_names = true, - $structure = false, $valid_types = array(), $force_defaults = true, - $max_identifiers_length = null - ) { - $this->__construct($variables, $fail_on_invalid_names, $structure, $valid_types, $force_defaults); - } - /** * Main method. Parses XML Schema File. * diff --git a/3rdparty/MDB2/Schema/Validate.php b/3rdparty/MDB2/Schema/Validate.php index 4cff175576..4a8e0d27ba 100644 --- a/3rdparty/MDB2/Schema/Validate.php +++ b/3rdparty/MDB2/Schema/Validate.php @@ -108,28 +108,6 @@ class MDB2_Schema_Validate $this->max_identifiers_length = $max_identifiers_length; } - /** - * PHP 4 compatible constructor - * - * @param bool $fail_on_invalid_names array with reserved words per RDBMS - * @param array $valid_types information of all valid fields - * types - * @param bool $force_defaults if true sets a default value to - * field when not explicit - * @param int $max_identifiers_length maximum allowed size for entities - * name - * - * @return void - * - * @access public - * @static - */ - function MDB2_Schema_Validate($fail_on_invalid_names = true, $valid_types = array(), - $force_defaults = true, $max_identifiers_length = null - ) { - $this->__construct($fail_on_invalid_names, $valid_types, $force_defaults); - } - // }}} // {{{ raiseError() diff --git a/3rdparty/MDB2/Schema/Writer.php b/3rdparty/MDB2/Schema/Writer.php index 70a03168de..96dd2bed0f 100644 --- a/3rdparty/MDB2/Schema/Writer.php +++ b/3rdparty/MDB2/Schema/Writer.php @@ -80,23 +80,6 @@ class MDB2_Schema_Writer function __construct($valid_types = array()) { $this->valid_types = $valid_types; - } - - /** - * PHP 4 compatible constructor - * - * @param array $valid_types information of all valid fields - * types - * - * @return void - * - * @access public - * @static - */ - function MDB2_Schema_Writer($valid_types = array()) - { - $this->__construct($valid_types); - } // }}} // {{{ raiseError() From 19bfe214010e4cc3730d9718def20b88d379fed5 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 15 Jun 2012 23:11:33 +0200 Subject: [PATCH 07/13] add binary test case for encryption --- apps/files_encryption/tests/binary | Bin 0 -> 9734 bytes apps/files_encryption/tests/proxy.php | 40 +++++++++++++++++++++++--- 2 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 apps/files_encryption/tests/binary diff --git a/apps/files_encryption/tests/binary b/apps/files_encryption/tests/binary new file mode 100644 index 0000000000000000000000000000000000000000..79bc99479daeb0c85fe2ad89fb9346efb517cf02 GIT binary patch literal 9734 zcmeIu1wR}P0{~#%ZJ3_!?wZ`xOq=6y(=|Qa-E6u}$6+QXP7Gu69ELf0nC8@9$NN3r zpXVby`D)gid8Rinqj>64KWJwPdY3WCBQsQs%J{!W{Bda5oJ{((v#@lSYm-)`HuynT z2=a)8VyrDhz4oQV&3Ae0|M(+q)64a*NU#>lGO0k*b9>{p<`m%*f1!+$K`|S6o~NwG zawW%Yd|QTz$ah@Ai!M}G`=)pDyS9z}00~;ZJro5byMXHPDHE`_!#? zCMMb{b-0R7;ITiw=)#PHxZisT_a%2k`9qiN>M0G7>9)GYB^^&1(bg{~DBrJsyzHt) zE_1RhoY3{9GtsW3QUZ3j*r~$m4@tb%1ag7B8r;0KOuXrf8)_c~99;8%s=zGMT8+#| zOLnGwMDI0^Ka%lELL+exO;V|s!bb8d9{Rx^z zwe^I6-M717{!%wf74%RqfcO$ka7U1v@)2X97wykn355e8iPs66S3-)sf`&M;52S13 zEl1y)NxA_wESI0{yH0MPaRpZTAJFfJUyo5@jzlA`|d>*_Pk* z1feyQ0jS9pMw6VvplJWB5ixV}`FezK2U?usz@Xca10$rDP&9d=&#Rm`k60$9o?vOW zWEKC9(^SU{JDnj-um5CU6)!^lnY`jU25zQ%a9aXG^l1sR6ONnIqU6oVB{KLE1Il8* zd7cuQzxty!rhgYR{}gc9-qI~7g0#+F97b;u|5;hEzqE>3nDOskLNZ4z#>;}KRdBYqmT&MJ z0slx}|Lgbe5&B5|#lhavjTDmyJ*_?$t6Fha222n}YDIG}1o(g=Mfn|5#zn`|)O)!o z*`}z)5Ep=1>doueN`IFc+I6jdnV|H;ch7MKt`$w9Y;YpCpstCwUqb`lZR;%Zy=rp6 z)m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Y>7GPVSgzx=RH>6&lirl;gg^a+%HF35 zRs+>5PosObPXAopV=r8wI*zbGTB!TknW`}&j2n0`f`z%@jla_3SY&5Bj#Y~WYYdOF z_!lHX)GB6RU$z~WCa1=O*T~#AI#1>2_+7cH%HnYyf0Q!g+Rhiygz!Yhh@Uo9V2VbV zq3Jj$S$i==XOEXpj3`J$VCZLpAJO^Io;?pd4?GV%4?GV%4?GV%4?GV%4?GV%4?GV% T4?GV%5By&bh=_`bOA!1IE57#c literal 0 HcmV?d00001 diff --git a/apps/files_encryption/tests/proxy.php b/apps/files_encryption/tests/proxy.php index f36b219343..5616e2091a 100644 --- a/apps/files_encryption/tests/proxy.php +++ b/apps/files_encryption/tests/proxy.php @@ -7,8 +7,13 @@ */ class Test_CryptProxy extends UnitTestCase { + private $oldConfig; public function setUp(){ + $this->oldConfig=OCP\Config::getAppValue('files_encryption','enable_encryption','true'); + OCP\Config::setAppValue('files_encryption','enable_encryption','true'); + + //set testing key $_SESSION['enckey']=md5(time()); @@ -29,10 +34,11 @@ class Test_CryptProxy extends UnitTestCase { $rootView->mkdir('/'.OC_User::getUser().'/files'); } + public function tearDown(){ + OCP\Config::setAppValue('files_encryption','enable_encryption',$this->oldConfig); + } + public function testSimple(){ - $oldConfig=OCP\Config::getAppValue('files_encryption','enable_encryption','true'); - OCP\Config::setAppValue('files_encryption','enable_encryption','true'); - $file=OC::$SERVERROOT.'/3rdparty/MDB2.php'; $original=file_get_contents($file); @@ -46,16 +52,42 @@ class Test_CryptProxy extends UnitTestCase { $this->assertNotEqual($original,$stored); $this->assertEqual($original,$fromFile); + } + + public function testView(){ + $file=OC::$SERVERROOT.'/3rdparty/MDB2.php'; + $original=file_get_contents($file); + $rootView=new OC_FilesystemView(''); $view=new OC_FilesystemView('/'.OC_User::getUser()); $userDir='/'.OC_User::getUser().'/files'; + $rootView->file_put_contents($userDir.'/file',$original); + + OC_FileProxy::$enabled=false; + $stored=$rootView->file_get_contents($userDir.'/file'); + OC_FileProxy::$enabled=true; + + $this->assertNotEqual($original,$stored); $fromFile=$rootView->file_get_contents($userDir.'/file'); $this->assertEqual($original,$fromFile); $fromFile=$view->file_get_contents('files/file'); $this->assertEqual($original,$fromFile); + } - OCP\Config::setAppValue('files_encryption','enable_encryption',$oldConfig); + public function testBinary(){ + $file=__DIR__.'/binary'; + $original=file_get_contents($file); + + OC_Filesystem::file_put_contents('/file',$original); + + OC_FileProxy::$enabled=false; + $stored=OC_Filesystem::file_get_contents('/file'); + OC_FileProxy::$enabled=true; + + $fromFile=OC_Filesystem::file_get_contents('/file'); + $this->assertNotEqual($original,$stored); + $this->assertEqual($original,$fromFile); } } From 03951ccc6b4d710e2e21d4344842a7c310453871 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 15 Jun 2012 23:11:55 +0200 Subject: [PATCH 08/13] fix encryption proxy for updated filecache --- apps/files_encryption/lib/proxy.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/files_encryption/lib/proxy.php b/apps/files_encryption/lib/proxy.php index ad9bcf55f2..b9e719448a 100644 --- a/apps/files_encryption/lib/proxy.php +++ b/apps/files_encryption/lib/proxy.php @@ -67,7 +67,7 @@ class OC_FileProxy_Encryption extends OC_FileProxy{ if(self::shouldEncrypt($path)){ if (!is_resource($data)) {//stream put contents should have been converter to fopen $data=OC_Crypt::blockEncrypt($data); - OC_FileCache::put($path,array('encrypted'=>true)); + OC_FileCache::put($path,array('encrypted'=>true),''); } } } From 6d3ae575b6ed9934e37a884ea152008a29cbfc7b Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Fri, 15 Jun 2012 22:35:09 +0200 Subject: [PATCH 09/13] Remove $DOCUMENTROOT, not used --- apps/user_webfinger/webfinger.php | 7 ------- lib/base.php | 6 +----- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/apps/user_webfinger/webfinger.php b/apps/user_webfinger/webfinger.php index e75c546c2c..39ab4ba6ba 100644 --- a/apps/user_webfinger/webfinger.php +++ b/apps/user_webfinger/webfinger.php @@ -17,13 +17,6 @@ header("Content-Type: application/xrd+json"); * '* but can also use complex database queries to generate the webfinger result **/ -// calculate the documentroot -// modified version of the one in lib/base.php that takes the .well-known symlink into account -/*$DOCUMENTROOT=realpath($_SERVER['DOCUMENT_ROOT']); -$SERVERROOT=str_replace("\\",'/',dirname(dirname(dirname(dirname(__FILE__))))); -$SUBURI=substr(realpath($_SERVER["SCRIPT_FILENAME"]),strlen($SERVERROOT)); -$WEBROOT=substr($SUBURI,0,-34); -*/ $userName = ''; $hostName = ''; diff --git a/lib/base.php b/lib/base.php index f85710ddfc..fedc123885 100644 --- a/lib/base.php +++ b/lib/base.php @@ -121,8 +121,7 @@ class OC{ } public static function initPaths(){ - // calculate the documentroot - $DOCUMENTROOT=realpath($_SERVER['DOCUMENT_ROOT']); + // calculate the root directories OC::$SERVERROOT=str_replace("\\",'/',substr(__FILE__,0,-13)); OC::$SUBURI= str_replace("\\","/",substr(realpath($_SERVER["SCRIPT_FILENAME"]),strlen(OC::$SERVERROOT))); $scriptName=$_SERVER["SCRIPT_NAME"]; @@ -137,9 +136,6 @@ class OC{ } } OC::$WEBROOT=substr($scriptName,0,strlen($scriptName)-strlen(OC::$SUBURI)); - // try a new way to detect the WEBROOT which is simpler and also works with the app directory outside the owncloud folder. let´s see if this works for everybody -// OC::$WEBROOT=substr(OC::$SERVERROOT,strlen($DOCUMENTROOT)); - if(OC::$WEBROOT!='' and OC::$WEBROOT[0]!=='/'){ OC::$WEBROOT='/'.OC::$WEBROOT; From 4268fe61bad04a873a8f161937128dbae1eae741 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Sat, 16 Jun 2012 00:44:23 +0200 Subject: [PATCH 10/13] Calendar: Write-close session to enable parallel events.php requests --- apps/calendar/ajax/events.php | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/calendar/ajax/events.php b/apps/calendar/ajax/events.php index 3f29f1e5ef..39130a6a98 100644 --- a/apps/calendar/ajax/events.php +++ b/apps/calendar/ajax/events.php @@ -11,6 +11,7 @@ require_once('when/When.php'); OCP\JSON::checkLoggedIn(); OCP\JSON::checkAppEnabled('calendar'); +session_write_close(); // Look for the calendar id $calendar_id = null; From e37ef6dd473eaedcdf2814445ae12fb39786d585 Mon Sep 17 00:00:00 2001 From: Tom Needham Date: Fri, 15 Jun 2012 23:14:40 +0000 Subject: [PATCH 11/13] Move user import to personal settings. Fix user migration between servers. --- apps/user_migrate/admin.php | 87 ------------------------ apps/user_migrate/settings.php | 66 +++++++++++++++++- apps/user_migrate/templates/admin.php | 13 ---- apps/user_migrate/templates/settings.php | 13 ++++ lib/migrate.php | 40 ++++------- 5 files changed, 90 insertions(+), 129 deletions(-) delete mode 100644 apps/user_migrate/admin.php delete mode 100644 apps/user_migrate/templates/admin.php diff --git a/apps/user_migrate/admin.php b/apps/user_migrate/admin.php deleted file mode 100644 index df8bff01c8..0000000000 --- a/apps/user_migrate/admin.php +++ /dev/null @@ -1,87 +0,0 @@ -. - * - */ -OCP\User::checkAdminUser(); -OCP\App::checkAppEnabled('user_migrate'); - -// Import? -if (isset($_POST['user_import'])) { - - $root = OC::$SERVERROOT . "/"; - $importname = "owncloud_import_" . date("y-m-d_H-i-s"); - - // Save data dir for later - $datadir = OCP\Config::getSystemValue( 'datadirectory' ); - - // Copy the uploaded file - $from = $_FILES['owncloud_import']['tmp_name']; - $to = get_temp_dir().'/'.$importname.'.zip'; - if( !move_uploaded_file( $from, $to ) ){ - $error = array('error'=>'Failed to move the uploaded file','hint'=>'Try checking the permissions of the '.get_temp_dir().' dir.'); - OCP\Util::writeLog( 'user_migrate', "Failed to copy the uploaded file", OCP\Util::ERROR ); - $tmpl = new OCP\Template('user_migrate', 'admin'); - $tmpl->assign('error',$error); - return $tmpl->fetchPage(); - } - $response = json_decode( OC_Migrate::import( $to, 'user' ) ); - if( !$response->success ){ - $error = array('error'=>'There was an error while importing the user!','hint'=>'Please check the logs for a more detailed explaination'); - $tmpl = new OCP\Template('user_migrate', 'admin'); - $tmpl->assign('error',$error); - return $tmpl->fetchPage(); - } else { - // Check import status - foreach( $response->data as $app => $status ){ - if( $status != 'true' ){ - // It failed for some reason - if( $status == 'notsupported' ){ - $notsupported[] = $app; - } else if( !$status ){ - $failed[] = $app; - } - } - } - // Any problems? - if( isset( $notsupported ) || isset( $failed ) ){ - if( count( $failed ) > 0 ){ - $error = array('error'=>'Some app data failed to import','hint'=>'App data for: '.implode(', ', $failed).' failed to import.'); - $tmpl = new OCP\Template('user_migrate', 'admin'); - $tmpl->assign('error',$error); - return $tmpl->fetchPage(); - } else if( count( $notsupported ) > 0 ){ - $error = array('error'=>'Some app data could not be imported, as the apps are not installed on this instance','hint'=>'App data for: '.implode(', ', $notsupported).' failed to import as they were not found. Please install the apps and try again'); - $tmpl = new OCP\Template('user_migrate', 'admin'); - $tmpl->assign('error',$error); - return $tmpl->fetchPage(); - } - } else { - // Went swimmingly! - $tmpl = new OCP\Template('user_migrate', 'admin'); - return $tmpl->fetchPage(); - } - } - -} else { -// fill template - $tmpl = new OCP\Template('user_migrate', 'admin'); - return $tmpl->fetchPage(); -} diff --git a/apps/user_migrate/settings.php b/apps/user_migrate/settings.php index 8edd035338..098927fa17 100644 --- a/apps/user_migrate/settings.php +++ b/apps/user_migrate/settings.php @@ -23,7 +23,67 @@ * */ OCP\App::checkAppEnabled('user_migrate'); +if (isset($_POST['user_import'])) { + $root = OC::$SERVERROOT . "/"; + $importname = "owncloud_import_" . date("y-m-d_H-i-s"); + + // Save data dir for later + $datadir = OCP\Config::getSystemValue( 'datadirectory' ); + + // Copy the uploaded file + $from = $_FILES['owncloud_import']['tmp_name']; + $to = get_temp_dir().'/'.$importname.'.zip'; + if( !move_uploaded_file( $from, $to ) ){ -// fill template -$tmpl = new OCP\Template('user_migrate', 'settings'); -return $tmpl->fetchPage(); \ No newline at end of file + $error = array('error'=>'Failed to move the uploaded file','hint'=>'Try checking the permissions of the '.get_temp_dir().' dir.'); + OCP\Util::writeLog( 'user_migrate', "Failed to copy the uploaded file", OCP\Util::ERROR ); + $tmpl = new OCP\Template('user_migrate', 'settings'); + $tmpl->assign('error',$error); + //return $tmpl->fetchPage(); + } + + + $response = json_decode( OC_Migrate::import( $to, 'user' ) ); + if( !$response->success ){ + $error = array('error'=>'There was an error while importing the user!','hint'=>'Please check the logs for a more detailed explaination'); + $tmpl = new OCP\Template('user_migrate', 'settings'); + $tmpl->assign('error',$error); + //return $tmpl->fetchPage(); + } else { + // Check import status + foreach( $response->data as $app => $status ){ + if( $status != 'true' ){ + // It failed for some reason + if( $status == 'notsupported' ){ + $notsupported[] = $app; + } else if( !$status ){ + $failed[] = $app; + } + } + } + // Any problems? + if( isset( $notsupported ) || isset( $failed ) ){ + if( count( $failed ) > 0 ){ + $error = array('error'=>'Some app data failed to import','hint'=>'App data for: '.implode(', ', $failed).' failed to import.'); + $tmpl = new OCP\Template('user_migrate', 'settings'); + $tmpl->assign('error',$error); + //return $tmpl->fetchPage(); + } else if( count( $notsupported ) > 0 ){ + $error = array('error'=>'Some app data could not be imported, as the apps are not installed on this instance','hint'=>'App data for: '.implode(', ', $notsupported).' failed to import as they were not found. Please install the apps and try again'); + $tmpl = new OCP\Template('user_migrate', 'settings'); + $tmpl->assign('error',$error); + //return $tmpl->fetchPage(); + } + } else { + // Went swimmingly! + $tmpl = new OCP\Template('user_migrate', 'settings'); + //return $tmpl->fetchPage(); + } + + } + +} else { + // fill template + $tmpl = new OCP\Template('user_migrate', 'settings'); + return $tmpl->fetchPage(); +} \ No newline at end of file diff --git a/apps/user_migrate/templates/admin.php b/apps/user_migrate/templates/admin.php deleted file mode 100644 index ff51f43ffd..0000000000 --- a/apps/user_migrate/templates/admin.php +++ /dev/null @@ -1,13 +0,0 @@ -
-
- -

-

- - t('Import user account');?> -

-

-

- -
-
diff --git a/apps/user_migrate/templates/settings.php b/apps/user_migrate/templates/settings.php index 8f1fe41df0..1718abe9e0 100644 --- a/apps/user_migrate/templates/settings.php +++ b/apps/user_migrate/templates/settings.php @@ -4,3 +4,16 @@

+
+
+ +

+

+ + t('Import user account');?> +

+

+

+ +
+
diff --git a/lib/migrate.php b/lib/migrate.php index f9cab915d0..5939ba32e5 100644 --- a/lib/migrate.php +++ b/lib/migrate.php @@ -196,7 +196,7 @@ class OC_Migrate{ * @param optional $uid userid of new user */ public static function import( $path, $type='user', $uid=null ){ - OC_Util::checkAdminUser(); + $datadir = OC_Config::getValue( 'datadirectory' ); // Extract the zip if( !$extractpath = self::extractZip( $path ) ){ @@ -216,12 +216,19 @@ class OC_Migrate{ } self::$exporttype = $type; + $currentuser = OC_User::getUser(); + // Have we got a user if type is user if( self::$exporttype == 'user' ){ - if( !$uid ){ - self::$uid = $json->exporteduser; - } else { - self::$uid = $uid; + self::$uid = !is_null($uid) ? $uid : $currentuser; + } + + // We need to be an admin if we are not importing our own data + if(($type == 'user' && self::$uid != $currentuser) || $type != 'user' ){ + if( !OC_Group::inGroup( OC_User::getUser(), 'admin' )){ + // Naughty. + OC_Log::write( 'migration', 'Import not permitted.', OC_Log::ERROR ); + return json_encode( array( 'success' => false ) ); } } @@ -229,27 +236,8 @@ class OC_Migrate{ switch( self::$exporttype ){ case 'user': // Check user availability - if( OC_User::userExists( self::$uid ) ){ - OC_Log::write( 'migration', 'User already exists', OC_Log::ERROR ); - return json_encode( array( 'success' => false ) ); - } - $run = true; - OC_Hook::emit( "OC_User", "pre_createUser", array( "run" => &$run, "uid" => self::$uid, "password" => $json->hash )); - if( !$run ){ - // Something stopped the user creation - OC_Log::write( 'migration', 'User creation failed', OC_Log::ERROR ); - return json_encode( array( 'success' => false ) ); - } - // Create the user - if( !self::createUser( self::$uid, $json->hash ) ){ - return json_encode( array( 'success' => false ) ); - } - // Emit the post_createUser hook (password is already hashed, will cause problems - OC_Hook::emit( "OC_User", "post_createUser", array( "uid" => self::$uid, "password" => $json->hash )); - // Make the new users data dir - $path = $datadir . '/' . self::$uid; - if( !mkdir( $path, 0755, true ) ){ - OC_Log::write( 'migration', 'Failed to create users data dir: '.$path, OC_Log::ERROR ); + if( !OC_User::userExists( self::$uid ) ){ + OC_Log::write( 'migration', 'User doesn\'t exist', OC_Log::ERROR ); return json_encode( array( 'success' => false ) ); } // Copy data From 195c37f88a803055c92fd38f33a4eb7a1440e5ab Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 15 Jun 2012 23:48:39 +0200 Subject: [PATCH 12/13] fix for encryption binary files --- apps/files_encryption/lib/crypt.php | 37 ++++++++++++---------- apps/files_encryption/lib/cryptstream.php | 4 ++- apps/files_encryption/tests/encryption.php | 19 +++++++++++ apps/files_encryption/tests/stream.php | 17 +++++++++- 4 files changed, 58 insertions(+), 19 deletions(-) diff --git a/apps/files_encryption/lib/crypt.php b/apps/files_encryption/lib/crypt.php index d2b8ad145a..4c0ffa978e 100644 --- a/apps/files_encryption/lib/crypt.php +++ b/apps/files_encryption/lib/crypt.php @@ -43,22 +43,22 @@ class OC_Crypt { self::init($params['uid'],$params['password']); } - public static function init($login,$password) { - $view1=new OC_FilesystemView('/'); - if(!$view1->file_exists('/'.$login)){ - $view1->mkdir('/'.$login); - } + public static function init($login,$password) { + $view1=new OC_FilesystemView('/'); + if(!$view1->file_exists('/'.$login)){ + $view1->mkdir('/'.$login); + } - $view=new OC_FilesystemView('/'.$login); - - OC_FileProxy::$enabled=false; - if(!$view->file_exists('/encryption.key')){// does key exist? - OC_Crypt::createkey($login,$password); - } - $key=$view->file_get_contents('/encryption.key'); - OC_FileProxy::$enabled=true; - $_SESSION['enckey']=OC_Crypt::decrypt($key, $password); - } + $view=new OC_FilesystemView('/'.$login); + + OC_FileProxy::$enabled=false; + if(!$view->file_exists('/encryption.key')){// does key exist? + OC_Crypt::createkey($login,$password); + } + $key=$view->file_get_contents('/encryption.key'); + OC_FileProxy::$enabled=true; + $_SESSION['enckey']=OC_Crypt::decrypt($key, $password); + } /** @@ -140,7 +140,7 @@ class OC_Crypt { public static function decrypt( $content, $key='') { $bf = self::getBlowfish($key); $data=$bf->decrypt($content); - return rtrim($data, "\0"); + return $data; } /** @@ -181,6 +181,9 @@ class OC_Crypt { while (!feof($handleread)) { $content = fread($handleread, 8192); $enccontent=OC_CRYPT::decrypt( $content, $key); + if(feof($handleread)){ + $enccontent=rtrim($enccontent, "\0"); + } fwrite($handlewrite, $enccontent); } fclose($handlewrite); @@ -209,6 +212,6 @@ class OC_Crypt { $result.=self::decrypt(substr($data,0,8192),$key); $data=substr($data,8192); } - return $result; + return rtrim($result, "\0"); } } diff --git a/apps/files_encryption/lib/cryptstream.php b/apps/files_encryption/lib/cryptstream.php index a698ee0033..56331cbf60 100644 --- a/apps/files_encryption/lib/cryptstream.php +++ b/apps/files_encryption/lib/cryptstream.php @@ -47,7 +47,6 @@ class OC_CryptStream{ $this->path=self::$sourceStreams[basename($path)]['path']; }else{ $this->path=$path; - OCP\Util::writeLog('files_encryption','open encrypted '.$path. ' in '.$mode,OCP\Util::DEBUG); OC_FileProxy::$enabled=false;//disable fileproxies so we can open the source file $this->source=self::$rootView->fopen($path,$mode); OC_FileProxy::$enabled=true; @@ -84,6 +83,9 @@ class OC_CryptStream{ }else{ $result=''; } + if($this->stream_eof()){ + $result=rtrim($result, "\0"); + } return $result; } diff --git a/apps/files_encryption/tests/encryption.php b/apps/files_encryption/tests/encryption.php index cf24a225d2..70aa1daf4c 100644 --- a/apps/files_encryption/tests/encryption.php +++ b/apps/files_encryption/tests/encryption.php @@ -13,6 +13,7 @@ class Test_Encryption extends UnitTestCase { $source=file_get_contents($file); //nice large text file $encrypted=OC_Crypt::encrypt($source,$key); $decrypted=OC_Crypt::decrypt($encrypted,$key); + $decrypted=rtrim($decrypted, "\0"); $this->assertNotEqual($encrypted,$source); $this->assertEqual($decrypted,$source); @@ -20,6 +21,7 @@ class Test_Encryption extends UnitTestCase { $encrypted=OC_Crypt::encrypt($chunk,$key); $this->assertEqual(strlen($chunk),strlen($encrypted)); $decrypted=OC_Crypt::decrypt($encrypted,$key); + $decrypted=rtrim($decrypted, "\0"); $this->assertEqual($decrypted,$chunk); $encrypted=OC_Crypt::blockEncrypt($source,$key); @@ -43,6 +45,7 @@ class Test_Encryption extends UnitTestCase { $source=file_get_contents($file); //binary file $encrypted=OC_Crypt::encrypt($source,$key); $decrypted=OC_Crypt::decrypt($encrypted,$key); + $decrypted=rtrim($decrypted, "\0"); $this->assertEqual($decrypted,$source); $encrypted=OC_Crypt::blockEncrypt($source,$key); @@ -50,4 +53,20 @@ class Test_Encryption extends UnitTestCase { $this->assertEqual($decrypted,$source); } + + function testBinary(){ + $key=uniqid(); + + $file=__DIR__.'/binary'; + $source=file_get_contents($file); //binary file + $encrypted=OC_Crypt::encrypt($source,$key); + $decrypted=OC_Crypt::decrypt($encrypted,$key); + + $decrypted=rtrim($decrypted, "\0"); + $this->assertEqual($decrypted,$source); + + $encrypted=OC_Crypt::blockEncrypt($source,$key); + $decrypted=OC_Crypt::blockDecrypt($encrypted,$key); + $this->assertEqual($decrypted,$source); + } } diff --git a/apps/files_encryption/tests/stream.php b/apps/files_encryption/tests/stream.php index b23805d60b..4ffeb6210a 100644 --- a/apps/files_encryption/tests/stream.php +++ b/apps/files_encryption/tests/stream.php @@ -50,7 +50,22 @@ class Test_CryptStream extends UnitTestCase { $file=$this->tmpFiles[$id]; } $stream=fopen($file,$mode); - OC_CryptStream::$sourceStreams[$id]=array('path'=>'dummy','stream'=>$stream); + OC_CryptStream::$sourceStreams[$id]=array('path'=>'dummy'.$id,'stream'=>$stream); return fopen('crypt://streams/'.$id,$mode); } + + function testBinary(){ + $file=__DIR__.'/binary'; + $source=file_get_contents($file); + + $stream=$this->getStream('test','w'); + fwrite($stream,$source); + fclose($stream); + + $stream=$this->getStream('test','r'); + $data=stream_get_contents($stream); + fclose($stream); + $this->assertEqual(strlen($data),strlen($source)); + $this->assertEqual($source,$data); + } } From bf2062b09d6c3a3d1c8b94b3612b6bb940aa5b79 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sat, 16 Jun 2012 01:35:39 +0200 Subject: [PATCH 13/13] write_close the session when scanning files or music --- apps/files/ajax/scan.php | 1 + apps/media/ajax/api.php | 3 +++ 2 files changed, 4 insertions(+) diff --git a/apps/files/ajax/scan.php b/apps/files/ajax/scan.php index d695ce8161..6fcf97688c 100644 --- a/apps/files/ajax/scan.php +++ b/apps/files/ajax/scan.php @@ -10,6 +10,7 @@ if(!$checkOnly){ $eventSource=new OC_EventSource(); } +session_write_close(); //create the file cache if necesary if($force or !OC_FileCache::inCache('')){ diff --git a/apps/media/ajax/api.php b/apps/media/ajax/api.php index a229c17e80..23abc57927 100644 --- a/apps/media/ajax/api.php +++ b/apps/media/ajax/api.php @@ -46,6 +46,9 @@ if(!isset($arguments['album'])){ if(!isset($arguments['search'])){ $arguments['search']=''; } + +session_write_close(); + OC_MEDIA_COLLECTION::$uid=OCP\USER::getUser(); if($arguments['action']){ switch($arguments['action']){