bug #2136986 [auth] Cannot create database after session timeout

This commit is contained in:
Marc Delisle
2008-10-04 14:43:36 +00:00
parent ea463a1bf3
commit 65e48911de
4 changed files with 29 additions and 3 deletions

View File

@@ -35,6 +35,7 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA
+ [lang] Russian update, thanks to Victor Volkov + [lang] Russian update, thanks to Victor Volkov
- patch #2143882 [import] Temporary uploaded file not deleted, - patch #2143882 [import] Temporary uploaded file not deleted,
thanks to David Misc - dmisc thanks to David Misc - dmisc
- bug #2136986 [auth] Cannot create database after session timeout
3.0.0.0 (2008-09-27) 3.0.0.0 (2008-09-27)
+ [export] properly handle line breaks for YAML, thanks to Dan Barry - + [export] properly handle line breaks for YAML, thanks to Dan Barry -

View File

@@ -407,6 +407,10 @@ function PMA_auth_check()
if (! empty($_REQUEST['old_usr'])) { if (! empty($_REQUEST['old_usr'])) {
// The user wants to be logged out // The user wants to be logged out
// -> delete his choices that were stored in session // -> delete his choices that were stored in session
// according to the PHP manual we should do this before the destroy:
$_SESSION = array();
session_destroy(); session_destroy();
// -> delete password cookie(s) // -> delete password cookie(s)
if ($GLOBALS['cfg']['LoginCookieDeleteAll']) { if ($GLOBALS['cfg']['LoginCookieDeleteAll']) {
@@ -459,6 +463,11 @@ function PMA_auth_check()
// User inactive too long // User inactive too long
if ($_SESSION['last_access_time'] < time() - $GLOBALS['cfg']['LoginCookieValidity']) { if ($_SESSION['last_access_time'] < time() - $GLOBALS['cfg']['LoginCookieValidity']) {
PMA_cacheUnset('is_create_db_priv', true);
PMA_cacheUnset('is_process_priv', true);
PMA_cacheUnset('is_reload_priv', true);
PMA_cacheUnset('db_to_create', true);
PMA_cacheUnset('dbs_where_create_table_allowed', true);
$GLOBALS['no_activity'] = true; $GLOBALS['no_activity'] = true;
PMA_auth_fails(); PMA_auth_fails();
exit; exit;

View File

@@ -147,6 +147,7 @@ function PMA_analyseShowGrant()
PMA_DBI_free_result($rs_usr); PMA_DBI_free_result($rs_usr);
// must also PMA_cacheUnset() them in libraries/auth/cookie.auth.lib.php
PMA_cacheSet('is_create_db_priv', $GLOBALS['is_create_db_priv'], true); PMA_cacheSet('is_create_db_priv', $GLOBALS['is_create_db_priv'], true);
PMA_cacheSet('is_process_priv', $GLOBALS['is_process_priv'], true); PMA_cacheSet('is_process_priv', $GLOBALS['is_process_priv'], true);
PMA_cacheSet('is_reload_priv', $GLOBALS['is_reload_priv'], true); PMA_cacheSet('is_reload_priv', $GLOBALS['is_reload_priv'], true);

View File

@@ -2443,7 +2443,7 @@ window.addEvent('domready', function(){
} }
/** /**
* Cache information in the session * Verifies if something is cached in the session
* *
* @param unknown_type $var * @param unknown_type $var
* @param unknown_type $val * @param unknown_type $val
@@ -2459,7 +2459,7 @@ function PMA_cacheExists($var, $server = 0)
} }
/** /**
* Cache information in the session * Gets cached information from the session
* *
* @param unknown_type $var * @param unknown_type $var
* @param unknown_type $val * @param unknown_type $val
@@ -2479,7 +2479,7 @@ function PMA_cacheGet($var, $server = 0)
} }
/** /**
* Cache information in the session * Caches information in the session
* *
* @param unknown_type $var * @param unknown_type $var
* @param unknown_type $val * @param unknown_type $val
@@ -2494,6 +2494,21 @@ function PMA_cacheSet($var, $val = null, $server = 0)
$_SESSION['cache']['server_' . $server][$var] = $val; $_SESSION['cache']['server_' . $server][$var] = $val;
} }
/**
* Removes cached information from the session
*
* @param unknown_type $var
* @param unknown_type $server
* @return mixed
*/
function PMA_cacheUnset($var, $server = 0)
{
if (true === $server) {
$server = $GLOBALS['server'];
}
unset($_SESSION['cache']['server_' . $server][$var]);
}
/** /**
* Converts a bit value to printable format; * Converts a bit value to printable format;
* in MySQL a BIT field can be from 1 to 64 bits so we need this * in MySQL a BIT field can be from 1 to 64 bits so we need this