ó
    ßÅŸg(1  ã                   óÜ   • S r S/rSSKrSSKJrJrJrJrJr  SSK	J
r
Jr  SSKJrJrJr  SSKJr  SS	KJrJrJr  SS
KJrJrJrJr  SSKJrJr  SSKJr  SSK J!r!J"r"  SSK#J$r$   " S S\5      rg)z,Implements the MySQL Client/Server protocol.ÚMySQLProtocolé    N)ÚAnyÚDictÚListÚOptionalÚTupleé   )Ú
ClientFlagÚ	ServerCmd)ÚInterfaceErrorÚProgrammingErrorÚget_exception)Úlogger)ÚDEFAULT_CHARSET_IDÚDEFAULT_MAX_ALLOWED_PACKETr   )ÚBinaryProtocolTypeÚDescriptionTypeÚEofPacketTypeÚHandShakeType)Úlc_intÚread_lc_string_listé   )ÚMySQLSocket)ÚMySQLAuthPluginÚget_auth_plugin)Ú"MySQLCachingSHA2PasswordAuthPluginc                    óÊ  • \ rS rSrSr\   S S\S\S\S\S	\\   S
\	S\\
\\4      S\\\4   4S jj5       r\S\S\SSSSSS4
S\S\S\S\\   S\S\S\S\\   S	\\   S\\
\\4      S\	S
\	S\\
\\4      S\\\4   4S jj5       r   S!S\S\\   S\S\S\\   S\\\\S4      \\   4   4S jjr  S"S\S\\S4   S\S\\   S\\\\\   S4      \\   4   4
S jjrSrg)#r   é4   zKImplements MySQL client/server protocol.

Create and parses MySQL packets.
NFÚ	auth_dataÚusernameÚpasswordÚauth_pluginÚauth_plugin_classÚssl_enabledÚplugin_configÚreturnc                 ó>  • U(       d  US:X  a  S[        XUS94$ Uc  0 n [        X45      " XUS9nUR                  " U 40 UD6nUc  [	        SUR
                   35      e[        [        U5      5      U-   nX‡4$ ! [        [        4 a  n	[	        SU	 35      U	eSn	A	ff = f)aß  Prepare the first authentication response.

Args:
    auth_data: Authorization data from initial handshake.
    username: Account's username.
    password: Account's password.
    client_flags: Integer representing client capabilities flags.
    auth_plugin: Authorization plugin name.
    auth_plugin_class: Authorization plugin class (has higher precedence
                       than the authorization plugin name).
    ssl_enabled: Whether SSL is enabled or not.
    plugin_config: 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:
    auth_response: Authorization plugin response.
    auth_strategy: Authorization plugin instance created based
                   on the provided `auth_plugin` and `auth_plugin_class`
                   parameters.

Raises:
    InterfaceError: If authentication fails or when got a NULL auth response.
Ú ó    )r$   NzFailed authentication: z8Got NULL auth response while authenticating with plugin )r   r   Úauth_responseÚ	TypeErrorr   Únamer   Úlen)
r   r    r!   r"   r#   r$   r%   Úauth_strategyr*   Úerrs
             Ú]/var/www/blue/EV-Temp_rev04/venv/lib/python3.13/site-packages/mysql/connector/aio/protocol.pyÚauth_plugin_first_responseÚ(MySQLProtocol.auth_plugin_first_response:   sß   € öD ˜K¨2Ó-àÔ>Ø°ñð ð ð Ñ ØˆMð	KÜ+¨KÔKØ°ñˆMð *×7Ò7¸	ÑSÀ]ÑSˆMð Ñ Ü ðØ'×,Ñ,Ð-ð/óð ô
 œs =Ó1Ó2°]ÑBˆàÐ+Ð+øô œ>Ð*ó 	KÜ Ð#:¸3¸%Ð!@ÓAÀsÐJûð	Kús    #A8 Á8BÂBÂBr   Ú	handshakeÚdatabaseÚcharsetÚclient_flagsÚmax_allowed_packetÚ
conn_attrsÚis_change_user_requestc           
      ó¤  • UR                  5       n/ nU
(       a  [        R                  " S5        [        R                  " S5        U c  [        S5      SeU R	                  S5      c  [        S5      Se U=(       d    U S   n[        R                  " S
U5        U
(       aC  UR                  [        R                  " S[        U5       S3[        R                  U5      5        O:SnUR                  [        R                  " SU [        U5       S3UUUU5      5        [        R                  U S   UUUUUUS9u  nnUR                  U5        UR                  [        R                  XS5      5        U
(       a&  UR                  [        R                  " SU5      5        U[         R"                  -  (       a"  UR                  UR                  5       S-   5        U[         R$                  -  (       a'  U	b$  UR                  [        R'                  U	5      5        SR)                  U5      U4$ ! [
        [        4 a  n[        SU S	35      SeSnAff = f)aÚ  Make a MySQL Authentication packet.

Args:
    handshake: Initial handshake.
    username: Account's username.
    password: Account's password.
    database: Initial database name for the connection
    charset: Client charset (see [2]), only the lower 8-bits.
    client_flags: Integer representing client capabilities flags.
    max_allowed_packet: Maximum packet size.
    auth_plugin: Authorization plugin name.
    auth_plugin_class: Authorization plugin class (has higher precedence
                       than the authorization plugin name).
    conn_attrs: Connection attributes.
    is_change_user_request: Whether is a `change user request` operation or not.
    ssl_enabled: Whether SSL is enabled or not.
    plugin_config: Custom configuration to be passed to the auth plugin
                   when invoked. The parameters defined here will override
                   the one defined in the auth plugin itself.

Returns:
    handshake_response: Handshake response as per [1].
    auth_strategy: Authorization plugin instance created based
                   on the provided `auth_plugin` and `auth_plugin_class`.

Raises:
    ProgrammingError: Handshake misses authentication info.

References:
    [1]: https://dev.mysql.com/doc/dev/mysql-server/latest/                page_protocol_connection_phase_packets_protocol_handshake_response.html

    [2]: https://dev.mysql.com/doc/dev/mysql-server/latest/                page_protocol_basic_character_set.html#a_protocol_character_set
zGot a `change user` requestzStarting authorization phaseNzGot a NULL handshaker   z$Handshake misses authentication infor"   z-Handshake misses authentication plugin info (Ú)z#The provided initial strategy is %sz<BÚsxÚxxxxxxxxxxxxxxxxxxxxxxxz<IIB)r   r    r!   r"   r#   r$   r%   z<Hr)   ó    )Úencoder   Údebugr   Úgetr+   ÚKeyErrorÚappendÚstructÚpackr-   r   ÚCHANGE_USERr   r1   Úconnect_with_dbr
   ÚPLUGIN_AUTHÚCONNECT_ARGSÚmake_conn_attrsÚjoin)r3   r    r!   r4   r5   r6   r7   r"   r#   r8   r9   r$   r%   Ú
b_usernameÚresponse_payloadr/   Úfillerr*   r.   s                      r0   Ú	make_authÚMySQLProtocol.make_authw   s*  € ðf —_‘_Ó&ˆ
ØÐæ!Ü�LŠLÐ6Ô7ä�ŠÐ3Ô4ØÑÜ"Ð#9Ó:ÀÐDà�=‰=˜Ó%Ñ-Ü"Ð#IÓJÐPTÐTð	Ø%×A¨°=Ñ)AˆKô 	�ŠÐ:¸KÔHæ!Ø×#Ñ#Ü—’Øœ˜Z›Ð)¨Ð,Ü×)Ñ)Øóõð ˆFØ×#Ñ#Ü—’Ø˜6˜(¤3 z£?Ð"3°2Ð6Ø Ø&ØØóôô (5×'OÑ'OØ Ñ,ØØØ#Ø/Ø#Ø'ð (Pð (
Ñ$ˆ�}ð 	×Ñ Ô.ð 	×Ñ¤× =Ñ =¸lÓ UÔVö "Ø×#Ñ#¤F§K¢K°°gÓ$>Ô?ð œ*×0Ñ0×0Ø×#Ñ# K×$6Ñ$6Ó$8¸7Ñ$BÔCð œ:×2Ñ2×2¸
Ñ8NØ×#Ñ#¤M×$AÑ$AÀ*Ó$MÔNà�x‰xÐ(Ó)¨=Ð8Ð8øôm œ8Ð$ó 	Ü"Ø?À¸uÀAÐFóàðûð	ús   Á4H* È*IÈ:I
É
IÚsockÚcolumnsÚcountÚread_timeout.c              ƒ   óL  #   • / nSnSnSn	 U(       d  X“:X  a   Xg4$ UR                  U5      I Sh  v•N n
U
S   S:X  a  U R                  U
5      nSnO U
S   S:X  a  SnU R                  X*SS U5      nUc  Ub  UR                  U5        OUc  Uc  [	        U
5      eU	S-  n	M–   Nq7f)zhRead MySQL binary protocol result.

Reads all or given number of binary resultset rows from the socket.
Nr   é   éþ   é   r   )ÚreadÚ	parse_eofÚ_parse_binary_valuesrC   r   )ÚselfrQ   rR   rS   r5   rT   ÚrowsÚeofÚvaluesÚiÚpackets              r0   Úread_binary_resultÚ MySQLProtocol.read_binary_resultò   sÉ   é € ð ˆØˆØˆØˆØÞ�a“jØð ˆ{Ðð  Ÿ9™9 \Ó2×2ˆFØ�a‰y˜CÓØ—n‘n VÓ,�Ø‘Ø˜‘˜a“Ø�Ø×2Ñ2°7À1À2¸JÈÓP�Ø‰{˜vÑ1Ø—‘˜FÕ#Ø‘ ¡Ü# FÓ+Ð+Ø�‰FˆAñ ñ 3ùs   ‚.B$°B"±A2B$Úversionc              ƒ   óà  #   • Un/ nSnSnSn	 U(       d  X“:X  a   Xg4$ UR                  U5      I Sh  v•N n
U
R                  S5      (       a©  U
SS /nUR                  U5      I Sh  v•N n
U
R                  S5      (       aE  UR                  U
SS 5        UR                  U5      I Sh  v•N n
U
R                  S5      (       a  ME  UR                  U
SS 5        [        SR	                  U5      5      nO?U
S   S:X  a  U
S   S:  a  U R                  U
5      nSnOSn[        [        U
SS 5      5      nUc  Ub  UR                  U5        OUc  Uc  [        U
5      eU	S-  n	GMX   GN4 GN NÁ7f)	z—Read MySQL text result.

Reads all or given number of rows from the socket.

Returns a tuple with 2 elements: a list with all rows and
the EOF packet.
Nr   s   ÿÿÿrV   r>   rW   é   r   )rY   Ú
startswithrC   r   rK   rZ   Úbytesr   )r\   rQ   rd   rS   rT   Ú_r]   r^   Úrowdatar`   ra   Údatass               r0   Úread_text_resultÚMySQLProtocol.read_text_result  sp  é € ð$ ˆØˆØˆØˆØˆØÞ�a“jØð* ˆyÐð)  Ÿ9™9 \Ó2×2ˆFØ× Ñ  ×1Ñ1Ø  ˜˜�Ø#Ÿy™y¨Ó6×6�Ø×'Ñ'¨×8Ñ8Ø—L‘L ¨¨ Ô,Ø#'§9¡9¨\Ó#:×:�Fð ×'Ñ'¨×8Ó8ð —‘˜V A B˜ZÔ(Ü-¨c¯h©h°u«oÓ>‘Ø˜‘˜cÓ! f¨Q¡i°!£mØ—n‘n VÓ,�Ø‘à�Ü-¬e°F¸1¸2°JÓ.?Ó@�Ø‰{˜wÑ2Ø—‘˜GÕ$Ø‘ ¡Ü# FÓ+Ð+Ø�‰FˆAò- ò 3ò 7ñ ;ùs;   ‚0E.²E&³4E.Á'E)Á(AE.Â*E,Â+E.ÃB E.Å)E.Å,E.© )NFN)r   zutf-8N)r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ústaticmethodrh   Ústrr   Úboolr   r   r   r   r1   r   r   r   ÚintrO   r   r   r   r   r   rb   rl   Ú__static_attributes__rn   r>   r0   r   r   4   sz  † ñð
 ð ,0Ø!Ø26ñ:,Øð:,àð:,ð ð:,ð ð	:,ð
 $ C™=ð:,ð ð:,ð    S¨# X¡Ñ/ð:,ð 
ˆu�oÐ%Ñ	&ô:,ó ð:,ðx ð
 #'Ø)ØØ"<Ø%)Ø+/Ø/3Ø',Ø!Ø26ñw9Ø ðw9àðw9ð ðw9ð ˜3‘-ð	w9ð
 ðw9ð ðw9ð  ðw9ð ˜c‘]ðw9ð $ C™=ðw9ð ˜T # s (™^Ñ,ðw9ð !%ðw9ð ðw9ð    S¨# X¡Ñ/ðw9ð 
ˆu�oÐ%Ñ	&ôw9ó ðw9ð| ØØ&*ñ"àð"ð �oÑ&ð"ð ð	"ð
 ð"ð ˜s‘mð"ð 
ØˆUÐ% sÐ*Ñ+Ñ,Ø�Ñð	!ñ
õ"ðR Ø&*ñ.àð.ð �s˜C�x‘ð.ð ð	.ð
 ˜s‘mð.ð 
ØˆU�8˜E‘? CÐ'Ñ(Ñ)Ø�Ñð	!ñ
÷.ð .r>   )%rs   Ú__all__rD   Útypingr   r   r   r   r   Ú	constantsr
   r   Úerrorsr   r   r   r   Úprotocolr   r   r   Ú_MySQLProtocolÚtypesr   r   r   r   Úutilsr   r   Únetworkr   Úpluginsr   r   Úplugins.caching_sha2_passwordr   rn   r>   r0   Ú<module>r„      sT   ðñ: 3àÐ
€ã ç 3Õ 3ç -ß DÑ DÝ ÷ñ ÷
 VÓ Uß /Ý  ß 5Ý MôQ�Nõ Qr>   