[CONPY-127] Let the connector accept None passwords. Created: 2020-11-10  Updated: 2020-11-16  Resolved: 2020-11-16

Status: Closed
Project: MariaDB Connector/Python
Component/s: Generic
Affects Version/s: 1.0.4
Fix Version/s: 1.0.5

Type: Bug Priority: Critical
Reporter: Frank Assignee: Georg Richter
Resolution: Fixed Votes: 0
Labels: None
Environment:

MariaDB 10.5
Python 3.6
CentOS 7.8



 Description   

When migrating from the mysql to the mariadb connector, I found out, that when using the socket user identification from 10.5 the password is not ignored.
So an extra if block is needed to connect to the server.
using the mysql connector, this code will work:

db_connection = db_connector.connect(user="root", password=root_pw, unix_socket=socket_path,database="mysql")

But for the mariadb connector it must changed to:

if root_pw:
                        db_connection = db_connector.connect(user="root", password=root_pw, unix_socket=socket_path, database="mysql")
else:
                        db_connection = db_connector.connect(user="root",unix_socket=socket_path, database="mysql")

When connect via socket auth, the password will be None, because it is not needed. But the mariadb python module can't handle it. The connect will fail with:

TypeError: connect() argument  4 must be str, not None



 Comments   
Comment by Georg Richter [ 2020-11-16 ]

Fixed in rev. acf9f9190ee7f358f557c15670197599ec0c57b8

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