From 783defa2a9cc7675033fc171fa310a65bfd51c02 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Wed, 1 Sep 2004 16:16:42 +0000 Subject: [PATCH] bug 939531 undefined offset in blowfish.php --- libraries/auth/cookie.auth.lib.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/libraries/auth/cookie.auth.lib.php b/libraries/auth/cookie.auth.lib.php index b01cfb8d4e..460be6d75f 100644 --- a/libraries/auth/cookie.auth.lib.php +++ b/libraries/auth/cookie.auth.lib.php @@ -148,12 +148,13 @@ function PMA_auth() // should be recalled, else skip the IE autocomplete feature. if ($cfg['LoginCookieRecall']) { // username - if (!empty($GLOBALS['pma_cookie_username'])) { - $default_user = $GLOBALS['pma_cookie_username']; - } - else if (!empty($_COOKIE) && isset($_COOKIE['pma_cookie_username-' . $server])) { + // do not try to use pma_cookie_username as it was encoded differently + // in previous versions and would produce an undefined offset in blowfish + + if (!empty($_COOKIE) && isset($_COOKIE['pma_cookie_username-' . $server])) { $default_user = $_COOKIE['pma_cookie_username-' . $server]; } + $decrypted_user = isset($default_user) ? PMA_blowfish_decrypt($default_user, $GLOBALS['cfg']['blowfish_secret']) : ''; $pos = strrpos($decrypted_user, ':'); $default_user = substr($decrypted_user, 0, $pos); @@ -513,11 +514,7 @@ function PMA_auth_check() } // username - if (!empty($pma_cookie_username)) { - $PHP_AUTH_USER = $pma_cookie_username; - $from_cookie = TRUE; - } - else if (!empty($_COOKIE) && isset($_COOKIE['pma_cookie_username-' . $server])) { + if (!empty($_COOKIE) && isset($_COOKIE['pma_cookie_username-' . $server])) { $PHP_AUTH_USER = $_COOKIE['pma_cookie_username-' . $server]; $from_cookie = TRUE; }