Bug #80609 Cleartext auth issue with connector python
Submitted: 3 Mar 2016 18:35 Modified: 15 Jul 2016 15:58
Reporter: Daniël van Eeden (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / Python Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: CPU Architecture:Any
Tags: Contribution

[3 Mar 2016 18:35] Daniël van Eeden
Description:
Using pam and cleartext can lead to this:

Traceback (most recent call last):
  File "pamtest.py", line 60, in <module>
    main()
  File "pamtest.py", line 22, in main
    test_connector(opts)
  File "pamtest.py", line 55, in test_connector
    conn = mysql.connect(option_files=['/home/dennis/odbc-test/.my.cnf'])
  File "/usr/lib/python2.7/dist-packages/mysql/connector/__init__.py", line 143, in connect
    return connect(**new_config)
  File "/usr/lib/python2.7/dist-packages/mysql/connector/__init__.py", line 179, in connect
    return MySQLConnection(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/mysql/connector/connection.py", line 95, in __init__
    self.connect(**kwargs)
  File "/usr/lib/python2.7/dist-packages/mysql/connector/abstracts.py", line 719, in connect
    self._open_connection()
  File "/usr/lib/python2.7/dist-packages/mysql/connector/connection.py", line 210, in _open_connection
    self._ssl)
  File "/usr/lib/python2.7/dist-packages/mysql/connector/connection.py", line 144, in _do_auth
    self._auth_switch_request(username, password)
  File "/usr/lib/python2.7/dist-packages/mysql/connector/connection.py", line 166, in _auth_switch_request
    auth_data) = self._protocol.parse_auth_switch_request(packet)
  File "/usr/lib/python2.7/dist-packages/mysql/connector/protocol.py", line 714, in parse_auth_switch_request
    if packet[-1] == 0:

How to repeat:
See description

Suggested fix:
apply the attached patch
[3 Mar 2016 18:35] Daniël van Eeden
patch

(*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: connpy_cleartext_pam.patch (text/x-patch), 544 bytes.

[4 Mar 2016 6:13] MySQL Verification Team
Hello Daniël,

Thank you for the report and contribution.

Thanks,
Umesh
[15 Jul 2016 15:58] Paul Dubois
Posted by developer:
 
Noted in 2.1.4 changelog.

Connector/Python failed to establish connections using the cleartext
client-side authentication plugin for accounts using the PAM
server-side authentication plugin. Thanks to Daniël van Eeden for
the patch.