diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Base/DateTimeHelper.php b/snappymail/v/0.0.0/app/libraries/MailSo/Base/DateTimeHelper.php index 2666f55b5..4e234482b 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Base/DateTimeHelper.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Base/DateTimeHelper.php @@ -37,7 +37,7 @@ abstract class DateTimeHelper { $sDateTime = \trim($sDateTime); if (empty($sDateTime)) { - \SnappyMail\Log::info("No RFC 2822 date to parse"); + \SnappyMail\Log::info('', "No RFC 2822 date to parse"); return 0; } @@ -45,7 +45,7 @@ abstract class DateTimeHelper $oDateTime = \DateTime::createFromFormat(\DateTime::RFC2822, $sDateTime, static::GetUtcTimeZoneObject()); // 398045302 is 1982-08-13 00:08:22 the date RFC 822 was created if (!$oDateTime || 398045302 > $oDateTime->getTimestamp()) { - \SnappyMail\Log::notice("Failed to parse RFC 2822 date '{$sDateTime}'"); + \SnappyMail\Log::notice('', "Failed to parse RFC 2822 date '{$sDateTime}'"); } return $oDateTime ? $oDateTime->getTimestamp() : 0; } diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Log/Logger.php b/snappymail/v/0.0.0/app/libraries/MailSo/Log/Logger.php index 58bd3c2d4..e1cec4c16 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Log/Logger.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Log/Logger.php @@ -206,17 +206,15 @@ class Logger extends \SplFixedArray } } - public function signalHandler($signo) + public function signalHandler($signo, /*?array*/$siginfo = null) { if (\SIGTERM == $signo) { exit; } - if ($this->bUsed) { - foreach (static::$SIGNALS as $SIGNAL) { - if (\defined($SIGNAL) && \constant($SIGNAL) == $signo) { - $this->Write("Caught {$SIGNAL}"); - break; - } + foreach (static::$SIGNALS as $SIGNAL) { + if (\defined($SIGNAL) && \constant($SIGNAL) == $signo) { + $this->Write("Caught {$SIGNAL} ".($siginfo ? \json_encode($siginfo) : ''), \LOG_CRIT, 'PHP'); + break; } } } diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/UserAuth.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/UserAuth.php index eef0a4ab1..694bdc41f 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/UserAuth.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/UserAuth.php @@ -341,11 +341,14 @@ trait UserAuth \SnappyMail\Log::notice(self::AUTH_SIGN_ME_TOKEN_KEY, 'decrypt'); $aResult = \SnappyMail\Crypt::DecryptUrlSafe($sSignMeToken, 'signme'); if (isset($aResult['e'], $aResult['u']) && \SnappyMail\UUID::isValid($aResult['u'])) { + if (!isset($aResult['c'])) { + $aTokenData['c'] = \array_key_last($aTokenData); + $aTokenData['d'] = \end($aTokenData); + } return $aResult; } \SnappyMail\Log::notice(self::AUTH_SIGN_ME_TOKEN_KEY, 'invalid'); - // Don't clear due to login checkbox -// Cookies::clear(self::AUTH_SIGN_ME_TOKEN_KEY); + Cookies::clear(self::AUTH_SIGN_ME_TOKEN_KEY); } return null; } @@ -360,7 +363,8 @@ trait UserAuth \SnappyMail\Crypt::EncryptUrlSafe([ 'e' => $oAccount->Email(), 'u' => $uuid, - $data[0] => \base64_encode($data[1]) + 'c' => $data[0], + 'd' => \base64_encode($data[1]) ], 'signme'), \time() + 3600 * 24 * 30 // 30 days ); @@ -382,8 +386,8 @@ trait UserAuth throw new \RuntimeException("server token not found for {$aTokenData['e']}/.sign_me/{$aTokenData['u']}"); } $aAccountHash = \SnappyMail\Crypt::Decrypt([ - \array_key_last($aTokenData), - \base64_decode(\end($aTokenData)), + $aTokenData['c'], + \base64_decode($aTokenData['d']), $sAuthToken ], 'signme'); if (!\is_array($aAccountHash)) { @@ -401,8 +405,7 @@ trait UserAuth catch (\Throwable $oException) { \SnappyMail\Log::warning(self::AUTH_SIGN_ME_TOKEN_KEY, $oException->getMessage()); - // Don't clear due to smctoken cookie missing at initialization and login checkbox -// $this->ClearSignMeData(); + $this->ClearSignMeData(); } } return null;