HEX
Server: Apache
System: Linux 185.122.168.184.host.secureserver.net 5.14.0-570.60.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Nov 5 05:00:59 EST 2025 x86_64
User: barbeatleanalyti (1024)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //var/opt/nydus/ops/mysql/connector/aio/plugins/__pycache__/mysql_native_password.cpython-39.pyc
a

�,�h��@sxdZddlZddlmZddlmZmZmZddlm	Z	ddl
mZddlm
Z
er`d	d
lmZdZGdd�de
�ZdS)
z&Native Password Authentication Plugin.�N)�sha1)�
TYPE_CHECKING�Any�Optional)�InterfaceError)�logger�)�MySQLAuthPlugin�)�MySQLSocket�MySQLNativePasswordAuthPluginc@sneZdZdZeed�dd�Zeed�dd��Zee	d�dd	��Z
eeeed
�dd�Z
d
eeed�dd�ZdS)rzBClass implementing the MySQL Native Password authentication plugin)�	auth_data�returnc
Cs�|std��|jsdSd}zXt|j�����}t|���}t||���}dd�t||�D�}tjdg|�R�}Wn:tjt	fy�}ztd|���|�WYd}~n
d}~00|S)z;Prepares and returns password as native MySQL 4.1+ passwordz"Missing authentication data (seed)�NcSsg|]\}}||A�qS�r)�.0�h1�h3rr�d/opt/nydus/tmp/pip-target-wkfpz8uv/lib64/python/mysql/connector/aio/plugins/mysql_native_password.py�
<listcomp>?rzCMySQLNativePasswordAuthPlugin._prepare_password.<locals>.<listcomp>Z20BzFailed scrambling password; )
rZ	_passwordr�encode�digest�zip�struct�pack�error�	TypeError)�selfr
Zhash4Zhash1Zhash2Zhash3Zxored�errrrr�_prepare_password2s&z/MySQLNativePasswordAuthPlugin._prepare_password)rcCsdS)zPlugin official name.Zmysql_native_passwordr�rrrr�nameFsz"MySQLNativePasswordAuthPlugin.namecCsdS)z'Signals whether or not SSL is required.Frr rrr�requires_sslKsz*MySQLNativePasswordAuthPlugin.requires_ssl)r
�kwargsrcKs
|�|�S)a�Make the client's authorization response.

        Args:
            auth_data: Authorization data.
            kwargs: Custom configuration to be passed to the auth plugin
                    when invoked. The parameters defined here will override the ones
                    defined in the auth plugin itself.

        Returns:
            packet: Client's authorization response.
        )r)rr
r#rrr�
auth_responsePsz+MySQLNativePasswordAuthPlugin.auth_responser)�sockr
r#rc�sf|j|fi|��}|dur"td��t�d|t|��|�|�IdHt|��IdH�}t�d|�|S)aSHandles server's `auth switch request` response.

        Args:
            sock: Pointer to the socket connection.
            auth_data: Plugin provided data (extracted from a packet
                       representing an `auth switch request` response).
            kwargs: Custom configuration to be passed to the auth plugin
                    when invoked. The parameters defined here will override the ones
                    defined in the auth plugin itself.

        Returns:
            packet: Last server's response after back-and-forth
                    communication.
        NzGot a NULL auth responsez# request: %s size: %sz# server response packet: %s)r$rr�debug�len�write�bytes�read)rr%r
r#�responseZpktrrr�auth_switch_response^sz2MySQLNativePasswordAuthPlugin.auth_switch_responseN)�__name__�
__module__�__qualname__�__doc__r)r�property�strr!�boolr"rrr$r,rrrrr/s�)r0r�hashlibr�typingrrrZmysql.connector.errorsrZmysql.connector.loggerr�r	�networkrZAUTHENTICATION_PLUGIN_CLASSrrrrr�<module>s