Browse Source

Fix for #23066 (#24689)

tags/v9.0.1beta2
Torben Dannhauer 8 years ago
parent
commit
718f0757e4
3 changed files with 8 additions and 4 deletions
  1. 2
    2
      apps/files_sharing/lib/Helper.php
  2. 1
    1
      lib/private/Share/Share.php
  3. 5
    1
      tests/lib/Share/ShareTest.php

+ 2
- 2
apps/files_sharing/lib/Helper.php View File

@@ -126,7 +126,7 @@ class Helper {
$newHash = '';
if(\OC::$server->getHasher()->verify($password, $linkItem['share_with'], $newHash)) {
// Save item id in session for future requests
\OC::$server->getSession()->set('public_link_authenticated', $linkItem['id']);
\OC::$server->getSession()->set('public_link_authenticated', (string) $linkItem['id']);

/**
* FIXME: Migrate old hashes to new hash format
@@ -156,7 +156,7 @@ class Helper {
else {
// not authenticated ?
if ( ! \OC::$server->getSession()->exists('public_link_authenticated')
|| \OC::$server->getSession()->get('public_link_authenticated') !== $linkItem['id']) {
|| \OC::$server->getSession()->get('public_link_authenticated') !== (string)$linkItem['id']) {
return false;
}
}

+ 1
- 1
lib/private/Share/Share.php View File

@@ -2493,7 +2493,7 @@ class Share extends Constants {
}

if ( \OC::$server->getSession()->exists('public_link_authenticated')
&& \OC::$server->getSession()->get('public_link_authenticated') === $linkItem['id'] ) {
&& \OC::$server->getSession()->get('public_link_authenticated') === (string)$linkItem['id'] ) {
return true;
}


+ 5
- 1
tests/lib/Share/ShareTest.php View File

@@ -990,7 +990,7 @@ class ShareTest extends \Test\TestCase {
* @param $item
*/
public function testCheckPasswordProtectedShare($expected, $item) {
\OC::$server->getSession()->set('public_link_authenticated', 100);
\OC::$server->getSession()->set('public_link_authenticated', '100');
$result = \OCP\Share::checkPasswordProtectedShare($item);
$this->assertEquals($expected, $result);
}
@@ -1002,8 +1002,12 @@ class ShareTest extends \Test\TestCase {
array(true, array('share_with' => '')),
array(true, array('share_with' => '1234567890', 'share_type' => '1')),
array(true, array('share_with' => '1234567890', 'share_type' => 1)),
array(true, array('share_with' => '1234567890', 'share_type' => '3', 'id' => '100')),
array(true, array('share_with' => '1234567890', 'share_type' => 3, 'id' => '100')),
array(true, array('share_with' => '1234567890', 'share_type' => '3', 'id' => 100)),
array(true, array('share_with' => '1234567890', 'share_type' => 3, 'id' => 100)),
array(false, array('share_with' => '1234567890', 'share_type' => '3', 'id' => '101')),
array(false, array('share_with' => '1234567890', 'share_type' => 3, 'id' => '101')),
array(false, array('share_with' => '1234567890', 'share_type' => '3', 'id' => 101)),
array(false, array('share_with' => '1234567890', 'share_type' => 3, 'id' => 101)),
);

Loading…
Cancel
Save