Skip to content

AttributeError: 'Connection' object has no attribute 'ssl' in sha256_password auth branch #147

@shychee

Description

@shychee

Bug Description

In asyncmy/connection.pyx, the _request_authentication method still references self.ssl in the sha256_password branch (line 825), but PR #102 renamed self.ssl to self._ssl_context everywhere else.

This causes an AttributeError when connecting to a MySQL-compatible database that uses sha256_password authentication plugin.

How to Reproduce

  1. Connect to a MySQL-compatible database (e.g. Huawei GaussDB) that uses sha256_password as the default auth plugin
  2. Do not use SSL (ssl=None)
  3. The connection fails with:
AttributeError: 'Connection' object has no attribute 'ssl'

Root Cause

PR #102 renamed self.ssl to self._ssl_context in __init__ and most of _request_authentication, but missed one reference in the sha256_password branch:

# connection.pyx line 825 (current, buggy)
if self.ssl and self.server_capabilities & SSL:

Should be:

# fix
if self._ssl_context and self.server_capabilities & SSL:

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions