summaryrefslogtreecommitdiff
path: root/sql/sql_show.cc
diff options
context:
space:
mode:
authoranozdrin/alik@ibm.opbmk <>2007-04-03 15:11:34 +0400
committeranozdrin/alik@ibm.opbmk <>2007-04-03 15:11:34 +0400
commit5441aefd1d7b5cbeb1d0874d578482c7a2b054d0 (patch)
tree5e6ada28ac015b561bf1cfe3f7b9c598ded8312c /sql/sql_show.cc
parent44c32c0e263e14910c88a885b91edb999d240e25 (diff)
downloadmariadb-git-5441aefd1d7b5cbeb1d0874d578482c7a2b054d0.tar.gz
Fix for BUG#27337: Privileges are not properly restored.
The problem was that THD::db_access variable was not restored after database switch in stored-routine-execution code. The fix is to restore THD::db_access in this case. Unfortunately, this fix requires additional changes, because in prepare_schema_table(), called on the parsing stage, we checked privileges. That was wrong according to our design, but this flaw haven't struck so far, because it was masked. All privilege checkings must be done on the execution stage in order to be compatible with prepared statements and stored routines. So, this patch also contains patch for prepare_schema_table(), which moves the checkings to the execution phase.
Diffstat (limited to 'sql/sql_show.cc')
-rw-r--r--sql/sql_show.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index cf0cb9ba8d2..fa78db50532 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -2148,7 +2148,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
*/
thd->reset_n_backup_open_tables_state(&open_tables_state_backup);
- if (lsel)
+ if (lsel && lsel->table_list.first)
{
TABLE_LIST *show_table_list= (TABLE_LIST*) lsel->table_list.first;
bool res;