diff --git a/libraries/plugins/auth/AuthenticationCookie.class.php b/libraries/plugins/auth/AuthenticationCookie.class.php index 88bd85288a..69c92a83e4 100644 --- a/libraries/plugins/auth/AuthenticationCookie.class.php +++ b/libraries/plugins/auth/AuthenticationCookie.class.php @@ -772,6 +772,18 @@ class AuthenticationCookie extends AuthenticationPlugin } } + /** + * Sets Blowfis IV to use + * + * @param string $vector The IV + * + * @return void + */ + public function setBlowfishIv($vector) + { + $this->_blowfish_iv = $vector; + } + /** * This method is called when any PluginManager to which the observer * is attached calls PluginManager::notify() diff --git a/test/classes/plugin/auth/PMA_AuthenticationCookie_test.php b/test/classes/plugin/auth/PMA_AuthenticationCookie_test.php index bfa81be384..15208ebd4a 100644 --- a/test/classes/plugin/auth/PMA_AuthenticationCookie_test.php +++ b/test/classes/plugin/auth/PMA_AuthenticationCookie_test.php @@ -574,6 +574,7 @@ class PMA_AuthenticationCookie_Test extends PHPUnit_Framework_TestCase $GLOBALS['server'] = 1; $_COOKIE['pmaServer-1'] = 'pmaServ1'; $_COOKIE['pmaUser-1'] = ''; + $_COOKIE['pma_mcrypt_iv'] = base64_encode('testiv09'); $this->assertFalse( $this->object->authCheck() @@ -589,6 +590,7 @@ class PMA_AuthenticationCookie_Test extends PHPUnit_Framework_TestCase $GLOBALS['server'] = 1; $_COOKIE['pmaServer-1'] = 'pmaServ1'; $_COOKIE['pmaUser-1'] = 'pmaUser1'; + $_COOKIE['pma_mcrypt_iv'] = base64_encode('testiv09'); $_COOKIE['pmaPass-1'] = ''; $GLOBALS['cfg']['blowfish_secret'] = 'secret'; $_SESSION['last_access_time'] = time() - 1000; @@ -663,6 +665,7 @@ class PMA_AuthenticationCookie_Test extends PHPUnit_Framework_TestCase $_REQUEST['pma_username'] = ''; $_COOKIE['pmaServer-1'] = 'pmaServ1'; $_COOKIE['pmaUser-1'] = 'pmaUser1'; + $_COOKIE['pma_mcrypt_iv'] = base64_encode('testiv09'); $GLOBALS['cfg']['blowfish_secret'] = 'secret'; $_SESSION['last_access_time'] = ''; $_SESSION['last_valid_captcha'] = true; @@ -701,6 +704,7 @@ class PMA_AuthenticationCookie_Test extends PHPUnit_Framework_TestCase $_COOKIE['pmaServer-1'] = 'pmaServ1'; $_COOKIE['pmaUser-1'] = 'pmaUser1'; $_COOKIE['pmaPass-1'] = 'pmaPass1'; + $_COOKIE['pma_mcrypt_iv'] = base64_encode('testiv09'); $GLOBALS['cfg']['blowfish_secret'] = 'secret'; $_SESSION['last_valid_captcha'] = true; $_SESSION['last_access_time'] = time() - 1000; @@ -744,6 +748,7 @@ class PMA_AuthenticationCookie_Test extends PHPUnit_Framework_TestCase $_REQUEST['pma_username'] = ''; $_COOKIE['pmaServer-1'] = 'pmaServ1'; $_COOKIE['pmaUser-1'] = 'pmaUser1'; + $_COOKIE['pma_mcrypt_iv'] = base64_encode('testiv09'); $GLOBALS['cfg']['blowfish_secret'] = 'secret'; $_SESSION['last_access_time'] = 1; $_SESSION['last_valid_captcha'] = true; @@ -1057,13 +1062,12 @@ class PMA_AuthenticationCookie_Test extends PHPUnit_Framework_TestCase ); } else { //using our own iv for testing - $tmp = $GLOBALS['iv']; - $GLOBALS['iv'] = "testiv09"; + $this->object->createBlowfishIV(); + $this->object->setBlowfishIv('testiv09'); $this->assertEquals( 'x/2GwHKoPyc=', $this->object->blowfishEncrypt('data123', 'sec321') ); - $GLOBALS['iv'] = $tmp; } } @@ -1077,14 +1081,11 @@ class PMA_AuthenticationCookie_Test extends PHPUnit_Framework_TestCase if (function_exists('mcrypt_encrypt')) { //using our own iv for testing - $tmp = $GLOBALS['iv']; - $GLOBALS['iv'] = "testiv09"; + $this->object->setBlowfishIv('testiv09'); $this->assertEquals( 'data123', $this->object->blowfishDecrypt('x/2GwHKoPyc=', 'sec321') ); - $GLOBALS['iv'] = $tmp; - } else { $this->assertEquals( 'data123',