Ë
    Q5ýj>  ã                   ó   — d dl mZ d dlmZmZ d dlZd dlZd dlZd dl	Zd dl
Zd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZ G d„ dej(                  j*                  «      Z G d„ dej(                  j.                  «      Z G d„ d	ej(                  j*                  «      Z G d
„ d«      Zd dddddddej6                  j8                  f	dej:                  j<                  dedz  dee z  dz  dedz  dedz  dedz  de!ejD                  jF                     dz  dedejH                  jJ                  dz  dejH                  jJ                  e&z  de'ejP                  jR                  edz  f   fd„Z*dejP                  jV                  dedz  fd„Z,y)é    )ÚCallable)ÚAnyÚcastNc                   ó"   ‡ — e Zd ZdZˆ fd„Zˆ xZS )ÚTransferErrorz.A zone transfer response got a non-zero rcode.c                 óv   •— dt         j                  j                  |«      › �}t        ‰| �  |«       || _        y )NzZone transfer error: )ÚdnsÚrcodeÚto_textÚsuperÚ__init__)Úselfr
   ÚmessageÚ	__class__s      €úA/root/telegram-saas/.venv/lib/python3.12/site-packages/dns/xfr.pyr   zTransferError.__init__(   s3   ø€ Ø)¬#¯)©)×*;Ñ*;¸EÓ*BÐ)CÐDˆÜ‰Ñ˜Ô!Øˆ�
ó    )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Ú__classcell__)r   s   @r   r   r   %   s   ø„ Ù8÷ð r   r   c                   ó   — e Zd ZdZy)ÚSerialWentBackwardsz:The current serial number is less than the serial we know.N©r   r   r   r   © r   r   r   r   .   s   „ ÚDr   r   c                   ó   — e Zd ZdZy)ÚUseTCPz'This IXFR cannot be completed with UDP.Nr   r   r   r   r   r   2   s   „ Ú1r   r   c                   óp  — e Zd ZdZej
                  j                  ddddfdej                  j                  dej
                  j                  de
dz  ded	ed
eej                  j                  gdf   dz  fd„Zdej                  j                   ddfd„Zdej                  j                   defd„Zd„ Zd„ Zy)ÚInboundz+
    State machine for zone transfers.
    NFTÚtxn_managerÚrdtypeÚserialÚis_udpÚraise_on_serial_went_backwardsÚtransaction_setupc                 óÌ  — || _         d| _        || _        |t        j                  j
                  k(  r|€t        d«      ‚d| _        n=|t        j                  j                  k(  r|rt        d«      ‚d| _        nt        d«      ‚|| _	        || _
        |j                  «       \  }}}|€t        d«      ‚|| _        d| _        d| _        d| _        d| _        || _        || _        y)aÙ  Initialize an inbound zone transfer.

        *txn_manager* is a :py:class:`dns.transaction.TransactionManager`.

        *rdtype* can be `dns.rdatatype.AXFR` or `dns.rdatatype.IXFR`

        *serial* is the base serial number for IXFRs, and is required in
        that case.

        :param is_udp: Whether UDP is being used for this XFR.
        :type is_udp: bool

        :param transaction_setup: If not ``None``, call the object's setup()
            method with the just-created writer transaction.  This lets the caller
            alter the transaction's configuration before it is used, for example adding
            checking policies.
        :type transaction_setup: None or dns.transaction.TransactionSetup
        Nz,a starting serial must be supplied for IXFRsTzis_udp specified for AXFRFzrdtype is not IXFR or AXFRz2transaction manager must supply an origin for XFRs)r    Útxnr!   r	   Ú	rdatatypeÚIXFRÚ
ValueErrorÚincrementalÚAXFRr"   r#   Úorigin_informationÚoriginÚsoa_rdatasetÚdoneÚexpecting_SOAÚdelete_moder$   r%   )	r   r    r!   r"   r#   r$   r%   Ú_r.   s	            r   r   zInbound.__init__;   sã   € ð6 'ˆÔØ7;ˆŒØˆŒØ”S—]‘]×'Ñ'Ò'Øˆ~Ü Ð!OÓPÐPØ#ˆDÕØ”s—}‘}×)Ñ)Ò)ÙÜ Ð!<Ó=Ð=Ø$ˆDÕäÐ9Ó:Ð:ØˆŒØˆŒØ"×5Ñ5Ó7‰ˆˆ1ˆfØˆ>ÜÐQÓRÐRØˆŒØ:>ˆÔØˆŒ	Ø"ˆÔØ ˆÔØ.LˆÔ+Ø!2ˆÕr   r   Úreturnc                 ót   — |j                   r,|j                  st        j                  j	                  d«      ‚y y )Nzmissing TSIG)Úrequest_macÚhad_tsigr	   Ú	exceptionÚ	FormError)r   r   s     r   Ú_check_tsigzInbound._check_tsigp   s2   € ð
 ×Ò w×'7Ò'7Ü—-‘-×)Ñ)¨.Ó9Ð9ð (8Ðr   c                 ó  — | j                   €R| j                  j                  | j                   «      | _         | j                  �| j	                  | j                   «       |j                  «       }|t        j
                  j                  k7  rt        |«      ‚t        |j                  «      dkD  rŠ|j                  d   j                  | j                  k7  rt        j                  j                  d«      ‚|j                  d   j                  | j                  k7  rt        j                  j                  d«      ‚d}| j                   �€Ô| j#                  |«       |j$                  r&|j$                  d   j                  | j                  k7  rt        j                  j                  d«      ‚|j$                  d   }|}|j                  t        j&                  j(                  k7  rt        j                  j                  d«      ‚d}|j+                  «       | _        | j                  rø| j                   €J ‚t-        t        j.                  j0                  j(                  j(                  | j                   d   «      }|j2                  | j2                  k(  rd| _        n„t        j2                  j7                  |j2                  «      | j2                  k  r| j8                  rt:        ‚d| _        n4| j<                  r!t        |j$                  |d «      dk(  rt>        ‚d| _         |j$                  |d D �]�  }|j                  }|}| j4                  rt        j                  j                  d	«      ‚| j                   €J ‚|j                  t        j&                  j(                  k(  �r8|| j                  k(  �r(| j                  r| jB                   | _!        || j                   k(  �r| j                  r| jB                  �r t-        t        j.                  j0                  j(                  j(                  |d   «      }| j@                  rt        j                  j                  d
«      ‚| j                  r8| j2                  |j2                  k7  rt        j                  j                  d«      ‚| j#                  |«       | j                   jE                  ||«       | j                   jG                  «        d| _         d| _        nßd| _         t-        t        j.                  j0                  j(                  j(                  |d   «      }| j                  rr| jB                  r8|j2                  | j2                  k7  rlt        j                  j                  d«      ‚|j2                  | _        | j                   jE                  ||«       nt        j                  j                  d«      ‚�Œ«| j@                  rvd| _        d| _         d| _!        | j                   jI                  «        | j                  j                  d«      | _         | j                  �| j	                  | j                   «       |jK                  | j                  «      s�ŒJ| jB                  r| j                   jM                  ||«       �Œt| j                   jO                  ||«       �Œ’ | j<                  r+| j4                  st        j                  j                  d«      ‚| j4                  S )a8  Process one message in the transfer.

        The message should have the same relativization as was specified when
        the `dns.xfr.Inbound` was created.  The message should also have been
        created with `one_rr_per_rrset=True` because order matters.

        If the request was TSIG-signed, i.e. the message was parsed with a
        nonempty *request_mac*, then the first and the last message of the
        transfer must have a TSIG, and nothing is committed otherwise.

        Returns `True` if the transfer is complete, and `False` otherwise.
        Nr   zwrong question namezwrong question rdatatypez&No answer or RRset not for zone originzfirst RRset is not an SOAé   Tzanswers after final SOAzempty IXFR sequencezunexpected end of IXFR sequenceFzIXFR base serial mismatchzunexpected origin SOA in AXFRzunexpected end of UDP IXFR)(r'   r    Úwriterr+   r%   r
   r	   ÚNOERRORr   ÚlenÚquestionÚnamer.   r8   r9   r!   r/   r:   Úanswerr(   ÚSOAÚcopyr   ÚrdtypesÚANYr"   r0   ÚSerialr$   r   r#   r   r1   r2   ÚreplaceÚcommitÚrollbackÚis_subdomainÚdelete_exactÚadd)r   r   r
   Úanswer_indexÚrrsetÚrdatasetÚsoarA   s           r   Úprocess_messagezInbound.process_messagex   sM  € ð �8‰8ÐØ×'Ñ'×.Ñ.°4×3CÑ3CÐ/CÓDˆDŒHØ×%Ñ%Ð1Ø×&Ñ& t§x¡xÔ0Ø—‘“ˆØ”C—I‘I×%Ñ%Ò%Ü Ó&Ð&ô
 ˆw×ÑÓ  1Ò$Ø×Ñ Ñ"×'Ñ'¨4¯;©;Ò6Ü—m‘m×-Ñ-Ð.CÓDÐDØ×Ñ Ñ"×)Ñ)¨T¯[©[Ò8Ü—m‘m×-Ñ-Ð.HÓIÐIØˆØ×ÑÑ$ð
 ×Ñ˜WÔ%Ø—>’> W§^¡^°AÑ%6×%;Ñ%;¸t¿{¹{Ò%JÜ—m‘m×-Ñ-Ð.VÓWÐWØ—N‘N 1Ñ%ˆEØˆHØ�‰¤#§-¡-×"3Ñ"3Ò3Ü—m‘m×-Ñ-Ð.IÓJÐJØˆLØ (§¡£ˆDÔØ×ÒØ×(Ñ(Ð4Ð4Ð4Üœ3Ÿ;™;Ÿ?™?×.Ñ.×2Ñ2°D×4EÑ4EÀaÑ4HÓI�Ø—:‘: §¡Ò,ð !%�D•IÜ—Z‘Z×&Ñ& s§z¡zÓ2°T·[±[Ò@à×:Ò:Ü1Ð1Ø $�D•Ià—{’{¤s¨7¯>©>¸,¸-Ð+HÓ'IÈQÒ'Nô
 %˜ð
 *.�DÔ&ð
 —^‘^ L MÐ2ó S	-ˆEØ—:‘:ˆDØˆHØ�yŠyÜ—m‘m×-Ñ-Ð.GÓHÐHØ—8‘8Ð'Ð'Ð'Ø�‰¤#§-¡-×"3Ñ"3Ó3¸ÀÇÁÓ8Kð ×#Ò#Ø+/×+;Ñ+;Ð';�DÔ$ð ˜t×0Ñ0Ó0Ø×)Ò)¨d×.>Ó.>ô
 œsŸ{™{Ÿ™×2Ñ2×6Ñ6¸À¹ÓD�CØ×)Ò)ä!Ÿm™m×5Ñ5Ð6KÓLÐLØ×'Ò'¨D¯K©K¸3¿:¹:Ò,EÜ!Ÿm™m×5Ñ5Ð6WÓXÐXØ×$Ñ$ WÔ-Ø—H‘H×$Ñ$ T¨8Ô4Ø—H‘H—O‘OÔ%Ø#�D”HØ $�D•Ið
 */�DÔ&ÜœsŸ{™{Ÿ™×2Ñ2×6Ñ6¸À¹ÓD�CØ×'Ò'Ø×+Ò+à"Ÿz™z¨T¯[©[Ò8Ü&)§m¡m×&=Ñ&=Ø$?ó'"ð !"ð
 +.¯*©*˜DœKØ ŸH™H×,Ñ,¨T°8Õ<ô "Ÿm™m×5Ñ5Ð6UÓVÐVÙØ×!Ò!ð $)�Ô Ø%*�Ô"Ø#(�Ô Ø—‘×!Ñ!Ô#Ø×+Ñ+×2Ñ2°4Ó8�”Ø×)Ñ)Ð5Ø×*Ñ*¨4¯8©8Ô4ð ×$Ñ$ T§[¡[Ô1Ùà×ÒØ—‘×%Ñ% d¨HÖ5à—‘—‘˜T 8Ö,ðgS	-ðh �;Š;˜tŸyšyô
 —-‘-×)Ñ)Ð*FÓGÐGØ�y‰yÐr   c                 ó   — | S )Nr   )r   s    r   Ú	__enter__zInbound.__enter__!  s   € Øˆr   c                 óP   — | j                   r| j                   j                  «        y)NF)r'   rJ   )r   Úexc_typeÚexc_valÚexc_tbs       r   Ú__exit__zInbound.__exit__$  s   € Ø�8Š8Ø�H‰H×ÑÔØr   )r   r   r   r   r	   r(   r,   ÚtransactionÚTransactionManagerÚ	RdataTypeÚintÚboolr   ÚTransactionr   r   ÚMessager:   rR   rT   rY   r   r   r   r   r   6   sÞ   „ ñð +.¯-©-×*<Ñ*<Ø!ØØ/3ØRVñ33à—_‘_×7Ñ7ð33ð —‘×'Ñ'ð33ð �d‘
ð	33ð
 ð33ð )-ð33ð $ S§_¡_×%@Ñ%@Ð$AÀ4Ð$GÑHÈ4ÑOó33ðj: 3§;¡;×#6Ñ#6ð :¸4ó :ðc s§{¡{×':Ñ':ð c¸tó còRór   r   r    r"   Úuse_ednsÚ	ednsflagsÚpayloadÚrequest_payloadÚoptionsÚkeyringÚkeynameÚkeyalgorithmr4   c
                 ó  — | j                  «       \  }
}}|
€t        d«      ‚|€t        j                  j                  }nüt        |t        «      st        d«      ‚|dk(  r¬| j                  «       5 }|j                  |d«      }|rbt        t        j                  j                  j                  j                  |d   «      }|j                  }t        j                  j                  }nd}t        j                  j                  }ddd«       n0|dkD  r |dk  rt        j                  j                  }nt        d«      ‚| j                  «       }t        j                   j#                  |
||d||||«	      }|�ot        j$                  j'                  |dd	|› d
�«      }|j)                  |j*                  |
|t        j                  j                  d¬«      }|j-                  |d«       |�|j/                  |||	¬«       ||fS # 1 sw Y   ŒËxY w)aO  Make an AXFR or IXFR query.

    :param txn_manager: The transaction manager for this transfer, typically
        a :py:class:`dns.zone.Zone`.
    :type txn_manager: :py:class:`dns.transaction.TransactionManager`
    :param serial: If ``0``, IXFR is attempted using the most recent serial
        from *txn_manager* (caller must ensure no write transactions are
        active that could invalidate the retrieved serial).  If a serial
        cannot be determined, AXFR is forced.  Other integer values are the
        starting serial to use.  ``None`` forces an AXFR.
    :type serial: int or ``None``

    Please see the documentation for :py:func:`dns.message.make_query` and
    :py:func:`dns.message.Message.use_tsig` for details on the other parameters
    to this function.

    :returns: A ``(query, serial)`` tuple.
    :rtype: tuple
    Nzno zone originzserial is not an integerr   rC   l        zserial out-of-rangeFz. . z 0 0 0 0T)Úcreate)Ú	algorithm)r-   r*   r	   r(   r,   Ú
isinstancer]   ÚreaderÚgetr   rE   rF   rC   r"   r)   Ú	get_classr   Ú
make_queryÚrdataÚ	from_textÚ
find_rrsetÚ	authorityrM   Úuse_tsig)r    r"   ra   rb   rc   rd   re   rf   rg   rh   Úzone_originr3   r.   r!   r'   rP   rQ   ÚrdclassÚqrq   rO   s                        r   rp   rp   *  s×  € ð> )×;Ñ;Ó=Ñ€K��FØÐÜÐ)Ó*Ð*Ø€~Ü—‘×#Ñ#‰Ü˜¤Ô$ÜÐ3Ó4Ð4Ø	�1ŠØ×ÑÓ!ð 	, SØ—w‘w˜v uÓ-ˆHÙÜœ3Ÿ;™;Ÿ?™?×.Ñ.×2Ñ2°H¸Q±KÓ@�ØŸ™�ÜŸ™×+Ñ+‘à�ÜŸ™×+Ñ+�÷	,ð 	,ð 
�!Š˜ Ò+Ü—‘×#Ñ#‰äÐ.Ó/Ð/Ø×#Ñ#Ó%€GÜ�‰×ÑØØØØØØØØØó
	€Að ÐÜ—	‘	×#Ñ# G¨U°d¸6¸(À(Ð4KÓLˆØ—‘Ø�K‰K˜ g¬s¯}©}×/@Ñ/@Èð ó 
ˆð 	�	‰	�%˜ÔØÐØ	�
‰
�7˜G¨|ˆ
Ô<Øˆvˆ;Ð÷C	,ð 	,ús   Á/BG=Ç=HÚqueryc                 óT  — t        | t        j                  j                  «      st	        d«      ‚| j
                  d   }|j                  t        j                  j                  k(  ry|j                  t        j                  j                  k7  rt	        d«      ‚| j                  | j                  |j                  |j                  t        j                  j                  «      }t        t        j                   j"                  j                  j                  |d   «      }|j$                  S )a7  Extract the SOA serial number from query if it is an IXFR and return
    it, otherwise return None.

    *query* is a dns.message.QueryMessage that is an IXFR or AXFR request.

    Raises if the query is not an IXFR or AXFR, or if an IXFR doesn't have
    an appropriate SOA RRset in the authority section.
    zquery not a QueryMessager   Nzquery is not an AXFR or IXFR)rl   r	   r   ÚQueryMessager*   r@   r!   r(   r,   r)   rs   rt   rA   rw   rC   r   rE   rF   r"   )ry   r@   Ú	soa_rrsetrQ   s       r   Úextract_serial_from_queryr}   u  sÎ   € ô �eœSŸ[™[×5Ñ5Ô6ÜÐ3Ó4Ð4Ø�~‰~˜aÑ €HØ‡�œ#Ÿ-™-×,Ñ,Ò,ØØ	�‰œCŸM™M×.Ñ.Ò	.ÜÐ7Ó8Ð8Ø× Ñ Ø�‰˜Ÿ™¨×(8Ñ(8¼#¿-¹-×:KÑ:Kó€Iô Œs�{‰{�‰×"Ñ"×&Ñ&¨	°!©Ó
5€CØ�:‰:Ðr   )-Úcollections.abcr   Útypingr   r   Údns.ednsr	   Údns.exceptionÚdns.messageÚdns.nameÚ	dns.rcodeÚ	dns.rdataÚdns.rdatasetÚdns.rdatatypeÚdns.rdtypesÚdns.rdtypes.ANYÚdns.rdtypes.ANY.SOAÚ
dns.serialÚdns.transactionÚdns.tsigr8   ÚDNSExceptionr   r9   r   r   r   ÚtsigÚdefault_algorithmrZ   r[   r]   r^   ÚlistÚednsÚOptionrA   ÚNameÚstrÚtupler   r{   rp   r`   r}   r   r   r   ú<module>r—      s³  ðõ$ %ß ã Û Û Û Û Û Û Û Û Û Û Û Û Û ô�C—M‘M×.Ñ.ô ôE˜#Ÿ-™-×1Ñ1ô Eô2ˆS�]‰]×'Ñ'ô 2÷qñ qðl Ø"&Ø ØØ"&Ø,0ØØ$(Ø(+¯©×(BÑ(BñHØ—‘×3Ñ3ðHà�$‰JðHð �D‰j˜4ÑðHð �T‰zð	Hð
 �4‰ZðHð ˜4‘ZðHð �#—(‘(—/‘/Ñ" TÑ)ðHð ðHð �X‰X�]‰]˜TÑ!ðHð —(‘(—-‘- #Ñ%ðHð ˆ3�;‰;×#Ñ# S¨4¡ZÐ/Ñ0óHðV S§[¡[×%8Ñ%8ð ¸SÀ4¹Zô r   