diff options
author | Alexander Barkov <bar@mariadb.com> | 2020-03-17 11:08:00 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2020-03-17 11:09:19 +0400 |
commit | b602584183476b57bac99bb0d8b664dd0aea8662 (patch) | |
tree | 0ad61eeff211b26c026f43645c8259f3fbef32eb /sql/set_var.cc | |
parent | c7ba92372b8e21c42eb5df20f080c941fc84a144 (diff) | |
download | mariadb-git-b602584183476b57bac99bb0d8b664dd0aea8662.tar.gz |
MDEV-21957 Bind BINLOG ADMIN to @@binlog_format, @@binlog_direct_.., @@sql_log_bin
Diffstat (limited to 'sql/set_var.cc')
-rw-r--r-- | sql/set_var.cc | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/sql/set_var.cc b/sql/set_var.cc index b2cc41b2d15..0ace4658be7 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -756,6 +756,11 @@ err: Functions to handle SET mysql_internal_variable=const_expr *****************************************************************************/ +bool sys_var::on_check_access_global(THD *thd) const +{ + return check_global_access(thd, PRIV_SET_GLOBAL_SYSTEM_VARIABLE); +} + /** Verify that the supplied value is correct. @@ -780,8 +785,7 @@ int set_var::check(THD *thd) my_error(err, MYF(0), var->name.str); return -1; } - if (type == OPT_GLOBAL && - check_global_access(thd, PRIV_SET_GLOBAL_SYSTEM_VARIABLE)) + if (type == OPT_GLOBAL && var->on_check_access_global(thd)) return 1; /* value is a NULL pointer if we are using SET ... = DEFAULT */ if (!value) @@ -794,6 +798,16 @@ int set_var::check(THD *thd) my_error(ER_WRONG_TYPE_FOR_VAR, MYF(0), var->name.str); return -1; } + switch (type) { + case SHOW_OPT_DEFAULT: + case SHOW_OPT_SESSION: + DBUG_ASSERT(var->scope() != sys_var::GLOBAL); + if (var->on_check_access_session(thd)) + return -1; + break; + case SHOW_OPT_GLOBAL: // Checked earlier + break; + } return var->check(thd, this) ? -1 : 0; } |