diff options
author | Alexey Botchkov <holyfoot@askmonty.org> | 2021-08-10 23:22:04 +0400 |
---|---|---|
committer | Alexey Botchkov <holyfoot@askmonty.org> | 2021-08-10 23:22:04 +0400 |
commit | 10db7fcfa6ddea3e8ef047f095c4f136a1fb42ce (patch) | |
tree | 9918c474ae7bf4059f661ac4e3eb7f7212cf139f | |
parent | 20a9f0b5110ddb04862e8b9cc8a1150617ad653a (diff) | |
download | mariadb-git-10db7fcfa6ddea3e8ef047f095c4f136a1fb42ce.tar.gz |
MENT-977 log priv host / priv user.bb-10.5-hf
Add server functions to provide necessary data.
-rw-r--r-- | sql/sql_class.cc | 26 | ||||
-rw-r--r-- | sql/sql_class.h | 2 |
2 files changed, 28 insertions, 0 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 31d9979b22c..37580568de5 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -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 /** open a table and add it to thd->open_tables diff --git a/sql/sql_class.h b/sql/sql_class.h index ec031bf06e6..f0b8ee651f3 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -197,6 +197,8 @@ extern MYSQL_PLUGIN_IMPORT const char **errmesg; extern "C" LEX_STRING * thd_query_string (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" 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_client_host(MYSQL_THD thd); extern "C" const char *thd_client_ip(MYSQL_THD thd); |