Merge branch 'master' of github.com:phpmyadmin/phpmyadmin

This commit is contained in:
Madhura Jayaratne 2015-11-26 19:56:01 +11:00
commit fd9194e7ac
4 changed files with 47 additions and 34 deletions

View File

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

View File

@ -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']);
}
/**

View File

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

View File

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