diff --git a/ChangeLog b/ChangeLog index c13c76cc68..4bb045720a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24,6 +24,9 @@ phpMyAdmin - ChangeLog - issue Incorrect script name in include - issue #11685 Warning: Invalid argument supplied for foreach() - issue #11687 Delimiter missing while exporting multiple db routines +- issue #11684 mysql_native_password with MariaDB bug +- issue #11693 Flush privileges overusage - related to #11597 +- issue #11691 Query was empty on creating User in 4.5.2 4.5.2.0 (2015-11-23) - issue #11589 Incorrect parameter in mysqli_fetch_fields() diff --git a/libraries/check_user_privileges.lib.php b/libraries/check_user_privileges.lib.php index b6db98f300..8288139a57 100644 --- a/libraries/check_user_privileges.lib.php +++ b/libraries/check_user_privileges.lib.php @@ -22,13 +22,20 @@ $GLOBALS['is_superuser'] = $GLOBALS['dbi']->isSuperuser(); */ function PMA_checkRequiredPrivilegesForFlushing() { + if (PMA_Util::cacheExists('flush_priv')) { + $GLOBALS['flush_priv'] = PMA_Util::cacheGet( + 'flush_priv' + ); + return; + } - $res = $GLOBALS['dbi']->tryQuery( - 'FLUSH PRIVILEGES' + $GLOBALS['flush_priv'] = $GLOBALS['dbi']->tryQuery( + 'FLUSH PRIVILEGES' ); - // Save the value - $GLOBALS['flush_priv'] = $res; + // must also cacheUnset() them in + // libraries/plugins/auth/AuthenticationCookie.class.php + PMA_Util::cacheSet('flush_priv', $GLOBALS['flush_priv']); } /** diff --git a/libraries/plugins/auth/AuthenticationCookie.php b/libraries/plugins/auth/AuthenticationCookie.php index 23d2a29416..29fa0a5754 100644 --- a/libraries/plugins/auth/AuthenticationCookie.php +++ b/libraries/plugins/auth/AuthenticationCookie.php @@ -448,6 +448,7 @@ class AuthenticationCookie extends AuthenticationPlugin Util::cacheUnset('col_priv'); Util::cacheUnset('table_priv'); Util::cacheUnset('proc_priv'); + Util::cacheUnset('flush_priv'); $GLOBALS['no_activity'] = true; $this->authFails(); diff --git a/libraries/server_privileges.lib.php b/libraries/server_privileges.lib.php index d8758ff86f..badc2877aa 100644 --- a/libraries/server_privileges.lib.php +++ b/libraries/server_privileges.lib.php @@ -5192,39 +5192,15 @@ function PMA_getSqlQueriesForDisplayAndAddUser($username, $hostname, $password) $_REQUEST['authentication_plugin'] ); } - - // Use 'SET PASSWORD' for pre-5.7.6 MySQL versions - // and pre-5.2.0 MariaDB + // Use 'CREATE USER ... WITH ... AS ..' syntax for + // newer MySQL versions + // and 'CREATE USER ... USING .. VIA ..' syntax for + // newer MariaDB versions if (($serverType == 'MySQL' - && PMA_MYSQL_INT_VERSION < 50706) + && PMA_MYSQL_INT_VERSION >= 50706) || ($serverType == 'MariaDB' - && PMA_MYSQL_INT_VERSION < 50200) + && PMA_MYSQL_INT_VERSION >= 50200) ) { - - if ($_POST['pred_password'] == 'keep') { - $password_set_real = sprintf( - $password_set_stmt, - $slashedUsername, - $slashedHostname, - $slashedPassword - ); - } else if ($_POST['pred_password'] == 'none') { - $password_set_real = sprintf( - $password_set_stmt, - $slashedUsername, - $slashedHostname, - null - ); - } else { - $hashedPassword = PMA_getHashedPassword($_POST['pma_pw']); - $password_set_real = sprintf( - $password_set_stmt, - $slashedUsername, - $slashedHostname, - $hashedPassword - ); - } - } else { $password_set_real = null; // Required for binding '%' with '%s' @@ -5270,6 +5246,32 @@ function PMA_getSqlQueriesForDisplayAndAddUser($username, $hostname, $password) '***' ); } + } else { + // Use 'SET PASSWORD' syntax for pre-5.7.6 MySQL versions + // and pre-5.2.0 MariaDB versions + if ($_POST['pred_password'] == 'keep') { + $password_set_real = sprintf( + $password_set_stmt, + $slashedUsername, + $slashedHostname, + $slashedPassword + ); + } else if ($_POST['pred_password'] == 'none') { + $password_set_real = sprintf( + $password_set_stmt, + $slashedUsername, + $slashedHostname, + null + ); + } else { + $hashedPassword = PMA_getHashedPassword($_POST['pma_pw']); + $password_set_real = sprintf( + $password_set_stmt, + $slashedUsername, + $slashedHostname, + $hashedPassword + ); + } } // add REQUIRE clause