WIP. Still need tests

This commit is contained in:
Carlos Salguero
2016-12-15 18:04:17 -03:00
parent 54d3d52486
commit f265de131d
3 changed files with 43 additions and 24 deletions

View File

@@ -4713,11 +4713,18 @@ sub parse_client_handshake_packet {
}
my $code_len = hex($buff_len);
my ( $db ) = $data =~ m!
^.{64}${user}00.. # Everything matched before
(?:..){$code_len} # The scramble buffer
(.*?)00.*\Z # The database name
!x;
my $db;
my $capability_flags = to_num($flags); # $flags is stored as little endian.
if ($capability_flags & $flag_for{CLIENT_CONNECT_WITH_DB}) {
( $db ) = $data =~ m!
^.{64}${user}00.. # Everything matched before
(?:..){$code_len} # The scramble buffer
(.*?)00.*\Z # The database name
!x;
}
my $pkt = {
user => to_string($user),
db => $db ? to_string($db) : '',

View File

@@ -8725,11 +8725,18 @@ sub parse_client_handshake_packet {
}
my $code_len = hex($buff_len);
my ( $db ) = $data =~ m!
^.{64}${user}00.. # Everything matched before
(?:..){$code_len} # The scramble buffer
(.*?)00.*\Z # The database name
!x;
my $db;
my $capability_flags = to_num($flags); # $flags is stored as little endian.
if ($capability_flags & $flag_for{CLIENT_CONNECT_WITH_DB}) {
( $db ) = $data =~ m!
^.{64}${user}00.. # Everything matched before
(?:..){$code_len} # The scramble buffer
(.*?)00.*\Z # The database name
!x;
}
my $pkt = {
user => to_string($user),
db => $db ? to_string($db) : '',