From a099284b716b07af0d196705f44b828d621943d2 Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Wed, 3 Jul 2019 16:41:01 +0400 Subject: MDEV-19851 server_audit plugin should not allow server_audit_output_type=SYSLOG on Windows. 'syslog' output type disabled on Windows. --- plugin/server_audit/server_audit.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'plugin') diff --git a/plugin/server_audit/server_audit.c b/plugin/server_audit/server_audit.c index 3da52643787..16a677e2644 100644 --- a/plugin/server_audit/server_audit.c +++ b/plugin/server_audit/server_audit.c @@ -26,6 +26,7 @@ #include #ifndef _WIN32 +#define DO_SYSLOG #include #else #define syslog(PRIORITY, FORMAT, INFO, MESSAGE_LEN, MESSAGE) do {}while(0) @@ -384,17 +385,31 @@ static MYSQL_SYSVAR_SET(events, events, PLUGIN_VAR_RQCMDARG, "Specifies the set of events to monitor. Can be CONNECT, QUERY, TABLE," " QUERY_DDL, QUERY_DML, QUERY_DML_NO_SELECT, QUERY_DCL.", NULL, NULL, 0, &events_typelib); +#ifdef DO_SYSLOG #define OUTPUT_SYSLOG 0 #define OUTPUT_FILE 1 +#else +#define OUTPUT_SYSLOG 0xFFFF +#define OUTPUT_FILE 0 +#endif /*DO_SYSLOG*/ + #define OUTPUT_NO 0xFFFF -static const char *output_type_names[]= { "syslog", "file", 0 }; +static const char *output_type_names[]= { +#ifdef DO_SYSLOG + "syslog", +#endif + "file", 0 }; static TYPELIB output_typelib= { array_elements(output_type_names) - 1, "output_typelib", output_type_names, NULL }; static MYSQL_SYSVAR_ENUM(output_type, output_type, PLUGIN_VAR_RQCMDARG, +#ifdef DO_SYSLOG "Desired output type. Possible values - 'syslog', 'file'" +#else + "Desired output type. Possible values - 'file'" +#endif " or 'null' as no output.", 0, update_output_type, OUTPUT_FILE, &output_typelib); static MYSQL_SYSVAR_STR(file_path, file_path, PLUGIN_VAR_RQCMDARG, -- cgit v1.2.1 From d04961cdb346667d0a4e2f8bd74950668af7700c Mon Sep 17 00:00:00 2001 From: HF Date: Fri, 5 Jul 2019 12:22:04 +0100 Subject: Make Win compiler happy. --- plugin/server_audit/server_audit.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'plugin') diff --git a/plugin/server_audit/server_audit.c b/plugin/server_audit/server_audit.c index 16a677e2644..1555495b15f 100644 --- a/plugin/server_audit/server_audit.c +++ b/plugin/server_audit/server_audit.c @@ -407,10 +407,12 @@ static TYPELIB output_typelib= static MYSQL_SYSVAR_ENUM(output_type, output_type, PLUGIN_VAR_RQCMDARG, #ifdef DO_SYSLOG "Desired output type. Possible values - 'syslog', 'file'" + " or 'null' as no output.", #else "Desired output type. Possible values - 'file'" + " or 'null' as no output.", #endif - " or 'null' as no output.", 0, update_output_type, OUTPUT_FILE, + 0, update_output_type, OUTPUT_FILE, &output_typelib); static MYSQL_SYSVAR_STR(file_path, file_path, PLUGIN_VAR_RQCMDARG, "Path to the log file.", NULL, update_file_path, default_file_name); -- cgit v1.2.1 From 02a0ebc613bf51fd4a943f4f216f1d5220c947be Mon Sep 17 00:00:00 2001 From: HF Date: Sat, 6 Jul 2019 12:22:45 +0100 Subject: Make Win compiler happy about the SERVER_AUDIT code. --- plugin/server_audit/server_audit.c | 42 ++++++++++++++++++------------------- plugin/server_audit/test_audit_v4.c | 6 +++--- 2 files changed, 24 insertions(+), 24 deletions(-) (limited to 'plugin') diff --git a/plugin/server_audit/server_audit.c b/plugin/server_audit/server_audit.c index 1555495b15f..a18b40c21a7 100644 --- a/plugin/server_audit/server_audit.c +++ b/plugin/server_audit/server_audit.c @@ -28,7 +28,11 @@ #ifndef _WIN32 #define DO_SYSLOG #include +static const char out_type_desc[]= "Desired output type. Possible values - 'syslog', 'file'" + " or 'null' as no output."; #else +static const char out_type_desc[]= "Desired output type. Possible values - 'file'" + " or 'null' as no output."; #define syslog(PRIORITY, FORMAT, INFO, MESSAGE_LEN, MESSAGE) do {}while(0) static void closelog() {} #define openlog(IDENT, LOG_NOWAIT, LOG_USER) do {}while(0) @@ -88,6 +92,7 @@ static void closelog() {} #include #include #include +#include "../../mysys/mysys_priv.h" #ifndef RTLD_DEFAULT #define RTLD_DEFAULT NULL #endif @@ -405,13 +410,7 @@ static TYPELIB output_typelib= output_type_names, NULL }; static MYSQL_SYSVAR_ENUM(output_type, output_type, PLUGIN_VAR_RQCMDARG, -#ifdef DO_SYSLOG - "Desired output type. Possible values - 'syslog', 'file'" - " or 'null' as no output.", -#else - "Desired output type. Possible values - 'file'" - " or 'null' as no output.", -#endif + out_type_desc, 0, update_output_type, OUTPUT_FILE, &output_typelib); static MYSQL_SYSVAR_STR(file_path, file_path, PLUGIN_VAR_RQCMDARG, @@ -655,7 +654,7 @@ static void remove_blanks(char *user) struct user_name { - int name_len; + size_t name_len; char *name; }; @@ -690,7 +689,7 @@ static int cmp_users(const void *ia, const void *ib) { const struct user_name *a= (const struct user_name *) ia; const struct user_name *b= (const struct user_name *) ib; - int dl= a->name_len - b->name_len; + int dl= (int) a->name_len - (int) b->name_len; if (dl != 0) return dl; @@ -698,7 +697,7 @@ static int cmp_users(const void *ia, const void *ib) } -static char *coll_search(struct user_coll *c, const char *n, int len) +static char *coll_search(struct user_coll *c, const char *n, size_t len) { struct user_name un; struct user_name *found; @@ -710,7 +709,7 @@ static char *coll_search(struct user_coll *c, const char *n, int len) } -static int coll_insert(struct user_coll *c, char *n, int len) +static int coll_insert(struct user_coll *c, char *n, size_t len) { if (c->n_users >= c->n_alloced) { @@ -965,7 +964,7 @@ static void get_str_n(char *dest, int *dest_len, size_t dest_size, memcpy(dest, src, src_len); dest[src_len]= 0; - *dest_len= src_len; + *dest_len= (int) src_len; } @@ -1151,6 +1150,7 @@ static void setup_connection_connect(struct connection_info *cn, #define SAFE_STRLEN(s) (s ? strlen(s) : 0) +#define SAFE_STRLEN_UI(s) ((unsigned int) (s ? strlen(s) : 0)) static char empty_str[1]= { 0 }; @@ -1310,7 +1310,7 @@ exit: static size_t log_header(char *message, size_t message_len, time_t *ts, - const char *serverhost, unsigned int serverhost_len, + const char *serverhost, size_t serverhost_len, const char *username, unsigned int username_len, const char *host, unsigned int host_len, const char *userip, unsigned int userip_len, @@ -1328,7 +1328,7 @@ static size_t log_header(char *message, size_t message_len, if (output_type == OUTPUT_SYSLOG) return my_snprintf(message, message_len, "%.*s,%.*s,%.*s,%d,%lld,%s", - serverhost_len, serverhost, + (unsigned int) serverhost_len, serverhost, username_len, username, host_len, host, connection_id, query_id, operation); @@ -1486,7 +1486,7 @@ static size_t escape_string_hide_passwords(const char *str, unsigned int len, } next_s++; } - len-= next_s - str; + len-= (unsigned int) (next_s - str); str= next_s; continue; } @@ -1807,9 +1807,9 @@ static int log_table(const struct connection_info *cn, (void) time(&ctime); csize= log_header(message, sizeof(message)-1, &ctime, servhost, servhost_len, - event->user, SAFE_STRLEN(event->user), - event->host, SAFE_STRLEN(event->host), - event->ip, SAFE_STRLEN(event->ip), + event->user, SAFE_STRLEN_UI(event->user), + event->host, SAFE_STRLEN_UI(event->host), + event->ip, SAFE_STRLEN_UI(event->ip), event->thread_id, cn->query_id, type); csize+= my_snprintf(message+csize, sizeof(message) - 1 - csize, ",%.*s,%.*s,",event->database_length, event->database, @@ -1829,9 +1829,9 @@ static int log_rename(const struct connection_info *cn, (void) time(&ctime); csize= log_header(message, sizeof(message)-1, &ctime, servhost, servhost_len, - event->user, SAFE_STRLEN(event->user), - event->host, SAFE_STRLEN(event->host), - event->ip, SAFE_STRLEN(event->ip), + event->user, SAFE_STRLEN_UI(event->user), + event->host, SAFE_STRLEN_UI(event->host), + event->ip, SAFE_STRLEN_UI(event->ip), event->thread_id, cn->query_id, "RENAME"); csize+= my_snprintf(message+csize, sizeof(message) - 1 - csize, ",%.*s,%.*s|%.*s.%.*s,",event->database_length, event->database, diff --git a/plugin/server_audit/test_audit_v4.c b/plugin/server_audit/test_audit_v4.c index ae7527f8449..d0b341be346 100644 --- a/plugin/server_audit/test_audit_v4.c +++ b/plugin/server_audit/test_audit_v4.c @@ -56,11 +56,11 @@ static int auditing_v4(MYSQL_THD thd, mysql_event_class_t class, const void *ev) ev_302.general_error_code= event->general_error_code; ev_302.general_thread_id= event->general_thread_id; ev_302.general_user= event->general_user.str; - ev_302.general_user_length= event->general_user.length; + ev_302.general_user_length= (unsigned int) event->general_user.length; ev_302.general_command= event->general_command.str; - ev_302.general_command_length= event->general_command.length; + ev_302.general_command_length= (unsigned int) event->general_command.length; ev_302.general_query= event->general_query.str; - ev_302.general_query_length= event->general_query.length; + ev_302.general_query_length= (unsigned int) event->general_query.length; ev_302.general_charset= event->general_charset; ev_302.general_time= event->general_time; ev_302.general_rows= event->general_rows; -- cgit v1.2.1 From e2bbb6f5e9b766d4ab91bcdef895414bedd00bc4 Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Fri, 12 Jul 2019 16:44:39 +0200 Subject: switch to CC 3.1 --- plugin/auth_ed25519/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugin') diff --git a/plugin/auth_ed25519/CMakeLists.txt b/plugin/auth_ed25519/CMakeLists.txt index ff6651c528d..1a3d5cc4bce 100644 --- a/plugin/auth_ed25519/CMakeLists.txt +++ b/plugin/auth_ed25519/CMakeLists.txt @@ -24,8 +24,8 @@ ENDIF() MYSQL_ADD_PLUGIN(auth_ed25519 server_ed25519.c ${REF10_SOURCES} MODULE_ONLY) # client plugin and unit test ed25519-t can use the library -MYSQL_ADD_PLUGIN(client_ed25519 client_ed25519.c MODULE_ONLY - CLIENT LINK_LIBRARIES ref10 mysys_ssl COMPONENT ClientPlugins) +#MYSQL_ADD_PLUGIN(client_ed25519 client_ed25519.c MODULE_ONLY +# CLIENT LINK_LIBRARIES ref10 mysys_ssl COMPONENT ClientPlugins) IF(WITH_UNIT_TESTS) MY_ADD_TESTS(ed25519 LINK_LIBRARIES ref10 mysys_ssl) -- cgit v1.2.1 From f27a00435b244431b74615854dbbd31eae594782 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Mon, 22 Jul 2019 12:16:39 +0200 Subject: The test for the wsrep_info plugin needs the same flexible wsrep version checking as the tests for Galera (continuation of MDEV-18565 task) --- plugin/wsrep_info/mysql-test/wsrep_info/suite.pm | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) (limited to 'plugin') diff --git a/plugin/wsrep_info/mysql-test/wsrep_info/suite.pm b/plugin/wsrep_info/mysql-test/wsrep_info/suite.pm index cf4d124cb53..9170a337bf4 100644 --- a/plugin/wsrep_info/mysql-test/wsrep_info/suite.pm +++ b/plugin/wsrep_info/mysql-test/wsrep_info/suite.pm @@ -6,24 +6,14 @@ use My::Find; return "Not run for embedded server" if $::opt_embedded_server; -return "WSREP is not compiled in" unless defined $::mysqld_variables{'wsrep-on'}; +return "WSREP is not compiled in" if not ::have_wsrep(); -my ($provider) = grep { -f $_ } $ENV{WSREP_PROVIDER}, - "/usr/lib/galera/libgalera_smm.so", - "/usr/lib64/galera/libgalera_smm.so"; +return "No wsrep provider library" unless ::have_wsrep_provider(); -return "No wsrep provider library" unless -f $provider; +return ::wsrep_version_message() unless ::check_wsrep_version(); return "No WSREP_INFO plugin" unless $ENV{WSREP_INFO_SO}; -$ENV{WSREP_PROVIDER} = $provider; - -my ($spath) = grep { -f "$_/wsrep_sst_rsync"; } "$::bindir/scripts", $::path_client_bindir; -return "No SST scripts" unless $spath; - -my ($epath) = grep { -f "$_/my_print_defaults"; } "$::bindir/extra", $::path_client_bindir; -return "No my_print_defaults" unless $epath; - push @::global_suppressions, ( qr(WSREP:.*down context.*), @@ -38,11 +28,6 @@ push @::global_suppressions, qr|WSREP: access file\(.*gvwstate.dat\) failed\(No such file or directory\)|, ); - -$ENV{PATH}="$epath:$ENV{PATH}"; -$ENV{PATH}="$spath:$ENV{PATH}" unless $epath eq $spath; - sub is_default { 1 } bless { }; - -- cgit v1.2.1 From abeacb9c8280416ee0bf91f4bda414430a565ad5 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Mon, 22 Jul 2019 12:20:49 +0200 Subject: The test for the wsrep_info plugin needs the same flexible wsrep version checking as the tests for Galera (continuation of MDEV-18565 task) --- plugin/wsrep_info/mysql-test/wsrep_info/suite.pm | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) (limited to 'plugin') diff --git a/plugin/wsrep_info/mysql-test/wsrep_info/suite.pm b/plugin/wsrep_info/mysql-test/wsrep_info/suite.pm index 96a0c706e01..9170a337bf4 100644 --- a/plugin/wsrep_info/mysql-test/wsrep_info/suite.pm +++ b/plugin/wsrep_info/mysql-test/wsrep_info/suite.pm @@ -6,26 +6,14 @@ use My::Find; return "Not run for embedded server" if $::opt_embedded_server; -return "WSREP is not compiled in" unless defined $::mysqld_variables{'wsrep-on'}; +return "WSREP is not compiled in" if not ::have_wsrep(); -my ($provider) = grep { -f $_ } $ENV{WSREP_PROVIDER}, - "/usr/lib64/galera-3/libgalera_smm.so", - "/usr/lib64/galera/libgalera_smm.so", - "/usr/lib/galera-3/libgalera_smm.so", - "/usr/lib/galera/libgalera_smm.so"; +return "No wsrep provider library" unless ::have_wsrep_provider(); -return "No wsrep provider library" unless -f $provider; +return ::wsrep_version_message() unless ::check_wsrep_version(); return "No WSREP_INFO plugin" unless $ENV{WSREP_INFO_SO}; -$ENV{WSREP_PROVIDER} = $provider; - -my ($spath) = grep { -f "$_/wsrep_sst_rsync"; } "$::bindir/scripts", $::path_client_bindir; -return "No SST scripts" unless $spath; - -my ($epath) = grep { -f "$_/my_print_defaults"; } "$::bindir/extra", $::path_client_bindir; -return "No my_print_defaults" unless $epath; - push @::global_suppressions, ( qr(WSREP:.*down context.*), @@ -40,11 +28,6 @@ push @::global_suppressions, qr|WSREP: access file\(.*gvwstate.dat\) failed\(No such file or directory\)|, ); - -$ENV{PATH}="$epath:$ENV{PATH}"; -$ENV{PATH}="$spath:$ENV{PATH}" unless $epath eq $spath; - sub is_default { 1 } bless { }; - -- cgit v1.2.1