diff options
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r-- | sql/sql_parse.cc | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index b2636cfff95..a665f0314e8 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1,5 +1,5 @@ -/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. - Copyright (c) 2008, 2014, SkySQL Ab. +/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. + Copyright (c) 2008, 2015, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -5825,9 +5825,12 @@ check_table_access(THD *thd, ulong requirements,TABLE_LIST *tables, for (; i < number && tables != first_not_own_table && tables; tables= tables->next_global, i++) { + TABLE_LIST *const table_ref= tables->correspondent_table ? + tables->correspondent_table : tables; + ulong want_access= requirements; - if (tables->security_ctx) - sctx= tables->security_ctx; + if (table_ref->security_ctx) + sctx= table_ref->security_ctx; else sctx= backup_ctx; @@ -5835,26 +5838,26 @@ check_table_access(THD *thd, ulong requirements,TABLE_LIST *tables, Register access for view underlying table. Remove SHOW_VIEW_ACL, because it will be checked during making view */ - tables->grant.orig_want_privilege= (want_access & ~SHOW_VIEW_ACL); + table_ref->grant.orig_want_privilege= (want_access & ~SHOW_VIEW_ACL); - if (tables->schema_table_reformed) + if (table_ref->schema_table_reformed) { - if (check_show_access(thd, tables)) + if (check_show_access(thd, table_ref)) goto deny; continue; } - DBUG_PRINT("info", ("derived: %d view: %d", tables->derived != 0, - tables->view != 0)); + DBUG_PRINT("info", ("derived: %d view: %d", table_ref->derived != 0, + table_ref->view != 0)); - if (tables->is_anonymous_derived_table()) + if (table_ref->is_anonymous_derived_table()) continue; thd->security_ctx= sctx; - if (check_access(thd, want_access, tables->get_db_name(), - &tables->grant.privilege, - &tables->grant.m_internal, + if (check_access(thd, want_access, table_ref->get_db_name(), + &table_ref->grant.privilege, + &table_ref->grant.m_internal, 0, no_errors)) goto deny; } |