summaryrefslogtreecommitdiffstats
path: root/lib/private/Session
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2017-03-13 22:14:11 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2017-03-13 22:16:56 +0100
commitbb94b39745cc1b38dcc6fb12b7ec028cde3a4a11 (patch)
treeda73be1424f39847e27c6d7730fd909e4c383be7 /lib/private/Session
parentaf16416de51a40e3fbb1e8499bbe8bf3b77ab5af (diff)
downloadnextcloud-server-bb94b39745cc1b38dcc6fb12b7ec028cde3a4a11.tar.gz
nextcloud-server-bb94b39745cc1b38dcc6fb12b7ec028cde3a4a11.zip
Do not clear CSRF token on logout (fix for #1303)
This is a hacky way to allow the use case of #1303. What happens is 1. User tries to login 2. PreLoginHook kicks in and figures out that the user need to change their LDAP password or whatever => redirects user 3. While loading the redirect some logic of ours kicks in and logouts the user (thus clearing the session). 4. We render the new page but now the session and the page disagree about the CSRF token This is kind of hacky but I don't think it introduces new attack vectors. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib/private/Session')
-rw-r--r--lib/private/Session/CryptoSessionData.php4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/private/Session/CryptoSessionData.php b/lib/private/Session/CryptoSessionData.php
index 58020edf66d..4e0b852cb35 100644
--- a/lib/private/Session/CryptoSessionData.php
+++ b/lib/private/Session/CryptoSessionData.php
@@ -129,7 +129,11 @@ class CryptoSessionData implements \ArrayAccess, ISession {
* Reset and recreate the session
*/
public function clear() {
+ $requesttoken = $this->get('requesttoken');
$this->sessionValues = [];
+ if ($requesttoken !== null) {
+ $this->set('requesttoken', $requesttoken);
+ }
$this->isModified = true;
$this->session->clear();
}