From 654aa64d01c699f01be6941eca5b640ad8e848ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Mon, 14 Jan 2019 11:51:54 +0100 Subject: [PATCH] Add system_user as connection attribute in mysql client This is similar to SYSTEM_USER in the syslog implmentation in mysql client. --- client/mysql.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/client/mysql.cc b/client/mysql.cc index 343fc53dede..f212dfec4dc 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -4513,8 +4513,13 @@ static void init_connection_options(MYSQL *mysql) { mysql_options(mysql, MYSQL_ENABLE_CLEARTEXT_PLUGIN, (char *)&opt_enable_cleartext_plugin); + get_current_os_user(); + get_current_os_sudouser(); mysql_options(mysql, MYSQL_OPT_CONNECT_ATTR_RESET, 0); mysql_options4(mysql, MYSQL_OPT_CONNECT_ATTR_ADD, "program_name", "mysql"); + mysql_options4(mysql, MYSQL_OPT_CONNECT_ATTR_ADD, "system_user", + current_os_sudouser ? current_os_sudouser + : current_os_user ? current_os_user : ""); mysql_options(mysql, MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, &handle_expired); }