diff options
author | Alexey Botchkov <holyfoot@askmonty.org> | 2017-02-20 18:22:01 +0400 |
---|---|---|
committer | Alexey Botchkov <holyfoot@askmonty.org> | 2017-02-20 18:22:01 +0400 |
commit | 1b7aae90fbc53368f7cd41062752816460dce832 (patch) | |
tree | 2d5ff5532142f9690c434d8c273dabea5d9f37e5 /plugin | |
parent | 6364adb199f8adbc5adfe0c276bdf2d3dd17454c (diff) | |
download | mariadb-git-1b7aae90fbc53368f7cd41062752816460dce832.tar.gz |
MDEV-11904 Make Audit Plugin working with MySQL 8.0.
MySQL 8.0 basically inherits the 5.7 model, though some
modeifications required for the plugin.
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/server_audit/server_audit.c | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/plugin/server_audit/server_audit.c b/plugin/server_audit/server_audit.c index 87ba00b2d35..eae7ad12f1c 100644 --- a/plugin/server_audit/server_audit.c +++ b/plugin/server_audit/server_audit.c @@ -2297,10 +2297,10 @@ typedef struct loc_system_variables } LOC_SV; +static int init_done= 0; + static int server_audit_init(void *p __attribute__((unused))) { - const void *my_hash_init_ptr; - if (!serv_ver) { #ifdef _WIN32 @@ -2309,11 +2309,16 @@ static int server_audit_init(void *p __attribute__((unused))) serv_ver= server_version; #endif /*_WIN32*/ } - my_hash_init_ptr= dlsym(RTLD_DEFAULT, "_my_hash_init"); - if (!my_hash_init_ptr) + if (!mysql_57_started) { - maria_above_5= 1; - my_hash_init_ptr= dlsym(RTLD_DEFAULT, "my_hash_init2"); + const void *my_hash_init_ptr= dlsym(RTLD_DEFAULT, "_my_hash_init"); + if (!my_hash_init_ptr) + { + maria_above_5= 1; + my_hash_init_ptr= dlsym(RTLD_DEFAULT, "my_hash_init2"); + } + if (!my_hash_init_ptr) + return 1; } if(!(int_mysql_data_home= dlsym(RTLD_DEFAULT, "mysql_data_home"))) @@ -2322,7 +2327,7 @@ static int server_audit_init(void *p __attribute__((unused))) int_mysql_data_home= &default_home; } - if (!serv_ver || !my_hash_init_ptr) + if (!serv_ver) return 1; if (!started_mysql) @@ -2402,6 +2407,7 @@ static int server_audit_init(void *p __attribute__((unused))) if (logging) start_logging(); + init_done= 1; return 0; } @@ -2417,6 +2423,10 @@ static int server_audit_init_mysql(void *p) static int server_audit_deinit(void *p __attribute__((unused))) { + if (!init_done) + return 0; + + init_done= 0; coll_free(&incl_user_coll); coll_free(&excl_user_coll); @@ -2839,13 +2849,15 @@ void __attribute__ ((constructor)) audit_plugin_so_init(void) if (sc >= 24) use_event_data_for_disconnect= 1; } - else if (serv_ver[0] == '5' && serv_ver[2] == '7') + else if ((serv_ver[0] == '5' && serv_ver[2] == '7') || + (serv_ver[0] == '8' && serv_ver[2] == '0')) { mysql_57_started= 1; _mysql_plugin_declarations_[0].info= mysql_v4_descriptor; use_event_data_for_disconnect= 1; } - MYSQL_SYSVAR_NAME(loc_info).flags= PLUGIN_VAR_READONLY | PLUGIN_VAR_MEMALLOC; + MYSQL_SYSVAR_NAME(loc_info).flags= PLUGIN_VAR_STR | PLUGIN_VAR_THDLOCAL | + PLUGIN_VAR_READONLY | PLUGIN_VAR_MEMALLOC; } memset(locinfo_ini_value, 'O', sizeof(locinfo_ini_value)-1); |