diff options
author | Sergei Golubchik <sergii@pisem.net> | 2013-10-29 15:08:44 +0100 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2013-10-29 15:08:44 +0100 |
commit | 0fdb3bcfdbfa5d7cad28adc1c0f7c0958cdab2e0 (patch) | |
tree | 7d6a1d36b975e2b1bb8d9ffd3b7511ec0694349e /sql/set_var.cc | |
parent | 7dc48ae327ad27205dffe0cec16b445d01529f84 (diff) | |
parent | fef416699009b78366d9eec937c01822b531f518 (diff) | |
download | mariadb-git-0fdb3bcfdbfa5d7cad28adc1c0f7c0958cdab2e0.tar.gz |
10.0-base merge (roles)
Diffstat (limited to 'sql/set_var.cc')
-rw-r--r-- | sql/set_var.cc | 46 |
1 files changed, 26 insertions, 20 deletions
diff --git a/sql/set_var.cc b/sql/set_var.cc index db74d8f0d9d..8ae29e01a20 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -829,26 +829,7 @@ int set_var_user::update(THD *thd) int set_var_password::check(THD *thd) { #ifndef NO_EMBEDDED_ACCESS_CHECKS - if (!user->host.str) - { - DBUG_ASSERT(thd->security_ctx->priv_host); - if (*thd->security_ctx->priv_host != 0) - { - user->host.str= (char *) thd->security_ctx->priv_host; - user->host.length= strlen(thd->security_ctx->priv_host); - } - else - { - user->host.str= (char *)"%"; - user->host.length= 1; - } - } - if (!user->user.str) - { - DBUG_ASSERT(thd->security_ctx->user); - user->user.str= (char *) thd->security_ctx->user; - user->user.length= strlen(thd->security_ctx->user); - } + user= get_current_user(thd, user); /* Returns 1 as the function sends error to client */ return check_change_password(thd, user->host.str, user->user.str, password, strlen(password)) ? 1 : 0; @@ -869,6 +850,31 @@ int set_var_password::update(THD *thd) } /***************************************************************************** + Functions to handle SET ROLE +*****************************************************************************/ +int set_var_role::check(THD *thd) +{ +#ifndef NO_EMBEDDED_ACCESS_CHECKS + ulonglong access; + int status= acl_check_setrole(thd, base.str, &access); + save_result.ulonglong_value= access; + return status; +#else + return 0; +#endif +} + +int set_var_role::update(THD *thd) +{ +#ifndef NO_EMBEDDED_ACCESS_CHECKS + return acl_setrole(thd, base.str, save_result.ulonglong_value); +#else + return 0; +#endif +} + + +/***************************************************************************** Functions to handle SET NAMES and SET CHARACTER SET *****************************************************************************/ |