diff options
author | Roeland Jago Douma <rullzer@owncloud.com> | 2016-02-01 21:46:32 +0100 |
---|---|---|
committer | Roeland Jago Douma <rullzer@owncloud.com> | 2016-02-01 21:46:32 +0100 |
commit | 619a4d2e523052f0b2b55f1819aff6bc9883537a (patch) | |
tree | 712ee014c77e4854e26168a31de1a4730f19fd4b /tests | |
parent | b4853f3fce696b8b89f0dd898b25d7fde93e1a92 (diff) | |
download | nextcloud-server-619a4d2e523052f0b2b55f1819aff6bc9883537a.tar.gz nextcloud-server-619a4d2e523052f0b2b55f1819aff6bc9883537a.zip |
Update old password hashed for link shares on access
Fixes https://github.com/owncloud/core/issues/16594
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/share20/managertest.php | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/lib/share20/managertest.php b/tests/lib/share20/managertest.php index b5559bb5172..cdcb71ed1e5 100644 --- a/tests/lib/share20/managertest.php +++ b/tests/lib/share20/managertest.php @@ -1645,6 +1645,27 @@ class ManagerTest extends \Test\TestCase { $this->assertTrue($this->manager->checkPassword($share, 'password')); } + public function testCheckPasswordUpdateShare() { + $share = $this->manager->newShare(); + $share->setShareType(\OCP\Share::SHARE_TYPE_LINK) + ->setPassword('passwordHash'); + + $this->hasher->method('verify')->with('password', 'passwordHash', '') + ->will($this->returnCallback(function($pass, $hash, &$newHash) { + $newHash = 'newHash'; + + return true; + })); + + $this->defaultProvider->expects($this->once()) + ->method('update') + ->with($this->callback(function (\OCP\Share\IShare $share) { + return $share->getPassword() === 'newHash'; + })); + + $this->assertTrue($this->manager->checkPassword($share, 'password')); + } + /** * @expectedException Exception * @expectedExceptionMessage The Share API is disabled |