summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <thek@adventure.(none)>2008-02-01 14:10:46 +0100
committerunknown <thek@adventure.(none)>2008-02-01 14:10:46 +0100
commitf7d8fb1cdde7a9655b984827547a7f4f85560834 (patch)
treebe4662964632101146be7c8762f70e9afe54e8db /sql
parenta89ba0c68031aa3a962ef4244e027dd9481a65c1 (diff)
downloadmariadb-git-f7d8fb1cdde7a9655b984827547a7f4f85560834.tar.gz
Bug#33201 Crash occurs when granting update privilege on one column of a view
When issuing a column level grant on a table which require pre-locking the server crashed. The reason behind the crash was that data structures used by the lock api wasn't properly reinitialized in the case of a column level grant. mysql-test/r/grant.result: * Added test case mysql-test/t/grant.test: * Added test case sql/sql_acl.cc: * The lock api is dending on the thd->lex object and this variable needs to be re-initialized when opened with a new set of tables than specified in the original statement.
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_acl.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 134541368e9..703918329c2 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -2878,6 +2878,12 @@ bool mysql_table_grant(THD *thd, TABLE_LIST *table_list,
}
#endif
+ /*
+ The lock api is depending on the thd->lex variable which needs to be
+ re-initialized.
+ */
+ Query_tables_list backup;
+ thd->lex->reset_n_backup_query_tables_list(&backup);
if (simple_open_n_lock_tables(thd,tables))
{ // Should never happen
close_thread_tables(thd); /* purecov: deadcode */
@@ -3016,6 +3022,7 @@ bool mysql_table_grant(THD *thd, TABLE_LIST *table_list,
send_ok(thd);
/* Tables are automatically closed */
+ thd->lex->restore_backup_query_tables_list(&backup);
DBUG_RETURN(result);
}