1
0
mirror of https://github.com/MariaDB/server.git synced 2026-10-23 18:49:29 +03:00
Files
Aleksey Midenkov 30e7c940ff handlersocket.basic unstable result fix
The test fails on random secret with backslash.

The random handlersocket_plain_secret is generated from the '0'..'z'
range, which includes the backslash. The test masked the secret with
--replace_result $HS_SECRET, and mysqltest parses --replace_result
arguments with backslash escapes, so the search string lost the
backslash and did not match the output. The unmasked secret then
appeared in the result (about 19% of runs).

The fix masks the secret in SQL: IF(variable_name LIKE
'handlersocket_plain_secret%', 'HS_SECRET', variable_value), which does
not depend on the secret value.
2026-10-01 23:05:42 +03:00

33 lines
1.5 KiB
Plaintext

--source include/not_windows_embedded.inc
--source include/have_innodb.inc
--source include/not_asan.inc
call mtr.add_suppression('handlersocket: open_files_limit is too small');
install plugin handlersocket soname 'handlersocket.so';
let HS_SECRET=`select @@handlersocket_plain_secret`;
let HS_PORT=`select @@handlersocket_port`;
--query_vertical select plugin_name, plugin_version, plugin_status, plugin_type, plugin_library, plugin_library_version, plugin_author, plugin_description, plugin_license, plugin_maturity, plugin_auth_version from information_schema.plugins where plugin_name = 'handlersocket'
--replace_result $HS_PORT HS_PORT
select variable_name, if(variable_name like 'handlersocket_plain_secret%', 'HS_SECRET', variable_value) as variable_value from information_schema.global_variables where variable_name like 'handlersocket%' order by variable_name;
select length(@@handlersocket_plain_secret), @@handlersocket_plain_secret = @@handlersocket_plain_secret_wr;
create table t1 (id int primary key, name varchar(100)) engine=innodb;
perl;
use IO::Socket::INET;
my $sock = IO::Socket::INET->new(PeerAddr => '127.0.0.1',
PeerPort => $ENV{HS_PORT}, Proto => 'tcp') or die "connect(): $!";
# 1) auth: A <atyp=1> <secret>
# 2) open_index: P <indexid> <db> <table> <index> <columns>
print $sock "A\t1\t$ENV{HS_SECRET}\nP\t1\ttest\tt1\tPRIMARY\tid,name\n";
print $sock "0\t=\t2147483647\t1\n";
printf "auth: %sopen: %sbad read: %s", scalar(<$sock>), scalar(<$sock>), scalar(<$sock>);
EOF
uninstall plugin handlersocket;
drop table t1;