From 9f1f0e6bc1e4161e048628a3b177d97faac0254d Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Wed, 11 Mar 2015 14:12:26 +0530 Subject: [PATCH] Per server iv Signed-off-by: Madhura Jayaratne --- libraries/plugins/auth/AuthenticationCookie.class.php | 6 +++--- .../plugin/auth/PMA_AuthenticationCookie_test.php | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libraries/plugins/auth/AuthenticationCookie.class.php b/libraries/plugins/auth/AuthenticationCookie.class.php index 6a013cacbc..7db3eb2071 100644 --- a/libraries/plugins/auth/AuthenticationCookie.class.php +++ b/libraries/plugins/auth/AuthenticationCookie.class.php @@ -442,7 +442,7 @@ class AuthenticationCookie extends AuthenticationPlugin // check cookies if (empty($_COOKIE['pmaUser-' . $GLOBALS['server']]) - || empty($_COOKIE['pma_iv']) + || empty($_COOKIE['pma_iv-' . $GLOBALS['server']]) ) { return false; } @@ -784,7 +784,7 @@ class AuthenticationCookie extends AuthenticationPlugin public function cookieDecrypt($encdata, $secret) { if (is_null($this->_cookie_iv)) { - $this->_cookie_iv = base64_decode($_COOKIE['pma_iv'], true); + $this->_cookie_iv = base64_decode($_COOKIE['pma_iv-' . $GLOBALS['server']], true); } if (strlen($this->_cookie_iv) < $this->getIVSize()) { $this->createIV(); @@ -840,7 +840,7 @@ class AuthenticationCookie extends AuthenticationPlugin ); } $GLOBALS['PMA_Config']->setCookie( - 'pma_iv', + 'pma_iv-' . $GLOBALS['server'], base64_encode($this->_cookie_iv) ); } diff --git a/test/classes/plugin/auth/PMA_AuthenticationCookie_test.php b/test/classes/plugin/auth/PMA_AuthenticationCookie_test.php index 3941b9299a..83e10a9637 100644 --- a/test/classes/plugin/auth/PMA_AuthenticationCookie_test.php +++ b/test/classes/plugin/auth/PMA_AuthenticationCookie_test.php @@ -544,7 +544,7 @@ class PMA_AuthenticationCookie_Test extends PHPUnit_Framework_TestCase $GLOBALS['server'] = 1; $_COOKIE['pmaServer-1'] = 'pmaServ1'; $_COOKIE['pmaUser-1'] = ''; - $_COOKIE['pma_iv'] = base64_encode('testiv09testiv09'); + $_COOKIE['pma_iv-1'] = base64_encode('testiv09testiv09'); $this->assertFalse( $this->object->authCheck() @@ -560,7 +560,7 @@ class PMA_AuthenticationCookie_Test extends PHPUnit_Framework_TestCase $GLOBALS['server'] = 1; $_COOKIE['pmaServer-1'] = 'pmaServ1'; $_COOKIE['pmaUser-1'] = 'pmaUser1'; - $_COOKIE['pma_iv'] = base64_encode('testiv09testiv09'); + $_COOKIE['pma_iv-1'] = base64_encode('testiv09testiv09'); $_COOKIE['pmaPass-1'] = ''; $GLOBALS['cfg']['blowfish_secret'] = 'secret'; $_SESSION['last_access_time'] = time() - 1000; @@ -635,7 +635,7 @@ class PMA_AuthenticationCookie_Test extends PHPUnit_Framework_TestCase $_REQUEST['pma_username'] = ''; $_COOKIE['pmaServer-1'] = 'pmaServ1'; $_COOKIE['pmaUser-1'] = 'pmaUser1'; - $_COOKIE['pma_iv'] = base64_encode('testiv09testiv09'); + $_COOKIE['pma_iv-1'] = base64_encode('testiv09testiv09'); $GLOBALS['cfg']['blowfish_secret'] = 'secret'; $_SESSION['last_access_time'] = ''; $_SESSION['last_valid_captcha'] = true; @@ -674,7 +674,7 @@ class PMA_AuthenticationCookie_Test extends PHPUnit_Framework_TestCase $_COOKIE['pmaServer-1'] = 'pmaServ1'; $_COOKIE['pmaUser-1'] = 'pmaUser1'; $_COOKIE['pmaPass-1'] = 'pmaPass1'; - $_COOKIE['pma_iv'] = base64_encode('testiv09testiv09'); + $_COOKIE['pma_iv-1'] = base64_encode('testiv09testiv09'); $GLOBALS['cfg']['blowfish_secret'] = 'secret'; $_SESSION['last_valid_captcha'] = true; $_SESSION['last_access_time'] = time() - 1000; @@ -718,7 +718,7 @@ class PMA_AuthenticationCookie_Test extends PHPUnit_Framework_TestCase $_REQUEST['pma_username'] = ''; $_COOKIE['pmaServer-1'] = 'pmaServ1'; $_COOKIE['pmaUser-1'] = 'pmaUser1'; - $_COOKIE['pma_iv'] = base64_encode('testiv09testiv09'); + $_COOKIE['pma_iv-1'] = base64_encode('testiv09testiv09'); $GLOBALS['cfg']['blowfish_secret'] = 'secret'; $_SESSION['last_access_time'] = 1; $_SESSION['last_valid_captcha'] = true;