summaryrefslogtreecommitdiff
path: root/sql/sql_show.cc
diff options
context:
space:
mode:
authorSergey Glukhov <Sergey.Glukhov@sun.com>2008-10-02 14:37:07 +0500
committerSergey Glukhov <Sergey.Glukhov@sun.com>2008-10-02 14:37:07 +0500
commit7e60f71001595df62b92a089869dd67fcc15a1ee (patch)
tree39c335a3a7f82e8e9ac0c83930037892a38351c8 /sql/sql_show.cc
parenteb3c08069db60d61f41dacb10fd6b73635fec236 (diff)
downloadmariadb-git-7e60f71001595df62b92a089869dd67fcc15a1ee.tar.gz
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.
Diffstat (limited to 'sql/sql_show.cc')
-rw-r--r--sql/sql_show.cc21
1 files changed, 21 insertions, 0 deletions
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);