Commit 10db7fcf authored by Alexey Botchkov's avatar Alexey Botchkov

MENT-977 log priv host / priv user.

Add server functions to provide necessary data.
parent 20a9f0b5
...@@ -4767,6 +4767,32 @@ extern "C" void thd_create_random_password(MYSQL_THD thd, ...@@ -4767,6 +4767,32 @@ extern "C" void thd_create_random_password(MYSQL_THD thd,
} }
extern "C" const char *thd_priv_host(MYSQL_THD thd, size_t *length)
{
const Security_context *sctx= thd->security_ctx;
if (!sctx)
{
*length= 0;
return NULL;
}
*length= strlen(sctx->priv_host);
return sctx->priv_host;
}
extern "C" const char *thd_priv_user(MYSQL_THD thd, size_t *length)
{
const Security_context *sctx= thd->security_ctx;
if (!sctx)
{
*length= 0;
return NULL;
}
*length= strlen(sctx->priv_user);
return sctx->priv_user;
}
#ifdef INNODB_COMPATIBILITY_HOOKS #ifdef INNODB_COMPATIBILITY_HOOKS
/** open a table and add it to thd->open_tables /** open a table and add it to thd->open_tables
......
...@@ -197,6 +197,8 @@ extern MYSQL_PLUGIN_IMPORT const char **errmesg; ...@@ -197,6 +197,8 @@ extern MYSQL_PLUGIN_IMPORT const char **errmesg;
extern "C" LEX_STRING * thd_query_string (MYSQL_THD thd); extern "C" LEX_STRING * thd_query_string (MYSQL_THD thd);
extern "C" unsigned long long thd_query_id(const MYSQL_THD thd); extern "C" unsigned long long thd_query_id(const MYSQL_THD thd);
extern "C" size_t thd_query_safe(MYSQL_THD thd, char *buf, size_t buflen); extern "C" size_t thd_query_safe(MYSQL_THD thd, char *buf, size_t buflen);
extern "C" const char *thd_priv_user(MYSQL_THD thd, size_t *length);
extern "C" const char *thd_priv_host(MYSQL_THD thd, size_t *length);
extern "C" const char *thd_user_name(MYSQL_THD thd); extern "C" const char *thd_user_name(MYSQL_THD thd);
extern "C" const char *thd_client_host(MYSQL_THD thd); extern "C" const char *thd_client_host(MYSQL_THD thd);
extern "C" const char *thd_client_ip(MYSQL_THD thd); extern "C" const char *thd_client_ip(MYSQL_THD thd);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment