summaryrefslogtreecommitdiff
path: root/sql/sql_parse.cc
diff options
context:
space:
mode:
authorunknown <thek@adventure.(none)>2007-11-26 19:09:40 +0100
committerunknown <thek@adventure.(none)>2007-11-26 19:09:40 +0100
commit5fad76719c24aaccb2d45cfa0b52660fdebb0bc8 (patch)
treefc000ba6241f99748de9f672d6a2a736a5e7ee65 /sql/sql_parse.cc
parent0deedab4004e31bd2965e8d6707012f36244a691 (diff)
downloadmariadb-git-5fad76719c24aaccb2d45cfa0b52660fdebb0bc8.tar.gz
Bug#16470 crash on grant if old grant tables
Loading 4.1 into 5.0 or 5.1 failed silently because procs_priv table missing. This caused the server to crash on any attempt to store new grants because of uninitialized structures. This patch breaks up the grant loading function into two phases to allow for procs_priv table to fail with an warning instead of crashing the server. mysql-test/r/grant.result: Test case mysql-test/t/grant.test: Test case making sure that FLUSH PRIVILEGES doesn't crash the server if procs_priv is removed. sql/sql_acl.cc: - Refactored grant_reload into two phases: 1. open and lock tables_priv and columns_priv tables, read the data, close tables. 2. open and lock procs_priv, read data, close table. Since the tables are independant of each other there will be no race conditions and it will be possible to handle situations where the procs_priv table isn't present. - Refactored the helper function grant_load into new grant_load (without procs_priv table) and grant_load_procs_priv. sql/sql_parse.cc: - Changed comment style to doxygen style.
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r--sql/sql_parse.cc35
1 files changed, 17 insertions, 18 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 695e923e816..4e4b30adb3b 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -6293,24 +6293,23 @@ void add_join_natural(TABLE_LIST *a, TABLE_LIST *b, List<String> *using_fields,
}
-/*
- Reload/resets privileges and the different caches.
-
- SYNOPSIS
- reload_acl_and_cache()
- thd Thread handler (can be NULL!)
- options What should be reset/reloaded (tables, privileges,
- slave...)
- tables Tables to flush (if any)
- write_to_binlog Depending on 'options', it may be very bad to write the
- query to the binlog (e.g. FLUSH SLAVE); this is a
- pointer where reload_acl_and_cache() will put 0 if
- it thinks we really should not write to the binlog.
- Otherwise it will put 1.
-
- RETURN
- 0 ok
- !=0 error. thd->killed or thd->net.report_error is set
+/**
+ @brief Reload/resets privileges and the different caches.
+
+ @param thd Thread handler (can be NULL!)
+ @param options What should be reset/reloaded (tables, privileges, slave...)
+ @param tables Tables to flush (if any)
+ @param write_to_binlog True if we can write to the binlog.
+
+ @note Depending on 'options', it may be very bad to write the
+ query to the binlog (e.g. FLUSH SLAVE); this is a
+ pointer where reload_acl_and_cache() will put 0 if
+ it thinks we really should not write to the binlog.
+ Otherwise it will put 1.
+
+ @return Error status code
+ @retval 0 Ok
+ @retval !=0 Error; thd->killed or thd->net.report_error is set
*/
bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,