From 9df074aad300067860ca803256036a8c2ce455e6 Mon Sep 17 00:00:00 2001 From: Herman van Rink Date: Thu, 7 May 2009 07:56:13 +0000 Subject: [PATCH] patch #2665440 Detect mcrypt initialization failure --- ChangeLog | 1 + libraries/auth/cookie.auth.lib.php | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 295d0ed03c..c45470f641 100644 --- a/ChangeLog +++ b/ChangeLog @@ -61,6 +61,7 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA thanks to Virsacer - virsacer + rfe #2657696 Automatically copy generated password - bug #2787162 [interface] Table with name 'log_views' is incorrectly displayed as a view ++ patch #2665440 Detect mcrypt initialization failure 3.1.5.0 (not yet released) - patch #2739001 [export] XML does not allow spaces in element names, diff --git a/libraries/auth/cookie.auth.lib.php b/libraries/auth/cookie.auth.lib.php index 70484d2784..b5b63082bc 100644 --- a/libraries/auth/cookie.auth.lib.php +++ b/libraries/auth/cookie.auth.lib.php @@ -34,7 +34,11 @@ if (function_exists('mcrypt_encrypt')) { if (empty($_COOKIE['pma_mcrypt_iv']) || false === ($iv = base64_decode($_COOKIE['pma_mcrypt_iv'], true))) { srand((double) microtime() * 1000000); - $iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_CBC), MCRYPT_RAND); + $td = mcrypt_module_open(MCRYPT_BLOWFISH, '', MCRYPT_MODE_CBC, ''); + if ($td === false) { + trigger_error(PMA_sanitize(sprintf($strCantLoad, 'mcrypt')), E_USER_WARNING); + } + $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_RAND); PMA_setCookie('pma_mcrypt_iv', base64_encode($iv)); } -- 2.11.4.GIT