From 7e60f71001595df62b92a089869dd67fcc15a1ee Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Thu, 2 Oct 2008 14:37:07 +0500 Subject: Bug#22763 Disrepancy between SHOW CREATE VIEW and I_S.VIEWS The problem: I_S views table does not check the presence of SHOW_VIEW_ACL|SELECT_ACL privileges for a view. It leads to discrepancy between SHOW CREATE VIEW and I_S.VIEWS. The fix: added appropriate check. mysql-test/r/information_schema_db.result: test result mysql-test/t/information_schema_db.test: test case sql/sql_show.cc: The problem: I_S views table does not check the presence of SHOW_VIEW_ACL|SELECT_ACL privileges for a view. It leads to discrepancy between SHOW CREATE VIEW and I_S.VIEWS. The fix: added appropriate check. --- sql/sql_show.cc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'sql/sql_show.cc') diff --git a/sql/sql_show.cc b/sql/sql_show.cc index c30e0a00d95..8203622cf6e 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -3170,6 +3170,27 @@ static int get_schema_views_record(THD *thd, TABLE_LIST *tables, !my_strcasecmp(system_charset_info, tables->definer.host.str, sctx->priv_host)) tables->allowed_show= TRUE; +#ifndef NO_EMBEDDED_ACCESS_CHECKS + else + { + if ((thd->col_access & (SHOW_VIEW_ACL|SELECT_ACL)) == + (SHOW_VIEW_ACL|SELECT_ACL)) + tables->allowed_show= TRUE; + else + { + TABLE_LIST table_list; + uint view_access; + memset(&table_list, 0, sizeof(table_list)); + table_list.db= tables->view_db.str; + table_list.table_name= tables->view_name.str; + table_list.grant.privilege= thd->col_access; + view_access= get_table_grant(thd, &table_list); + if ((view_access & (SHOW_VIEW_ACL|SELECT_ACL)) == + (SHOW_VIEW_ACL|SELECT_ACL)) + tables->allowed_show= TRUE; + } + } +#endif } restore_record(table, s->default_values); table->field[1]->store(tables->view_db.str, tables->view_db.length, cs); -- cgit v1.2.1