Skip to content

Commit 3fe87a1

Browse files
committed
BUG#35233031: Connector/Python should not default to mysql_native_password
MySQL Connector/Python will default to `mysql_native_password` for authentication when using the C extension. This patch fixes this issue by not providing any default authentication plugin to libmysqlclient. Change-Id: I511cd151b6070a24a7c8da7a78a40e896f294dd5
1 parent a64354b commit 3fe87a1

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ v8.0.33
1515
- WL#15483: Support OCI ephemeral key-based authentication
1616
- WL#15435: Improve the logging system
1717
- WL#15401: Support for type hints in module mysqlx
18+
- BUG#35233031: Connector/Python should not default to mysql_native_password
1819
- BUG#35015758: COM_QUIT should not be called in the connection phase
1920
- BUG#34984850: Fix binary conversion with NO_BACKSLASH_ESCAPES mode
2021
- BUG#31355895: Fix slow executemany() with insert statements

src/mysql_capi.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ MySQL_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
361361
self->result = NULL;
362362
self->fields = NULL;
363363
self->use_unicode = 1;
364-
self->auth_plugin = PyUnicode_FromString("mysql_native_password");
364+
self->auth_plugin = Py_None;
365365
self->plugin_dir = PyUnicode_FromString(".");
366366
self->converter_str_fallback = Py_False;
367367

@@ -871,7 +871,8 @@ MySQL_change_user(MySQL *self, PyObject *args, PyObject *kwds)
871871
return NULL;
872872
}
873873

874-
if (strcmp(PyUnicode_AsUTF8(self->auth_plugin), "mysql_clear_password") == 0) {
874+
if (self->auth_plugin != Py_None &&
875+
strcmp(PyUnicode_AsUTF8(self->auth_plugin), "mysql_clear_password") == 0) {
875876
abool = 1;
876877
mysql_options(&self->session, MYSQL_ENABLE_CLEARTEXT_PLUGIN, (char *)&abool);
877878
}

0 commit comments

Comments
 (0)