bug #1226819, Accepting Negative values in Resource Limits in Privileges

This commit is contained in:
Marc Delisle
2005-10-09 11:32:27 +00:00
parent ec41dbecaa
commit c7dc601156
2 changed files with 23 additions and 12 deletions

View File

@@ -8,6 +8,8 @@ $Source$
2005-10-09 Marc Delisle <lem9@users.sourceforge.net> 2005-10-09 Marc Delisle <lem9@users.sourceforge.net>
* tbl_properties_links.php: invalid js confirmation and operation feedback * tbl_properties_links.php: invalid js confirmation and operation feedback
when dropping a view when dropping a view
* server_privileges.php: bug #1226819, Accepting Negative values in
Resource Limits in Privileges
2005-10-09 Michal Čihař <michal@cihar.com> 2005-10-09 Michal Čihař <michal@cihar.com>
* libraries/display_export.lib.php, libraries/export/sql.php, lang/*, * libraries/display_export.lib.php, libraries/export/sql.php, lang/*,

View File

@@ -689,22 +689,27 @@ if (!empty($adduser_submit) || !empty($change_copy)) {
} }
if (PMA_MYSQL_INT_VERSION >= 40002) { if (PMA_MYSQL_INT_VERSION >= 40002) {
if (isset($max_questions)) { if (isset($max_questions)) {
$real_sql_query .= ' MAX_QUERIES_PER_HOUR ' . (int)$max_questions; // avoid negative values
$sql_query .= ' MAX_QUERIES_PER_HOUR ' . (int)$max_questions; $max_questions = max(0, (int)$max_questions);
$real_sql_query .= ' MAX_QUERIES_PER_HOUR ' . $max_questions;
$sql_query .= ' MAX_QUERIES_PER_HOUR ' . $max_questions;
} }
if (isset($max_connections)) { if (isset($max_connections)) {
$real_sql_query .= ' MAX_CONNECTIONS_PER_HOUR ' . (int)$max_connections; $max_connections = max(0, (int)$max_connections);
$sql_query .= ' MAX_CONNECTIONS_PER_HOUR ' . (int)$max_connections; $real_sql_query .= ' MAX_CONNECTIONS_PER_HOUR ' . $max_connections;
$sql_query .= ' MAX_CONNECTIONS_PER_HOUR ' . $max_connections;
} }
if (isset($max_updates)) { if (isset($max_updates)) {
$real_sql_query .= ' MAX_UPDATES_PER_HOUR ' . (int)$max_updates; $max_updates = max(0, (int)$max_updates);
$sql_query .= ' MAX_UPDATES_PER_HOUR ' . (int)$max_updates; $real_sql_query .= ' MAX_UPDATES_PER_HOUR ' . $max_updates;
$sql_query .= ' MAX_UPDATES_PER_HOUR ' . $max_updates;
} }
} }
if (PMA_MYSQL_INT_VERSION >= 50003) { if (PMA_MYSQL_INT_VERSION >= 50003) {
if (isset($max_user_connections)) { if (isset($max_user_connections)) {
$real_sql_query .= ' MAX_USER_CONNECTIONS ' . (int)$max_user_connections; $max_user_connections = max(0, (int)$max_user_connections);
$sql_query .= ' MAX_USER_CONNECTIONS ' . (int)$max_user_connections; $real_sql_query .= ' MAX_USER_CONNECTIONS ' . $max_user_connections;
$sql_query .= ' MAX_USER_CONNECTIONS ' . $max_user_connections;
} }
} }
} }
@@ -825,18 +830,22 @@ if (!empty($update_privs)) {
} }
if (PMA_MYSQL_INT_VERSION >= 40002) { if (PMA_MYSQL_INT_VERSION >= 40002) {
if (isset($max_questions)) { if (isset($max_questions)) {
$sql_query2 .= ' MAX_QUERIES_PER_HOUR ' . (int)$max_questions; $max_questions = max(0, (int)$max_questions);
$sql_query2 .= ' MAX_QUERIES_PER_HOUR ' . $max_questions;
} }
if (isset($max_connections)) { if (isset($max_connections)) {
$sql_query2 .= ' MAX_CONNECTIONS_PER_HOUR ' . (int)$max_connections; $max_connections = max(0, (int)$max_connections);
$sql_query2 .= ' MAX_CONNECTIONS_PER_HOUR ' . $max_connections;
} }
if (isset($max_updates)) { if (isset($max_updates)) {
$sql_query2 .= ' MAX_UPDATES_PER_HOUR ' . (int)$max_updates; $max_updates = max(0, (int)$max_updates);
$sql_query2 .= ' MAX_UPDATES_PER_HOUR ' . $max_updates;
} }
} }
if (PMA_MYSQL_INT_VERSION >= 50003) { if (PMA_MYSQL_INT_VERSION >= 50003) {
if (isset($max_user_connections)) { if (isset($max_user_connections)) {
$sql_query2 .= ' MAX_USER_CONNECTIONS ' . (int)$max_user_connections; $max_user_connections = max(0, (int)$max_user_connections);
$sql_query2 .= ' MAX_USER_CONNECTIONS ' . $max_user_connections;
} }
} }
} }