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/item_strfunc.cc | |
parent | 7dc48ae327ad27205dffe0cec16b445d01529f84 (diff) | |
parent | fef416699009b78366d9eec937c01822b531f518 (diff) | |
download | mariadb-git-0fdb3bcfdbfa5d7cad28adc1c0f7c0958cdab2e0.tar.gz |
10.0-base merge (roles)
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r-- | sql/item_strfunc.cc | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index ec1c795c100..4c83334ccd9 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -2515,16 +2515,32 @@ bool Item_func_current_user::fix_fields(THD *thd, Item **ref) if (Item_func_sysconst::fix_fields(thd, ref)) return TRUE; - Security_context *ctx= -#ifndef NO_EMBEDDED_ACCESS_CHECKS - (context->security_ctx - ? context->security_ctx : thd->security_ctx); -#else - thd->security_ctx; -#endif /*NO_EMBEDDED_ACCESS_CHECKS*/ + Security_context *ctx= context->security_ctx + ? context->security_ctx : thd->security_ctx; return init(ctx->priv_user, ctx->priv_host); } +bool Item_func_current_role::fix_fields(THD *thd, Item **ref) +{ + if (Item_func_sysconst::fix_fields(thd, ref)) + return 1; + + Security_context *ctx= context->security_ctx + ? context->security_ctx : thd->security_ctx; + + if (ctx->priv_role[0]) + { + if (str_value.copy(ctx->priv_role, strlen(ctx->priv_role), + system_charset_info)) + return 1; + + str_value.mark_as_const(); + return 0; + } + null_value= maybe_null= 1; + return 0; +} + void Item_func_soundex::fix_length_and_dec() { |