summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r--sql/item_strfunc.cc30
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()
{