Ë
    5¾ªj(1  ã                   óÜ   — d Z dgZddlZddlmZmZmZmZmZ ddl	m
Z
mZ ddlmZmZmZ ddlmZ dd	lmZmZmZ dd
lmZmZmZmZ ddlmZmZ ddlmZ ddl m!Z!m"Z" ddl#m$Z$  G d„ de«      Zy)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                    ó²  — e Zd ZdZe	 	 	 ddededededee   d	ed
ee	ee
f      deeef   fd„«       Zedededdddddf
dedededee   dedededee   dee   dee	eef      ded	ed
ee	ee
f      deeef   fd„«       Z	 	 	 ddedee   dededee   deeeedf      ee   f   fd„Z	 	 d dedeedf   dedee   deeeee   df      ee   f   f
d„Zy)!r   zSImplements MySQL client/server protocol.

    Create and parses MySQL packets.
    NFÚ	auth_dataÚusernameÚpasswordÚauth_pluginÚauth_plugin_classÚssl_enabledÚplugin_configÚreturnc                 ó@  — |s|dk(  rdt        |||¬«      fS |€i }	  t        ||«      |||¬«      } |j                  | fi |¤Ž}|€t	        d|j
                  › �«      ‚t        t        |«      «      |z   }||fS # t        t        f$ r}	t	        d|	› �«      |	‚d}	~	ww xY w)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/html/serviGia/entorno/lib/python3.12/site-packages/mysql/connector/aio/protocol.pyÚauth_plugin_first_responsez(MySQLProtocol.auth_plugin_first_response:   sì   € ñD ˜K¨2Ò-àÔ>Ø˜(°ôð ð ð Ð ØˆMð	KØKœO¨KÐ9JÓKØ˜(°ôˆMð 8˜M×7Ñ7¸	ÑSÀ]ÑSˆMð Ð Ü ðØ'×,Ñ,Ð-ð/óð ô
 œs =Ó1Ó2°]ÑBˆà˜mÐ+Ð+øô œ>Ð*ò 	KÜ Ð#:¸3¸%Ð!@ÓAÀsÐJûð	Kús   �(A: Á:BÂ	BÂBr   Ú	handshakeÚdatabaseÚcharsetÚclient_flagsÚmax_allowed_packetÚ
conn_attrsÚis_change_user_requestc           	      ó\  — |j                  «       }g }|
rt        j                  d«       t        j                  d«       | €t        d«      d‚| j	                  d«      €t        d«      d‚	 |xs | d   }t        j                  d
|«       |
rB|j                  t        j                  dt        |«      › d�t        j                  |«      «       n9d}|j                  t        j                  d|› t        |«      › d�||||«      «       t        j                  | d   ||||||¬«      \  }}|j                  |«       |j                  t        j                  ||«      «       |
r%|j                  t        j                  d|«      «       |t         j"                  z  r"|j                  |j                  «       dz   «       |t         j$                  z  r&|	�$|j                  t        j'                  |	«      «       dj)                  |«      |fS # t
        t        f$ r}t        d|› d	�«      d‚d}~ww xY w)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   r0   Úconnect_with_dbr
   ÚPLUGIN_AUTHÚCONNECT_ARGSÚmake_conn_attrsÚjoin)r1   r   r    r2   r3   r4   r5   r!   r"   r6   r7   r#   r$   Ú
b_usernameÚresponse_payloadr.   Úfillerr)   r-   s                      r/   Ú	make_authz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ÈHÓ 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   Á+	H ÈH+ÈH&È&H+ÚsockÚcolumnsÚcountÚread_timeout.c              ƒ   ó8  K  — g }d}d}d}		 |s|	|k(  r	 ||fS |j                  |«      ƒ d{  –—† }
|
d   dk(  r| j                  |
«      }d}n |
d   dk(  rd}| j                  ||
dd |«      }|€|�|j                  |«       n|€|€t	        |
«      ‚|	dz  }	ŒŒ7 Œk­w)zxRead MySQL binary protocol result.

        Reads all or given number of binary resultset rows from the socket.
        Nr   é   éþ   é   r   )ÚreadÚ	parse_eofÚ_parse_binary_valuesrA   r   )ÚselfrN   rO   rP   r3   rQ   ÚrowsÚeofÚvaluesÚiÚpackets              r/   Úread_binary_resultz MySQLProtocol.read_binary_resultò   sÐ   è ø€ ð ˆØˆØˆØˆØÙ�a˜5’jØð �cˆ{Ðð  Ÿ9™9 \Ó2×2ˆFØ�a‰y˜CÒØ—n‘n VÓ,�Ø‘Ø˜‘˜a’Ø�Ø×2Ñ2°7¸FÀ1À2¸JÈÓP�Øˆ{˜vÐ1Ø—‘˜FÕ#Ø�  Ü# FÓ+Ð+Ø�‰FˆAð ð 3ús   ‚*B¬B­A,BÚversionc              ƒ   ó¨  K  — |}g }d}d}d}		 |s|	|k(  r	 ||fS |j                  |«      ƒ d{  –—† }
|
j                  d«      rž|
dd g}|j                  |«      ƒ d{  –—† }
|
j                  d«      r?|j                  |
dd «       |j                  |«      ƒ d{  –—† }
|
j                  d«      rŒ?|j                  |
dd «       t        dj	                  |«      «      }n=|
d   dk(  r|
d   dk  r| j                  |
«      }d}nd}t        t        |
dd «      «      }|€|�|j                  |«       n|€|€t        |
«      ‚|	dz  }	�Œ=7 �Œ7 Œï7 Œ³­w)	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   ÿÿÿrS   r<   rT   é   r   )rV   Ú
startswithrA   r   rI   rW   Úbytesr   )rY   rN   r`   rP   rQ   Ú_rZ   r[   Úrowdatar]   r^   Údatass               r/   Úread_text_resultzMySQLProtocol.read_text_result  sn  è ø€ ð$ ˆØˆØˆØˆØˆØÙ�a˜5’jØð* �SˆyÐð)  Ÿ9™9 \Ó2×2ˆFØ× Ñ  Ô1Ø  ˜˜�Ø#Ÿy™y¨Ó6×6�Ø×'Ñ'¨Ô8Ø—L‘L ¨¨ Ô,Ø#'§9¡9¨\Ó#:×:�Fð ×'Ñ'¨Õ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:   ‚,E®E¯/EÁEÁ=EÂEÂEÂ3BEÅEÅE)NFN)r   zutf-8N)r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ústaticmethodrd   Ústrr   Úboolr   r   r   r   r0   r   r   r   ÚintrM   r   r   r   r   r   r_   rh   © r<   r/   r   r   4   su  „ ñð
 ð ,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<   )%rl   Ú__all__rB   Ú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   rq   r<   r/   ú<module>r}      sT   ðñ: 3àÐ
€ã ç 3Õ 3ç -ß DÑ DÝ ÷ñ ÷
 VÓ Uß /Ý  ß 5Ý MôQ�Nõ Qr<   