Merge remote-tracking branch 'origin/QA_4_2'

This commit is contained in:
Michal Čihař 2014-06-12 10:19:00 +02:00
commit 0652ca9ccd
2 changed files with 20 additions and 7 deletions

View File

@ -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()

View File

@ -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',