U mf3@s\ddlmZmZmZmZmZddlZddlZddl Zddl Zddl Zddl Zddl ZddlZddlZddlZGdddejjZGdddejjZGdddejjZGd d d Zddddddddejjf ejjeeeeeefeeeeeeeeejjeeej j!eej j!e"feej#j$eefd d d Z%ej#j&eedddZ'dS))AnyListOptionalTupleUnionNcs eZdZdZfddZZS) TransferErrorz.A zone transfer response got a non-zero rcode.cs&dtj|}t|||_dS)NzZone transfer error: %s)dnsrcodeZto_textsuper__init__)selfr message __class__5/opt/hc_python/lib/python3.8/site-packages/dns/xfr.pyr #s zTransferError.__init__)__name__ __module__ __qualname____doc__r __classcell__rrrrr src@seZdZdZdS)SerialWentBackwardsz:The current serial number is less than the serial we know.Nrrrrrrrrr)src@seZdZdZdS)UseTCPz'This IXFR cannot be completed with UDP.Nrrrrrr-src@s`eZdZdZejjddfejjejj e e e dddZ ejje ddd Zd d Zd d ZdS)Inboundz+ State machine for zone transfers. NF) txn_managerrdtypeserialis_udpcCst||_d|_||_|tjjkr0|dkrrBrrrrr1s #r) rruse_edns ednsflagspayloadrequest_payloadoptionskeyringkeyname keyalgorithmr*c  CsB|\} } } | dkrtd|dkr0tjj} nt|tsDtdnp|dkr|6}|| d}|rz|dj }tjj } n d}tjj} W5QRXn"|dkr|dkrtjj } ntd| }tj | | ||d|||| }|dk r tj|dd |d }|j|j| |tjjd d }||d|dk r:|j||| d ||fS)aMake 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 integerrr3lzserial out-of-rangeFz. . z 0 0 0 0T)create) algorithm)r#r"rr r, isinstancerEreadergetrr!Z get_classr make_queryrdataZ from_text find_rrset authorityr3r9Zuse_tsig)rrrHrIrJrKrLrMrNrOZ zone_originr)r$rrr<rdclassqrVr;rrrrUsV           rU)queryr*cCslt|tjjstd|jd}|jtjjkr2dS|jtjj krHtd| |j |j |j tjj}|djS)a7Extract 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 QueryMessagerNzquery is not an AXFR or IXFR)rRrr QueryMessager"r/rr r,r!rWrXr0rYr3r)r[r/Zsoarrrextract_serial_from_queryDs  r])(typingrrrrrZ dns.exceptionrZ dns.messageZdns.nameZ dns.rcodeZ dns.rdatasetZ dns.rdatatypeZ dns.serialZdns.transactionZdns.tsigZdns.zoner1Z DNSExceptionrr2rrrZtsigZdefault_algorithmrCrDrErFZednsOptionr0Namestrr r\rUrGr]rrrrsL L  J