§
    >Ä³g(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dS )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                    óV  — 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dS )#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                 ój  — |s|dk    rdt          |||¬¦  «        fS |€i }	  t          ||¦  «        |||¬¦  «        } |j        | fi |¤Ž}n,# t          t          f$ r}	t	          d|	› �¦  «        |	‚d}	~	ww xY w|€t	          d|j        › �¦  «        ‚t          t          |¦  «        ¦  «        |z   }||fS )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
             úZ/var/www/html/mpstechhub/venv/lib/python3.11/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ÔKØ˜(°ðñ ô ˆMð 8˜MÔ7¸	ÐSÐSÀ]ÐSÐSˆMˆMøÝ�>Ð*ð 	Kð 	Kð 	KÝ Ð!@¸3Ð!@Ð!@ÑAÔAÀsÐJøøøøð	Køøøð Ð Ý ð/Ø'Ô,ð/ð /ñô ð õ
 �s =Ñ1Ô1Ñ2Ô2°]ÑBˆà˜mÐ+Ð+s   ¢*A ÁA6ÁA1Á1A6r   Ú	handshakeÚdatabaseÚcharsetÚclient_flagsÚmax_allowed_packetÚ
conn_attrsÚis_change_user_requestc           	      óä  — |                      ¦   «         }g }|
rt          j        d¦  «         t          j        d¦  «         | €t          d¦  «        d‚|                      d¦  «        €t          d¦  «        d‚	 |p| d         }n-# t
          t          f$ r}t          d|› d	�¦  «        d‚d}~ww xY wt          j        d
|¦  «         |
rE|                     t          j	        dt          |¦  «        › d�t          j        |¦  «        ¦  «         n@d}|                     t          j	        d|› t          |¦  «        › d�||||¦  «        ¦  «         t                               | d         ||||||¬¦  «        \  }}|                     |¦  «         |                     t                               ||¦  «        ¦  «         |
r(|                     t          j	        d|¦  «        ¦  «         |t           j        z  r*|                     |                      ¦   «         dz   ¦  «         |t           j        z  r/|	�-|                     t                               |	¦  «        ¦  «         d                     |¦  «        |fS )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 —_’_Ñ&Ô&ˆ
ØÐà!ð 	8ÝŒLÐ6Ñ7Ô7Ð7åŒÐ3Ñ4Ô4Ð4ØÐÝ"Ð#9Ñ:Ô:ÀÐDà�=Š=˜Ñ%Ô%Ð-Ý"Ð#IÑJÔJÐPTÐTð	Ø%ÐA¨°=Ô)AˆKˆKøÝ�8Ð$ð 	ð 	ð 	Ý"ØFÀÐFÐFÐFñô àðøøøøð	øøøõ
 	ŒÐ:¸KÑHÔHÐHà!ð 	Ø×#Ò#Ý”Ø,�˜Z™œÐ,Ð,Ð,ÝÔ)Øñô ñô ð ð ð ˆFØ×#Ò#Ý”Ø6˜6Ð6¥3 z¡?¤?Ð6Ð6Ð6Ø Ø&ØØñô ñô ð õ (5×'OÒ'OØ Ô,ØØØ#Ø/Ø#Ø'ð (Pñ (
ô (
Ñ$ˆ�}ð 	×Ò Ñ.Ô.Ð.ð 	×Ò¥× =Ò =¸lÈHÑ UÔ UÑVÔVÐVð "ð 	@Ø×#Ò#¥F¤K°°gÑ$>Ô$>Ñ?Ô?Ð?ð �*Ô0Ñ0ð 	DØ×#Ò# K×$6Ò$6Ñ$8Ô$8¸7Ñ$BÑCÔCÐCð �:Ô2Ñ2ð 	O¸
Ð8NØ×#Ò#¥M×$AÒ$AÀ*Ñ$MÔ$MÑNÔNÐNà�xŠxÐ(Ñ)Ô)¨=Ð8Ð8s   Á9
B ÂB.ÂB)Â)B.r   úutf-8ÚsockÚcolumnsÚcountÚread_timeout.c              ƒ   óp  K  — g }d}d}d}		 |s|	|k    rnŸ|                      |¦  «        ƒ d{V —†}
|
d         dk    r|                      |
¦  «        }d}n-|
d         dk    r!d}|                      ||
dd…         |¦  «        }|€|�|                     |¦  «         n|€|€t	          |
¦  «        ‚|	dz  }	Œ¨||fS )zxRead MySQL binary protocol result.

        Reads all or given number of binary resultset rows from the socket.
        Nr   Té   éþ   é   r   )ÚreadÚ	parse_eofÚ_parse_binary_valuesrA   r   )ÚselfrO   rP   rQ   r3   rR   ÚrowsÚeofÚvaluesÚiÚpackets              r/   Úread_binary_resultz MySQLProtocol.read_binary_resultò   sÿ   è è € ð ˆØˆØˆØˆð	Øð �a˜5’j�jØØŸ9š9 \Ñ2Ô2Ð2Ð2Ð2Ð2Ð2Ð2ˆFØ�aŒy˜CÒÐØ—n’n VÑ,Ô,�Ø��Ø˜”˜a’�Ø�Ø×2Ò2°7¸FÀ1À2À2¼JÈÑPÔP�Øˆ{˜vÐ1Ø—’˜FÑ#Ô#Ð#Ð#Ø�  Ý# FÑ+Ô+Ð+Ø�‰FˆAð	ð �cˆ{Ðr<   Úversionc              ƒ   ó<  K  — |}g }d}d}d}		 |s|	|k    r�n‚|                      |¦  «        ƒ d{V —†}
|
                     d¦  «        rÈ|
dd…         g}|                      |¦  «        ƒ d{V —†}
|
                     d¦  «        rM|                     |
dd…         ¦  «         |                      |¦  «        ƒ d{V —†}
|
                     d¦  «        °M|                     |
dd…         ¦  «         t          d                     |¦  «        ¦  «        }nV|
d         dk    r$|
d         dk     r|                      |
¦  «        }d}n&d}t          t          |
dd…         ¦  «        ¦  «        }|€|�|                     |¦  «         n|€|€t          |
¦  «        ‚|	d	z  }	�ŒŒ||fS )
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   Ts   ÿÿÿrT   r<   rU   é   r   )rW   Ú
startswithrA   r   rI   rX   Úbytesr   )rZ   rO   ra   rQ   rR   Ú_r[   r\   Úrowdatar^   r_   Údatass               r/   Úread_text_resultzMySQLProtocol.read_text_result  sê  è è € ð$ ˆØˆØˆØˆØˆð	Øð �a˜5’j�jÙØŸ9š9 \Ñ2Ô2Ð2Ð2Ð2Ð2Ð2Ð2ˆFØ× Ò  Ñ1Ô1ð AØ   œ˜�Ø#Ÿyšy¨Ñ6Ô6Ð6Ð6Ð6Ð6Ð6Ð6�Ø×'Ò'¨Ñ8Ô8ð ;Ø—L’L ¨¨¨¤Ñ,Ô,Ð,Ø#'§9¢9¨\Ñ#:Ô#:Ð:Ð:Ð:Ð:Ð:Ð:�Fð ×'Ò'¨Ñ8Ô8ð ;ð —’˜V A B BœZÑ(Ô(Ð(Ý-¨c¯hªh°u©o¬oÑ>Ô>��Ø˜”˜cÒ!Ð! f¨Q¤i°!¢m mØ—n’n VÑ,Ô,�Ø��à�Ý-­e°F¸1¸2¸2´JÑ.?Ô.?Ñ@Ô@�Øˆ{˜wÐ2Ø—’˜GÑ$Ô$Ð$Ð$Ø�  Ý# FÑ+Ô+Ð+Ø�‰FˆAñ-	ð. �SˆyÐr<   )NFN)r   rN   N)r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ústaticmethodre   Ústrr   Úboolr   r   r   r   r0   r   r   r   ÚintrM   r   r   r   r   r   r`   ri   © r<   r/   r   r   4   sÙ  € € € € € ðð ð
 ð ,0Ø!Ø26ð:,ð :,Øð:,àð:,ð ð:,ð ð	:,ð
 $ Cœ=ð:,ð ð:,ð    S¨# X¤Ô/ð:,ð 
ˆu�oÐ%Ô	&ð:,ð :,ð :,ñ „\ð:,ðx ð
 #'Ø)ØØ"<Ø%)Ø+/Ø/3Ø',Ø!Ø26ðw9ð 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ð w9ñ „\ðw9ð| ØØ&*ð"ð "àð"ð �oÔ&ð"ð ð	"ð
 ð"ð ˜s”mð"ð 
ØˆUÐ% sÐ*Ô+Ô,Ø�Ôð	!ô
ð"ð "ð "ð "ðR Ø&*ð.ð .àð.ð �s˜C�x”ð.ð ð	.ð
 ˜s”mð.ð 
ØˆU�8˜E”? CÐ'Ô(Ô)Ø�Ôð	!ô
ð.ð .ð .ð .ð .ð .r<   )%rm   Ú__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   rr   r<   r/   ú<module>r~      s{  ðð: 3Ð 2àÐ
€à €€€à 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3à -Ð -Ð -Ð -Ð -Ð -Ð -Ð -Ø DÐ DÐ DÐ DÐ DÐ DÐ DÐ DÐ DÐ DØ Ð Ð Ð Ð Ð ðð ð ð ð ð ð ð ð ð ð
 VÐ UÐ UÐ UÐ UÐ UÐ UÐ UÐ UÐ UÐ UÐ UØ /Ð /Ð /Ð /Ð /Ð /Ð /Ð /Ø  Ð  Ð  Ð  Ð  Ð  Ø 5Ð 5Ð 5Ð 5Ð 5Ð 5Ð 5Ð 5Ø MÐ MÐ MÐ MÐ MÐ MðQð Qð Qð Qð Q�Nñ Qô Qð Qð Qð Qr<   