Skip to content

Commit fa47c73

Browse files
committed
MDEV-12182 post-merge
* fix plugin version * don't print :unavaliable for localhost
1 parent 1aba30b commit fa47c73

File tree

6 files changed

+418
-421
lines changed

6 files changed

+418
-421
lines changed

include/mysql/plugin_audit.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ struct mysql_event_general
6666
unsigned long long general_rows;
6767
/* Added in version 0x302 */
6868
unsigned long long query_id;
69+
/* Added in version 0x303 */
6970
unsigned int port;
7071
MYSQL_CONST_LEX_STRING database;
7172
};

mysql-test/suite/plugins/r/server_audit.result

Lines changed: 254 additions & 256 deletions
Large diffs are not rendered by default.

mysql-test/suite/plugins/r/thread_pool_server_audit.result

Lines changed: 151 additions & 151 deletions
Large diffs are not rendered by default.

mysql-test/suite/plugins/t/server_audit.test

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,7 @@ set global server_audit_incl_users='user1';
171171
create user user1@localhost;
172172
grant all on sa_db.* to user1@localhost;
173173

174-
connect (cn1,localhost,user1,,sa_db);
175-
connection cn1;
174+
connect (cn1,127.0.0.1,user1,,sa_db,$MASTER_MYPORT);
176175

177176
create table t1(id int) engine=myisam;
178177
insert delayed into t1 values (1);
@@ -204,7 +203,6 @@ connect(plug_con,localhost,plug,plug_dest);
204203
GRANT PROXY ON plug_dest TO plug;
205204
--sleep 2
206205
connect(plug_con,localhost,plug,plug_dest,"*NO-ONE*");
207-
connection plug_con;
208206
select USER(),CURRENT_USER();
209207
connection default;
210208
disconnect plug_con;
@@ -252,7 +250,7 @@ uninstall plugin server_audit;
252250
# replace stored SSL verison with constant string "TLS_VERSION"
253251
--replace_result $ssl_version TLS_VERSION
254252
# replace the timestamp and the hostname with constant values
255-
--replace_regex /[0-9]* [0-9][0-9]:[0-9][0-9]:[0-9][0-9]\,[^,]*\,/TIME,HOSTNAME,/ /\,[1-9][0-9]*\,/,1,/ /\,[1-9][0-9]*/,ID/
253+
--replace_regex /\d* \d\d:\d\d:\d\d\,[^,]*\,/TIME,HOSTNAME,/ /\,[1-9]\d*\,/,1,/ /\,[1-9]\d*/,ID/ /:\d+,/:PORT,/
256254
cat_file $MYSQLD_DATADIR/server_audit.log;
257255
remove_file $MYSQLD_DATADIR/server_audit.log;
258256
--enable_ps2_protocol

mysql-test/suite/plugins/t/thread_pool_server_audit.test

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,11 @@ uninstall plugin server_audit;
144144
--enable_ps2_protocol
145145

146146
let $MYSQLD_DATADIR= `SELECT @@datadir`;
147+
if ($MARIADB_UPGRADE_EXE) { # windows
148+
let $replace_port= /localhost:\d+/localhost/;
149+
}
147150
# replace the timestamp, hostname, and port number with constant values
148-
--replace_regex /[0-9]* [0-9][0-9]:[0-9][0-9]:[0-9][0-9]\,[^,]*\,/TIME,HOSTNAME,/ /\,[1-9][0-9]*\,/,1,/ /\,[1-9][0-9]*/,ID/ /,localhost:([0-9]+|unavailable)/,localhost:port/
151+
--replace_regex /\d* \d\d:\d\d:\d\d\,[^,]*\,/TIME,HOSTNAME,/ /\,[1-9]\d*\,/,1,/ /\,[1-9]\d*/,ID/ $replace_port
149152
cat_file $MYSQLD_DATADIR/server_audit.log;
150153
remove_file $MYSQLD_DATADIR/server_audit.log;
151154

plugin/server_audit/server_audit.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
1616

1717

18-
#define PLUGIN_VERSION 0x104
19-
#define PLUGIN_STR_VERSION "1.5.14"
18+
#define PLUGIN_VERSION 0x105
19+
#define PLUGIN_STR_VERSION "1.5.0"
2020

2121
#define _my_thread_var loc_thread_var
2222

@@ -1458,10 +1458,9 @@ static size_t log_header(char *message, size_t message_len,
14581458
host= userip;
14591459
}
14601460
if (port == 0) {
1461-
strncpy(port_str, "unavailable", sizeof(port_str) - 1);
1462-
port_str[sizeof(port_str) - 1] = '\0';
1461+
port_str[0] = '\0';
14631462
} else {
1464-
my_snprintf(port_str, sizeof(port_str), "%u", port);
1463+
my_snprintf(port_str, sizeof(port_str), ":%u", port);
14651464
}
14661465

14671466
/*
@@ -1476,15 +1475,15 @@ static size_t log_header(char *message, size_t message_len,
14761475

14771476
if (output_type == OUTPUT_SYSLOG)
14781477
return my_snprintf(message, message_len,
1479-
"%.*s,%.*s,%.*s:%s,%d,%lld,%s",
1478+
"%.*s,%.*s,%.*s%s,%d,%lld,%s",
14801479
(int) serverhost_len, serverhost,
14811480
username_len, username,
14821481
host_len, host, port_str,
14831482
connection_id, query_id, operation);
14841483

14851484
(void) localtime_r(ts, &tm_time);
14861485
return my_snprintf(message, message_len,
1487-
"%04d%02d%02d %02d:%02d:%02d,%.*s,%.*s,%.*s:%s,%d,%lld,%s",
1486+
"%04d%02d%02d %02d:%02d:%02d,%.*s,%.*s,%.*s%s,%d,%lld,%s",
14881487
tm_time.tm_year+1900, tm_time.tm_mon+1, tm_time.tm_mday,
14891488
tm_time.tm_hour, tm_time.tm_min, tm_time.tm_sec,
14901489
(int) serverhost_len, serverhost,
@@ -2048,8 +2047,6 @@ static int log_table(const struct connection_info *cn,
20482047
char message[1024];
20492048
time_t ctime;
20502049

2051-
2052-
20532050
(void) time(&ctime);
20542051
csize= log_header(message, sizeof(message)-1, &ctime,
20552052
servhost, servhost_len,

0 commit comments

Comments
 (0)