Implemented some version checks to avoid bugs like #777785.

This commit is contained in:
Alexander M. Turek
2003-07-30 10:06:36 +00:00
parent b71d7b7744
commit c78623b4b6
2 changed files with 31 additions and 23 deletions

View File

@@ -5,8 +5,12 @@ phpMyAdmin - Changelog
$Id$ $Id$
$Source$ $Source$
2003-07-30 Alexander M. Turek <rabus@users.sourceforge.net>
* server_privileges.php3: Implemented some version checks to avoid bugs like
#777785.
2003-07-29 Marc Delisle <lem9@users.sourceforge.net> 2003-07-29 Marc Delisle <lem9@users.sourceforge.net>
* serbian: big update, * serbian: big update,
thanks to Branislav Jovanovi<76> <branej@users.sourceforge.net> and thanks to Branislav Jovanovi<76> <branej@users.sourceforge.net> and
Mihailo Stefanovi<76> <mst@mikis.org> Mihailo Stefanovi<76> <mst@mikis.org>
* sql.php3: bug 779301: MySQL 3 and SELECT DISTINCT * sql.php3: bug 779301: MySQL 3 and SELECT DISTINCT
@@ -28,7 +32,7 @@ $Source$
* libraries/common.lib.php3, libaries/mysql_wrappers.lib.php3: * libraries/common.lib.php3, libaries/mysql_wrappers.lib.php3:
Display MySQL error code and link to the MySQL-Documentation of Display MySQL error code and link to the MySQL-Documentation of
error codes error codes
2003-07-28 Alexander M. Turek <rabus@users.sourceforge.net> 2003-07-28 Alexander M. Turek <rabus@users.sourceforge.net>
* tbl_properties_structure.php3, css/phpmyadmin.css.php3: Use icons for * tbl_properties_structure.php3, css/phpmyadmin.css.php3: Use icons for
multi-submit buttons. multi-submit buttons.

View File

@@ -619,24 +619,26 @@ if (!empty($adduser_submit) || !empty($change_copy)) {
} }
$sql_query = $real_sql_query; $sql_query = $real_sql_query;
} }
if ((isset($Grant_priv) && $Grant_priv == 'Y') || isset($max_questions) || isset($max_connections) || isset($max_updates)) { if ((isset($Grant_priv) && $Grant_priv == 'Y') || (PMA_MYSQL_INT_VERSION >= 40002 && (isset($max_questions) || isset($max_connections) || isset($max_updates)))) {
$real_sql_query .= 'WITH'; $real_sql_query .= 'WITH';
$sql_query .= 'WITH'; $sql_query .= 'WITH';
if (isset($Grant_priv) && $Grant_priv == 'Y') { if (isset($Grant_priv) && $Grant_priv == 'Y') {
$real_sql_query .= ' GRANT OPTION'; $real_sql_query .= ' GRANT OPTION';
$sql_query .= ' GRANT OPTION'; $sql_query .= ' GRANT OPTION';
} }
if (isset($max_questions)) { if (PMA_MYSQL_INT_VERSION >= 40002) {
$real_sql_query .= ' MAX_QUERIES_PER_HOUR ' . (int)$max_questions; if (isset($max_questions)) {
$sql_query .= ' MAX_QUERIES_PER_HOUR ' . (int)$max_questions; $real_sql_query .= ' MAX_QUERIES_PER_HOUR ' . (int)$max_questions;
} $sql_query .= ' MAX_QUERIES_PER_HOUR ' . (int)$max_questions;
if (isset($max_connections)) { }
$real_sql_query .= ' MAX_CONNECTIONS_PER_HOUR ' . (int)$max_connections; if (isset($max_connections)) {
$sql_query .= ' MAX_CONNECTIONS_PER_HOUR ' . (int)$max_connections; $real_sql_query .= ' MAX_CONNECTIONS_PER_HOUR ' . (int)$max_connections;
} $sql_query .= ' MAX_CONNECTIONS_PER_HOUR ' . (int)$max_connections;
if (isset($max_updates)) { }
$real_sql_query .= ' MAX_UPDATES_PER_HOUR ' . (int)$max_updates; if (isset($max_updates)) {
$sql_query .= ' MAX_UPDATES_PER_HOUR ' . (int)$max_updates; $real_sql_query .= ' MAX_UPDATES_PER_HOUR ' . (int)$max_updates;
$sql_query .= ' MAX_UPDATES_PER_HOUR ' . (int)$max_updates;
}
} }
} }
$real_sql_query .= ';'; $real_sql_query .= ';';
@@ -742,19 +744,21 @@ if (!empty($update_privs)) {
$sql_query1 = 'REVOKE GRANT OPTION ON ' . $db_and_table . ' FROM "' . PMA_sqlAddslashes($username) . '"@"' . $hostname . '";'; $sql_query1 = 'REVOKE GRANT OPTION ON ' . $db_and_table . ' FROM "' . PMA_sqlAddslashes($username) . '"@"' . $hostname . '";';
} }
$sql_query2 = 'GRANT ' . join(', ', PMA_extractPrivInfo()) . ' ON ' . $db_and_table . ' TO "' . PMA_sqlAddslashes($username) . '"@"' . $hostname . '"'; $sql_query2 = 'GRANT ' . join(', ', PMA_extractPrivInfo()) . ' ON ' . $db_and_table . ' TO "' . PMA_sqlAddslashes($username) . '"@"' . $hostname . '"';
if ((isset($Grant_priv) && $Grant_priv == 'Y') || (empty($dbname) && (isset($max_questions) || isset($max_connections) || isset($max_updates)))) { if ((isset($Grant_priv) && $Grant_priv == 'Y') || (empty($dbname) && PMA_INT_VERSION >= 40002 && (isset($max_questions) || isset($max_connections) || isset($max_updates)))) {
$sql_query2 .= 'WITH'; $sql_query2 .= 'WITH';
if (isset($Grant_priv) && $Grant_priv == 'Y') { if (isset($Grant_priv) && $Grant_priv == 'Y') {
$sql_query2 .= ' GRANT OPTION'; $sql_query2 .= ' GRANT OPTION';
} }
if (isset($max_questions)) { if (PMA_INT_VERSION >= 40002) {
$sql_query2 .= ' MAX_QUERIES_PER_HOUR ' . (int)$max_questions; if (isset($max_questions)) {
} $sql_query2 .= ' MAX_QUERIES_PER_HOUR ' . (int)$max_questions;
if (isset($max_connections)) { }
$sql_query2 .= ' MAX_CONNECTIONS_PER_HOUR ' . (int)$max_connections; if (isset($max_connections)) {
} $sql_query2 .= ' MAX_CONNECTIONS_PER_HOUR ' . (int)$max_connections;
if (isset($max_updates)) { }
$sql_query2 .= ' MAX_UPDATES_PER_HOUR ' . (int)$max_updates; if (isset($max_updates)) {
$sql_query2 .= ' MAX_UPDATES_PER_HOUR ' . (int)$max_updates;
}
} }
} }
$sql_query2 .= ';'; $sql_query2 .= ';';