Commit graph

13 commits

Author SHA1 Message Date
Arne Welzel
02f4665e9b mysql: Implement and test COM_CHANGE_USER
This reworks the parser such that COM_CHANGE_USER switches the
connection back into the CONNECTION_PHASE so that we can remove the
EXPECT_AUTH_SWITCH special case in the COMMAND_PHASE. Adds two pcaps
produced with Python that actually do COM_CHANGE_USER as it seems
not possible from the MySQL CLI.
2024-08-14 10:20:01 +02:00
Arne Welzel
b1c63ae4e0 mysql: Handle server connection phase separately from command phase
This avoids interpreting an AuthSwitchRequest (0xfe) during the command
phase as EOF_Packet.

Thanks @AmazingPP.

Closes #3880
2024-08-13 22:06:25 +02:00
Arne Welzel
7b8bbc6d00 btest/mysql: Clean query-attr.pcapng
It contained some unrelated IntelliJ traffic.
2024-07-25 11:53:41 +02:00
Arne Welzel
2894ae38d0 mysql: Support non-string query attributes
The query attributes aren't exposed to script layer right now, but this
should at least parse over them once encountered and some fixups.
2024-07-25 11:53:41 +02:00
Arne Welzel
93f5813be3 btest/mysql: Add pcap with non-string query attributes
Pcap was generated as follows. Doesn't seem wireshark even parses
this properly right now.

    with common.get_connection() as c:
        with c.cursor() as cur:
            date1 = datetime.date(1987, 10, 18)
            datetime1 = datetime.datetime(1990, 9, 26, 12, 13, 14)
            cur.add_attribute("number1", 42)
            cur.add_attribute("string1", "a string")
            cur.add_attribute("date1", date1)
            cur.add_attribute("datetime1", datetime1)
            cur.execute("SELECT version()")
            result = cur.fetchall()
            print("result", result)
2024-07-25 11:53:41 +02:00
Fupeng Zhao
e8bdf149f2 Add support for "auth switch" and "query attrs"
Also fix the issue where Resultset could not correctly distinguish between EOF_Packet and OK_Packet.
2024-07-25 11:53:40 +02:00
Fupeng Zhao
9cb618c718 Add support for parsing the "caching_sha2_password" auth plugin 2024-07-25 11:53:35 +02:00
Arne Welzel
03dc21a861 testing/mysql: Add traces recorded with a free-tier MySQL instance
Not sure this adds much more coverage then there was, but minimally
more recent software versions.

The instances/passwords were ephemeral, so hostname and password hashes
etc aren't useful to anyone.
2023-01-27 10:59:23 +01:00
Arne Welzel
672602dae7 MySQL: Fix endianness, introduce mysql_eof() event
We were parsing MySQL using bigendian even though the protocol is
specified as with "least significant byte first" [1]. This is most
problematic when parsing length encoded strings with 2 byte length
fields...

Further, I think, the EOF_Packet parsing was borked, either due to
testing the CLIENT_DEPRECATE_EOF with the wrong endianness, or due to
the workaround in Resultset processing raising mysql_ok(). Introduce a
new mysql_eof() that triggers for EOF_Packet's and remove the fake
mysql_ok() Resultset invocation to fix. Adapt the mysql script and tests
to account for the new event.

This is a quite backwards incompatible change on the event level, but
due to being quite buggy in general, doubt this matters to many.

I think there is more buried, but this fixes the violation of the simple
"SHOW ENGINE INNODB STATUS" and the existing tests continue to
succeed...

[1] https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_basic_dt_integers.html
2023-01-27 10:59:23 +01:00
Vlad Grigorescu
f3c656ef17 Add btest for GH-1084 2020-07-24 09:28:11 -05:00
Vlad Grigorescu
b0638dbdcf Add a test with an encrypted MySQL connection 2018-10-29 15:58:06 -05:00
Vlad Grigorescu
9bffdb7e14 Add a btest for the Wireshark sample MySQL PCAP 2014-08-08 15:02:18 -05:00
Vlad Grigorescu
49a2198dd5 Add memleak and auth btests. 2014-08-06 10:13:22 -05:00