From 5b497b163aff1ba23af4f97528be832af55c3c21 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 10 Feb 2006 15:02:57 +0100 Subject: fix for bug #17289 Events: missing privilege check for drop database Events were executed with all privileges possible on planet Earth :( WL#1034 mysql-test/r/events.result: update test results mysql-test/t/events.test: test for bug#17289 Events: missing privilege check for drop database sql/event.h: -add two new methods to event_timed to change and restore the security context sql/event_executor.cc: - move code regarding privilieges checking to event_timed::execute() - add a new function evex_print_warnings() which prints the notes/warnings/errors to the console (easily capturable with logs-into-tables) so one can see what has happened if there was an error of some sort! sql/event_timed.cc: - fix documentation - add a new error code -99, EVENT was revoked from the user on the DB - set_sec_ctx, execute, restore_sex_ctx sql/sql_error.cc: - make warning_level_names public to be used in event_executor.cc - change from 2 arrays to a LEX_STRING array --- sql/sql_error.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'sql/sql_error.cc') diff --git a/sql/sql_error.cc b/sql/sql_error.cc index 191a6e0a1fd..74df3b68a0d 100644 --- a/sql/sql_error.cc +++ b/sql/sql_error.cc @@ -211,8 +211,13 @@ void push_warning_printf(THD *thd, MYSQL_ERROR::enum_warning_level level, TRUE Error sending data to client */ -static const char *warning_level_names[]= {"Note", "Warning", "Error", "?"}; -static int warning_level_length[]= { 4, 7, 5, 1 }; +LEX_STRING warning_level_names[]= +{ + {(char*) STRING_WITH_LEN("Note")}, + {(char*) STRING_WITH_LEN("Warning")}, + {(char*) STRING_WITH_LEN("Error")}, + {(char*) STRING_WITH_LEN("?")} +}; bool mysqld_show_warnings(THD *thd, ulong levels_to_show) { @@ -246,8 +251,8 @@ bool mysqld_show_warnings(THD *thd, ulong levels_to_show) if (idx > unit->select_limit_cnt) break; protocol->prepare_for_resend(); - protocol->store(warning_level_names[err->level], - warning_level_length[err->level], system_charset_info); + protocol->store(warning_level_names[err->level].str, + warning_level_names[err->level].length, system_charset_info); protocol->store((uint32) err->code); protocol->store(err->msg, strlen(err->msg), system_charset_info); if (protocol->write()) -- cgit v1.2.1