[CONC-311] Attempting to connect using the gssapi plugin Created: 2018-02-18  Updated: 2018-02-19  Resolved: 2018-02-19

Status: Closed
Project: MariaDB Connector/C
Component/s: None
Affects Version/s: 3.0.2
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Charles S. Cotton Assignee: Georg Richter
Resolution: Not a Bug Votes: 0
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?



 Comments   
Comment by Georg Richter [ 2018-02-19 ]

The gssapi plugin is an authentication plugin, not a connection plugin. There is no need to load the plugin, this will be done automatically if you login with a username which requires gssapi/kerberos authentication (see https://mariadb.com/kb/en/library/authentication-plugin-gssapi/).

If the gssapi/kerberos plugin was build as dynamic plugin (.dll) make sure it is in your path or the environment variable MARIADB_PLUGIN_DIR points to the right path.

Comment by Charles S. Cotton [ 2018-02-19 ]

The problem, Georg, is that it does not work. Attempting to login with mysql_real_connect() fails for a valid gssapi user.

I wish you had not summarily closed this issue. You haven't properly solved anyth;ing at all! Your response is the worst of the worst.

The link you've provided does explain how to create gssapi users and activate the plugin, but I had read that link and performed those steps long before creating this post, Georg!

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