Issue Bug Closed

#29730transfer a session with FE_SESSION_KEY

tobi no-lastname-given 09/13/11, 09:58 updated 07/09/13, 09:35

Description

If you use the FE_SESSION_KEY the sessionid is written in $_COOKIE[$this->fe_user->name] (tslib_fe::initFEuser()). Later in the workflow the skript looks for the sessionid in $_SERVER[‘HTTP_COOKIE’] (t3lib_userauth::getCookie()). But the sessionid was stored in $_COOKIE.

Here is my fixed version of tslib_fe::initFEuser():
function initFEuser() {
$this->fe_user = t3lib_div::makeInstance(‘tslib_feUserAuth’);

$this->fe_user->lockIP = $this->TYPO3_CONF_VARS[‘FE’][‘lockIP’];
$this->fe_user->checkPid = $this->TYPO3_CONF_VARS[‘FE’][‘checkFeUserPid’];
$this->fe_user->lifetime = intval($this->TYPO3_CONF_VARS[‘FE’][‘lifetime’]);
$this->fe_user->checkPid_value = $GLOBALS[‘TYPO3_DB’]->cleanIntList(t3lib_div::_GP(‘pid’)); // List of pid’s acceptable
  // Check if a session is transferred:
if (t3lib_div::_GP(‘FE_SESSION_KEY’)) {
$fe_sParts = explode(‘-’,t3lib_div::_GP(‘FE_SESSION_KEY’));
if (!strcmp(md5($fe_sParts0.’/’.$this->TYPO3_CONF_VARS[‘SYS’][‘encryptionKey’]), $fe_sParts1)) { // If the session key hash check is OK:
    if (isset($_SERVER[‘HTTP_COOKIE’])) {
      $lastCookie = null;
$cookies = t3lib_div::trimExplode(‘;’, $_SERVER[‘HTTP_COOKIE’]);
foreach ($cookies as $cookie) {
list ($name, $value) = t3lib_div::trimExplode(‘=’, $cookie);
if (strcmp(trim($name), $this->fe_user->name) == 0) {
// Use the last one
$lastCookie = $cookie;
}
}
if($lastCookie) {
$_SERVER[‘HTTP_COOKIE’] = str_replace($lastCookie ,$this->fe_user->name .’=’. $fe_sParts0, $_SERVER[‘HTTP_COOKIE’]);
} else {
$_SERVER[‘HTTP_COOKIE’] .= ‘;’ . $this->fe_user->name .’=’. $fe_sParts0;
}
}
    $_COOKIE[$this->fe_user->name] = $fe_sParts0;
$this->fe_user->forceSetCookie = 1;
}
}
}

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.