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

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 3.1.8, 3.1.9
    • 3.2.0, 3.1.13
    • Other
    • None
    • 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

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

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.