관리-도구
편집 파일: xfr.cpython-39.pyc
a �����M�e�3����������������������@���s\��d�dl�mZmZmZmZmZ�d�dlZd�dlZd�dl Zd�dl Zd�dlZd�dlZd�dl Zd�dlZd�dlZd�dlZG�dd��dejj�ZG�dd��dejj�ZG�dd��dejj�ZG�d d ��d �Zd�dddddddejjf ejjee�eeeef��ee�ee�ee�eeejj��eeej j!�eej j!e"f�eej#j$ee�f�d�dd �Z%ej#j&ee�d�dd�Z'dS�)�����)�Any�List�Optional�Tuple�UnionNc�����������������������s ���e�Zd�ZdZ��fdd�Z���ZS�)� TransferErrorz.A zone transfer response got a non-zero rcode.c��������������������s&���dt�j�|��}t���|��||�_d�S�)NzZone transfer error: %s)�dns�rcodeZto_text�super�__init__)�selfr ����message�� __class__���+/usr/lib/python3.9/site-packages/dns/xfr.pyr���#���s����zTransferError.__init__)�__name__� __module__�__qualname__�__doc__r���� __classcell__r���r���r���r���r��� ���s���r���c�������������������@���s���e�Zd�ZdZdS�)�SerialWentBackwardsz:The current serial number is less than the serial we know.N�r���r���r���r���r���r���r���r���r���)���s���r���c�������������������@���s���e�Zd�ZdZdS�)�UseTCPz'This IXFR cannot be completed with UDP.Nr���r���r���r���r���r���-���s���r���c�������������������@���s`���e�Zd�ZdZejjddfejjejj e e�ed�dd�Z ejjed�dd �Zd d��Zdd ��ZdS�)�Inboundz+ State machine for zone transfers. NF)�txn_manager�rdtype�serial�is_udpc�����������������C���st���||�_�d|�_||�_|tjjkr0|du�r<td��n|r<td��||�_||�_|� ��\}}|�_ d|�_d|�_d|�_ d|�_dS�)aq��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. *is_udp*, a ``bool`` indidicates if UDP is being used for this XFR. Nz,a starting serial must be supplied for IXFRszis_udp specified for AXFRF)r����txnr���r���� rdatatype�IXFR� ValueErrorr���r����origin_information�origin�soa_rdataset�done� expecting_SOA�delete_mode)r���r���r���r���r����_r���r���r���r���6���s���� zInbound.__init__)r ����returnc�����������������C���sn��|�j�du�r&|�jtjjk}|�j�|�|�_�|���}|tjjkrBt |��t |j�dkr�|jd�j|�j krntj�d��|jd�j|�jkr�tj�d��d}|�jdu��rn|jr�|jd�j|�j kr�tj�d��|jd�}|}|jtjjkr�tj�d��d}|���|�_|�jtjjk�rn|�jd�j|�jk�r"d|�_nLtj�|�jd�j�|�jk��rDt�n*|�j�rht |j|d���dk�rht�d|�_|j|d��D��]�}|j}|}|�j�r�tj�d ��|�j�du�s�J��|jtjjk�r�||�j k�r�|�jtjjk�r�|�j�|�_||�jk�r�|�jtjjk�s|�jtjjk�r�|�j�r�|�j�r.tj�d ��|�jtjjk�r\|�j|d�jk�r\tj�d��|�j��||��|�j�����d|�_�d|�_nfd|�_|�jtjjk�r�|�j�r�|d�j|�jk�r�tj�d ��n|d�j|�_|�j��||��ntj�d���q||�j�r"tjj|�_d|�_d|�_|�j�����|�j�d�|�_�|�j�r:|�j�� ||��n|�j��!||���q||�j�rh|�j�shtj�d��|�jS�)aZ��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. Returns `True` if the transfer is complete, and `False` otherwise. Nr���zwrong question namezwrong question rdatatypez&No answer or RRset not for zone originzfirst RRset is not an SOA����Tzanswers after final SOAzempty IXFR sequencezunexpected end of IXFR sequenceFzIXFR base serial mismatchzunexpected origin SOA in AXFRzunexpected end of UDP IXFR)"r���r���r���r ����AXFRr����writerr ���ZNOERRORr����len�question�namer$���� exception� FormErrorr%���Zanswer�SOA�copyr!���r���r&���ZSerialr���r���r���r'���r(����replaceZcommit�rollbackZdelete_exact�add)r���r ���Zreplacementr ���Zanswer_index�rrset�rdatasetr0���r���r���r����process_messageY���s����� ����� � zInbound.process_messagec�����������������C���s���|�S�)Nr���)r���r���r���r���� __enter__����s����zInbound.__enter__c�����������������C���s���|�j�r|�j�����dS�)NF)r���r6���)r����exc_typeZexc_valZexc_tbr���r���r����__exit__����s���� zInbound.__exit__)r���r���r���r���r���r ���r,����transaction�TransactionManagerZ RdataTyper����int�boolr���r ����Messager:���r;���r=���r���r���r���r���r���1���s�����#�r���)r���r����use_edns� ednsflags�payload�request_payload�options�keyring�keyname�keyalgorithmr*���c �����������������C���sV��|�����\} }}| du�rtd��|du�r0tjj} n�t|t�sDtd��n�|dkr�|�����@}|�|d�}|rz|d�j }tjj } nd}tjj} W�d����q�1�s�0����Y��n"|dkr�|dk�r�tjj } ntd��|����}tj� | | ||d||||� }|du�r4tj�|dd |��d ��}|j|j| |tjjdd�}|�|d��|du�rN|j||| d ��||fS�)a��Make an AXFR or IXFR query. *txn_manager* is a ``dns.transaction.TransactionManager``, typically a ``dns.zone.Zone``. *serial* is an ``int`` or ``None``. If 0, then IXFR will be attempted using the most recent serial number from the *txn_manager*; it is the caller's responsibility to ensure there are no write transactions active that could invalidate the retrieved serial. If a serial cannot be determined, AXFR will be forced. Other integer values are the starting serial to use. ``None`` forces an AXFR. 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. Nzno zone originzserial is not an integerr���r3���l��������zserial out-of-rangeFz. . z 0 0 0 0T)Zcreate)� algorithm)r#���r"���r���r ���r,���� isinstancer@����reader�getr���r!���Z get_classr ���� make_query�rdataZ from_text� find_rrset� authorityr3���r7���Zuse_tsig)r���r���rC���rD���rE���rF���rG���rH���rI���rJ���Zzone_originr)���r$���r���r���r9����rdclass�qrP���r8���r���r���r���rO�������sN���� ( � � rO���)�queryr*���c�����������������C���sl���t�|�tjj�std��|�jd�}|jtjjkr2dS�|jtjj krHtd��|�� |�j|j|j tjj�}|d�jS�)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. zquery not a QueryMessager���Nzquery is not an AXFR or IXFR)rL���r���r ����QueryMessager"���r/���r���r ���r,���r!���rQ���rR���r0���rS���r3���r���)rU���r/���Zsoar���r���r����extract_serial_from_queryD��s���� �rW���)(�typingr���r���r���r���r���Z dns.exceptionr���Zdns.messageZdns.nameZ dns.rcodeZdns.rdatasetZ dns.rdatatypeZ dns.serialZdns.transactionZdns.tsigZdns.zoner1���ZDNSExceptionr���r2���r���r���r���ZtsigZdefault_algorithmr>���r?���r@���rA���ZednsZOptionr0����Name�strr ���rV���rO���rB���rW���r���r���r���r����<module>���sL��� �L� �J