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

Attempting to connect using the gssapi plugin

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Not a Bug
    • Affects Version/s: 3.0.2
    • Fix Version/s: N/A
    • Labels:
      None
    • Environment:
      Windows 10 x64, build 16299.192.
      MariaDB Server 10.2.13, x64.

      Description

      I have encountered the following bug in the latest mariadb connector-c, or maybe I'm just doing something wrong.

      I am trying to authenticate with auth_gssapi (windows authentication), but it fails.
      Tracing through the connector-c source brings me to the following culprit:

      The following 'if' test, starting at line 423, in ma_client_plugin.c, within the 'mysql_load_plugin_v' function,
      doesn't pass: 'type' is 103 but 'plugin->type' is 2 ...

      if (type >=0 && type != plugin->type)

      { errmsg= "type mismatch"; goto err; }

      I have correctly defined 'gssapi' users and have proven that it works by successfully logging
      into mysql from the windows admin command prompt with the gssapi users I have created.

      Here is my code containing the 'mysql_real_connect() function:

      // MySQL Initialization.
      int rc;
      if ((rc = mysql_library_init(0, NULL, NULL)))

      { CString msg; msg.Format("The following error occurred while attempting to initialize the MySQL Library:\n\n\"%s\"", mysql_error(&m_pObj->m_MySQLDB)); MessageBox(m_hWnd, msg, "CSC.MySQLOleDB Initialization Error", MB_ICONEXCLAMATION); return E_FAIL; }

      // Connect to MySQL Server.
      if (mysql_init(&m_pObj->m_MySQLDB))
      {
      if (!mysql_optionsv(&m_pObj->m_MySQLDB, MYSQL_PLUGIN_DIR,
      "Z:\\DevProjects\\VisualStudio2010\\Projects\\MySQLOleDBProvider\\MariaDB\\CMakeTarget\\plugins\\lib
      Debug"))
      {
      UINT arg1 = MYSQL_PROTOCOL_TCP;
      if (!mysql_optionsv(&m_pObj->m_MySQLDB, MYSQL_OPT_PROTOCOL, &arg1))
      {
      if (!mysql_optionsv(&m_pObj->m_MySQLDB, MARIADB_OPT_CONNECTION_HANDLER, "auth_gssapi"))
      {
      // m_ServerName = "localhost";
      // m_DBName = "mysql";
      // m_UserID.Empty();
      MYSQL* cnHandle = mysql_real_connect(&m_pObj->m_MySQLDB, m_ServerName, m_UserID, m_Password, m_DBName, 0, NULL, 0);
      if (cnHandle != &m_pObj->m_MySQLDB)

      { hr = E_FAIL; LogError(hr, IID_IDBInitialize, &m_pObj->m_MySQLDB); mysql_library_end(); return hr; }

      }
      }
      }
      }
      m_pObj->m_bDSOInitialized = TRUE;
      return S_OK;
      ///////////////////////////////

      Probably some of the mysql_optionsv() calls are unnecessary, but the two critical ones,
      namely MYSQL_PLUGIN_DIR and MARIADB_OPT_CONNECTION_HANDLER have enabled the connector-c code to
      'open' the dll.

      Note: if I temporarily disable the if block, above, that is not passing, the next test that validates the plugin name
      fails. plugin->name is 'auth_gssapi_client' and NOT 'auth_gssapi' ...

      if (strcmp(name, plugin->name))

      { errmsg= "name mismatch"; goto err; }

      And if I temporarily disable the name test, and trick the code into finally calling the plugin->connect statement,
      it crashes.

      So something is seriously wrong here.

      Any ideas?

        Attachments

          Activity

            People

            Assignee:
            georg Georg Richter
            Reporter:
            ccotton Charles S. Cotton
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: