Details
Description
connect con1,localhost,foo,,db1; |
show grants;
|
Grants for foo@localhost |
GRANT USAGE ON *.* TO `foo`@`localhost` |
GRANT CREATE ON `db1`.* TO `foo`@`localhost` |
GRANT CREATE ON `db2`.* TO `foo`@`localhost` |
create table t(t int); |
show columns in t; |
ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't' |
- Database should be shown too:
ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'db1.t'
Attachments
Issue Links
- relates to
-
MDEV-28455 CREATE TEMPORARY TABLES privilege is insufficient for SHOW COLUMNS
-
- Closed
-
- links to
Hi Anel!
Looks like you forgot the null pointer check like I told you here:
https://mariadb.zulipchat.com/#narrow/stream/252587-AskMonty/topic/MDEV-28548/near/282130265
Here is my suggestion:
@@ -7
763,9 +7763,13 @@ bool check_grant(THD *thd, ulong want_access, TABLE_LIST *tables,
status_var_increment(thd->status_var.access_denied_errors);
String str;
- str.append(tl->get_db_name());
- str.append('.');
- str.append(tl->get_table_name());
+ if (tl)
+ {
+ str.append(tl->get_db_name());
+ str.append('.');
+ str.append(tl->get_table_name());
+ }
Also, as a stylistic / readability change, can you please rename all occurrences of your String str to be: String db_and_table.
Ok to push after this.