Skip to content

Commit 3665c6e

Browse files
committed
BUG33149514: Allow the c-ext compilation using a libmysqlclient without MFA
This patch fixes the c-ext compilation error when using a libmysqlclient without the support for Multi Factor Authentication.
1 parent d8a9627 commit 3665c6e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/mysql_capi.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -935,6 +935,7 @@ MySQL_change_user(MySQL *self, PyObject *args, PyObject *kwds)
935935
mysql_options(&self->session, MYSQL_ENABLE_CLEARTEXT_PLUGIN, (char*)&abool);
936936
}
937937

938+
#if MYSQL_VERSION_ID >= 80027
938939
// Multi Factor Authentication: 1-factor password
939940
if (password1 && strlen(password1) > 0)
940941
{
@@ -952,6 +953,7 @@ MySQL_change_user(MySQL *self, PyObject *args, PyObject *kwds)
952953
{
953954
mysql_options4(&self->session, MYSQL_OPT_USER_PASSWORD, &mfa_factor3, password3);
954955
}
956+
#endif
955957

956958
Py_BEGIN_ALLOW_THREADS
957959
res= mysql_change_user(&self->session, user, password, database);
@@ -1395,6 +1397,7 @@ MySQL_connect(MySQL *self, PyObject *args, PyObject *kwds)
13951397
}
13961398
}
13971399

1400+
#if MYSQL_VERSION_ID >= 80027
13981401
// Multi Factor Authentication: 1-factor password
13991402
if (password1 && strlen(password1) > 0)
14001403
{
@@ -1412,6 +1415,7 @@ MySQL_connect(MySQL *self, PyObject *args, PyObject *kwds)
14121415
{
14131416
mysql_options4(&self->session, MYSQL_OPT_USER_PASSWORD, &mfa_factor3, password3);
14141417
}
1418+
#endif
14151419

14161420
Py_BEGIN_ALLOW_THREADS
14171421
res= mysql_real_connect(&self->session, host, user, password, database,

0 commit comments

Comments
 (0)