Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Commit 3245025

Browse files
committed
Close session when sending binary files. Could create a race condition with tryLogUserFromCookie.
1 parent 7c86d43 commit 3245025

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

core/src/core/classes/class.ConfService.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -462,11 +462,10 @@ public function switchRootDirInst($rootDirIndex=-1, $temporary=false)
462462
}
463463
}
464464
} else {
465-
/*
466-
if (isSet($this->configs["REPOSITORY"]) && $this->configs["REPOSITORY"] == $rootDirIndex) {
467-
return;
465+
$object = self::getRepositoryById($rootDirIndex);
466+
if($object == null || !self::repositoryIsAccessible($rootDirIndex, $object)) {
467+
throw new Exception("Trying to switch to an unauthorized repository");
468468
}
469-
*/
470469
if ($temporary && (isSet($_SESSION['REPO_ID']) || $this->contextRepositoryId != null)) {
471470
$crtId = self::$useSession ? $_SESSION['REPO_ID'] : $this->contextRepositoryId;
472471
if ($crtId != $rootDirIndex && !isSet($_SESSION['SWITCH_BACK_REPO_ID'])) {

core/src/plugins/core.conf/class.AbstractConfDriver.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,6 +1241,7 @@ public function switchAction($action, $httpVars, $fileVars)
12411241
if (isSet($httpVars["tmp_file"])) {
12421242
$file = AJXP_Utils::getAjxpTmpDir()."/".AJXP_Utils::securePath($httpVars["tmp_file"]);
12431243
if (isSet($file)) {
1244+
session_write_close();
12441245
header("Content-Type:image/png");
12451246
readfile($file);
12461247
}
@@ -1253,12 +1254,14 @@ public function switchAction($action, $httpVars, $fileVars)
12531254
} else {
12541255
$context = array();
12551256
}
1257+
session_write_close();
12561258
$this->loadBinary($context, AJXP_Utils::sanitize($httpVars["binary_id"], AJXP_SANITIZE_ALPHANUM));
12571259
}
12581260
break;
12591261

12601262
case "get_global_binary_param" :
12611263

1264+
session_write_close();
12621265
if (isSet($httpVars["tmp_file"])) {
12631266
$file = AJXP_Utils::getAjxpTmpDir()."/".AJXP_Utils::securePath($httpVars["tmp_file"]);
12641267
if (isSet($file)) {

core/src/plugins/core.notifications/class.AJXP_NotificationCenter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public function loadUserFeed($actionName, $httpVars, $fileVars)
136136
if(!$this->eventStore) return array();
137137
$u = AuthService::getLoggedUser();
138138
if ($u == null) {
139-
if($httpVars["format"] == "html") return array();
139+
if($httpVars["format"] == "html" || $httpVars["format"] == "array") return array();
140140
AJXP_XMLWriter::header();
141141
AJXP_XMLWriter::close();
142142
return array();

core/src/plugins/gui.ajax/res/js/es6/Pydio.es6

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ class Pydio extends Observable{
114114
if(this.UI.modal) this.UI.modal.initForms();
115115
this.UI.initObjects();
116116

117-
PydioApi.getClient().tryToLogUserFromRememberData();
117+
if(!this.user) {
118+
PydioApi.getClient().tryToLogUserFromRememberData();
119+
}
118120
this.fire("registry_loaded", this.Registry.getXML());
119121

120122
window.setTimeout(function(){

0 commit comments

Comments
 (0)