[CONC-490] Bad Handshake error in mysql_real_connect when passing CLIENT_CONNECT_WITH_DB Created: 2020-08-28  Updated: 2021-06-14  Resolved: 2021-04-29

Status: Closed
Project: MariaDB Connector/C
Component/s: Other
Affects Version/s: 3.1.8, 3.1.9
Fix Version/s: 3.2.0, 3.1.13

Type: Bug Priority: Major
Reporter: Hendrik Assignee: Georg Richter
Resolution: Fixed Votes: 0
Labels: None
Environment:

MariaDB 10.5.5
Arch Linux



 Description   

The C connector generates and sends an invalid auth packet when passing the CLIENT_CONNECT_WITH_DB flag but not actually passing a DB string. Doing this may seem non-sensical at first (especially when looking at the simple example below), but in my specific case I'm using a wrapper library around libmysqlclient which is always setting the flag, no matter if you actually want a database or not.

Debugging this cost me several hours. It could make sense for my_auth.c to clear the respective flag bit if db is NULL instead of sending a faulty packet.

    MYSQL *my = mysql_init(NULL);
    if (mysql_real_connect(my, "localhost", "root", "foo", NULL, 3306, NULL, CLIENT_CONNECT_WITH_DB)) {
        printf("SUCCESS\n");
    } else {
        printf("%d\n", mysql_errno(my));
    }



 Comments   
Comment by Georg Richter [ 2021-04-29 ]

Fixed rev. d60bdbeb684ccf74adb9b69685a516fc68b508ba

Generated at Thu Feb 08 03:05:41 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.