summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2020-05-28 20:37:18 +0200
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2020-05-29 19:38:28 +0000
commit6e19f53173ed8524e1bbb13a9ede36865fd24636 (patch)
treee39172787c89b364956413d371cfe1b3387656f2 /lib/private
parent57663d19f10793911cf69391feff26df225ca0a6 (diff)
downloadnextcloud-server-6e19f53173ed8524e1bbb13a9ede36865fd24636.tar.gz
nextcloud-server-6e19f53173ed8524e1bbb13a9ede36865fd24636.zip
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/private')
-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;