summaryrefslogtreecommitdiff
path: root/sql/sql_parse.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r--sql/sql_parse.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 349bd6aa21b..bc32ff4bc83 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -4608,7 +4608,17 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
Security_context *sctx= thd->security_ctx;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
ulong db_access;
- bool db_is_pattern= test(want_access & GRANT_ACL);
+ /*
+ GRANT command:
+ In case of database level grant the database name may be a pattern,
+ in case of table|column level grant the database name can not be a pattern.
+ We use 'dont_check_global_grants' as a flag to determine
+ if it's database level grant command
+ (see SQLCOM_GRANT case, mysql_execute_command() function) and
+ set db_is_pattern according to 'dont_check_global_grants' value.
+ */
+ bool db_is_pattern= (test(want_access & GRANT_ACL) &&
+ dont_check_global_grants);
#endif
ulong dummy;
DBUG_ENTER("check_access");