Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2020-05-28 21:37:18 +0300
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2020-05-29 15:42:16 +0300
commit1c580351da069bbdfdb55559ca6800f11c6d6090 (patch)
treee39172787c89b364956413d371cfe1b3387656f2 /lib
parent26e4c292c7284ce6e1e3ddb52ae02123f19482b1 (diff)
Fix enabling send password by Talk with same password in mail shares
When "send password by Talk" is enabled in a mail share a new password must be also set. However, when the passwords of the original and the new share were compared it was not taken into account that the original password is now hashed, while the new one is not (unless no new password was sent, in which case the password of the original share was set in the new share by the controller, but that was already prevented due to both passwords being literally the same), so it was possible to set the same password again. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Share20/Manager.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php
index f88d884c0db..08dca45a299 100644
--- a/lib/private/Share20/Manager.php
+++ b/lib/private/Share20/Manager.php
@@ -1085,8 +1085,14 @@ class Manager implements IManager {
* @return boolean whether the password was updated or not.
*/
private function updateSharePasswordIfNeeded(\OCP\Share\IShare $share, \OCP\Share\IShare $originalShare) {
+ $passwordsAreDifferent = ($share->getPassword() !== $originalShare->getPassword()) &&
+ (($share->getPassword() !== null && $originalShare->getPassword() === null) ||
+ ($share->getPassword() === null && $originalShare->getPassword() !== null) ||
+ ($share->getPassword() !== null && $originalShare->getPassword() !== null &&
+ !$this->hasher->verify($share->getPassword(), $originalShare->getPassword())));
+
// Password updated.
- if ($share->getPassword() !== $originalShare->getPassword()) {
+ if ($passwordsAreDifferent) {
//Verify the password
$this->verifyPassword($share->getPassword());
@@ -1096,6 +1102,10 @@ class Manager implements IManager {
return true;
}
+ } else {
+ // Reset the password to the original one, as it is either the same
+ // as the "new" password or a hashed version of it.
+ $share->setPassword($originalShare->getPassword());
}
return false;