Uploaded image for project: 'MariaDB Connector/C'
  1. MariaDB Connector/C
  2. CONC-490

Bad Handshake error in mysql_real_connect when passing CLIENT_CONNECT_WITH_DB

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.1.8, 3.1.9
    • Fix Version/s: 3.1.13, 3.2.0
    • Component/s: Other
    • 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));
          }
      

        Attachments

          Activity

            People

            Assignee:
            georg Georg Richter
            Reporter:
            Hendi48 Hendrik
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Git Integration