summaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2021-01-11 17:32:08 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2021-01-11 17:32:08 +0200
commit666565c7f00b0f39bbb459a428efd0093ed05fc8 (patch)
treed9b7dc26979995f0a332c50d2daf043c2a75866e /plugin
parent92abdcca5a5324f0727112ab2417d10c7a8d5094 (diff)
parent8de233af815f28d096ac4ff136525abc3ddc771d (diff)
downloadmariadb-git-666565c7f00b0f39bbb459a428efd0093ed05fc8.tar.gz
Merge 10.5 into 10.6
Diffstat (limited to 'plugin')
-rw-r--r--plugin/server_audit/server_audit.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/plugin/server_audit/server_audit.c b/plugin/server_audit/server_audit.c
index 83799b4c714..888cc4a6252 100644
--- a/plugin/server_audit/server_audit.c
+++ b/plugin/server_audit/server_audit.c
@@ -1581,22 +1581,27 @@ no_password:
-static int do_log_user(const char *name, int take_lock)
+static int do_log_user(const char *name, int len,
+ const char *proxy, int proxy_len, int take_lock)
{
- size_t len;
int result;
if (!name)
return 0;
- len= strlen(name);
if (take_lock)
flogger_mutex_lock(&lock_operations);
if (incl_user_coll.n_users)
- result= coll_search(&incl_user_coll, name, len) != 0;
+ {
+ result= coll_search(&incl_user_coll, name, len) != 0 ||
+ (proxy && coll_search(&incl_user_coll, proxy, proxy_len) != 0);
+ }
else if (excl_user_coll.n_users)
- result= coll_search(&excl_user_coll, name, len) == 0;
+ {
+ result= coll_search(&excl_user_coll, name, len) == 0 &&
+ (proxy && coll_search(&excl_user_coll, proxy, proxy_len) == 0);
+ }
else
result= 1;
@@ -2137,7 +2142,9 @@ void auditing(MYSQL_THD thd, unsigned int event_class, const void *ev)
}
if (event_class == MYSQL_AUDIT_GENERAL_CLASS && FILTER(EVENT_QUERY) &&
- cn && (cn->log_always || do_log_user(cn->user, 1)))
+ cn && (cn->log_always || do_log_user(cn->user, cn->user_length,
+ cn->proxy, cn->proxy_length,
+ 1)))
{
const struct mysql_event_general *event =
(const struct mysql_event_general *) ev;
@@ -2157,7 +2164,8 @@ void auditing(MYSQL_THD thd, unsigned int event_class, const void *ev)
{
const struct mysql_event_table *event =
(const struct mysql_event_table *) ev;
- if (do_log_user(event->user, 1))
+ if (do_log_user(event->user, (int) SAFE_STRLEN(event->user),
+ cn->proxy, cn->proxy_length, 1))
{
switch (event->event_subclass)
{