summaryrefslogtreecommitdiffstats
path: root/lib/private/Share20/Manager.php
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2020-05-28 20:40:33 +0200
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2020-05-29 02:46:12 +0200
commit45de42a6b8b34d439becfaa9bf5ccfe6cb768203 (patch)
treeaa2e05bf0577b9d7219634745652144293f3e724 /lib/private/Share20/Manager.php
parenta426f84dbe20c02f81cfec70a5a5bd73950a70b3 (diff)
downloadnextcloud-server-45de42a6b8b34d439becfaa9bf5ccfe6cb768203.tar.gz
nextcloud-server-45de42a6b8b34d439becfaa9bf5ccfe6cb768203.zip
Fix disabling send password by Talk without new password in mail shares
When "send password by Talk" was disabled in a mail share it was possible to keep the same password as before, as it does not pose any security issue (unlike keeping it when "send password by Talk" is enabled, as in that case the password was already disclosed by mail). However, if a mail share is updated but the password is not set again only the hashed password will be available. In that case it would not make sense to send the password by mail, so now the password must be changed when disabling "send password by Talk". Note that, even if explicitly setting the same password again along with the "send password by Talk" property would work, this was also prevented for simplicity. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'lib/private/Share20/Manager.php')
-rw-r--r--lib/private/Share20/Manager.php8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php
index 2850cba7e45..86b34a4b9f0 100644
--- a/lib/private/Share20/Manager.php
+++ b/lib/private/Share20/Manager.php
@@ -983,11 +983,9 @@ class Manager implements IManager {
}
} elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_EMAIL) {
// The new password is not set again if it is the same as the old
- // one, unless when switching from sending by Talk to sending by
- // mail.
+ // one.
$plainTextPassword = $share->getPassword();
- if (!empty($plainTextPassword) && !$this->updateSharePasswordIfNeeded($share, $originalShare) &&
- !($originalShare->getSendPasswordByTalk() && !$share->getSendPasswordByTalk())) {
+ if (!empty($plainTextPassword) && !$this->updateSharePasswordIfNeeded($share, $originalShare)) {
$plainTextPassword = null;
}
if (empty($plainTextPassword) && !$originalShare->getSendPasswordByTalk() && $share->getSendPasswordByTalk()) {
@@ -995,6 +993,8 @@ class Manager implements IManager {
// would already have access to the share without having to call
// the sharer to verify her identity
throw new \InvalidArgumentException('Can’t enable sending the password by Talk without setting a new password');
+ } elseif (empty($plainTextPassword) && $originalShare->getSendPasswordByTalk() && !$share->getSendPasswordByTalk()) {
+ throw new \InvalidArgumentException('Can’t disable sending the password by Talk without setting a new password');
}
}