HEX
Server: LiteSpeed
System: Linux srv146.niagahoster.com 4.18.0-553.30.1.lve.el8.x86_64 #1 SMP Tue Dec 3 01:21:19 UTC 2024 x86_64
User: kodi1989 (1633)
PHP: 8.1.34
Disabled: symlink,shell_exec,exec,popen,system,dl,passthru,escapeshellarg,escapeshellcmd,show_source,pcntl_exec
Upload Files
File: //opt/alt/python37/lib/python3.7/site-packages/dns/__pycache__/update.cpython-37.pyc
B

��f�/�@s�dZddlmZmZmZmZddlZddlZddl	Zddl
ZddlZddlZddl
ZddlZGdd�dejj�ZGdd�dejj�ZeZejZejZejZejZdS)zDNS Dynamic Update Support�)�Any�List�Optional�UnionNc@s,eZdZdZdZdZdZdZedd��Z	dS)	�
UpdateSectionzUpdate sectionsr���cCsdS)Nr	�)�clsr
r
�;/opt/alt/python37/lib/python3.7/site-packages/dns/update.py�_maximum(szUpdateSection._maximumN)
�__name__�
__module__�__qualname__�__doc__�ZONE�PREREQ�UPDATE�
ADDITIONAL�classmethodr
r
r
r
rr srcs�eZdZeZdejjddejj	dfe
eejj
efejje
ee
ejj
eejj
efe
ed��fdd�
Zeeejjd�dd��Zejdd��Zeeejjd�d	d
��Zejdd
��Zeeejjd�dd
��Zejdd
��Zd#dd�Zdd�Zeejj
efedd�dd�Zeejj
efedd�dd�Zeejj
efedd�dd�Zeejj
efedd�dd�Z d$eejj
efe
eej!j"efdd�dd�Z#dd �Z$d!d"�Z%�Z&S)%�
UpdateMessageN)�zone�rdclass�keyring�keyname�keyalgorithm�idcs�t�j|d�|jtj�tjj�O_t|t�r>tj	�
|�}||_tjj
�|�}||_|jr||j|j|j|tjjddd�|dk	r�|j|||d�dS)axInitialize a new DNS Update object.

        See the documentation of the Message class for a complete
        description of the keyring dictionary.

        *zone*, a ``dns.name.Name``, ``str``, or ``None``, the zone
        which is being updated.  ``None`` should only be used by dnspython's
        message constructors, as a zone is required for the convenience
        methods like ``add()``, ``replace()``, etc.

        *rdclass*, an ``int`` or ``str``, the class of the zone.

        The *keyring*, *keyname*, and *keyalgorithm* parameters are passed to
        ``use_tsig()``; see its documentation for details.
        )rT)�createZforce_uniqueN)�	algorithm)�super�__init__�flags�dns�opcodeZto_flagsr�
isinstance�str�name�	from_text�origin�
rdataclass�
RdataClass�make�zone_rdclass�
find_rrsetr�	rdatatype�SOAZuse_tsig)�selfrrrrrr)�	__class__r
rr!2s"
zUpdateMessage.__init__)�returncCs
|jdS)zThe zone section.r)�sections)r1r
r
rr]szUpdateMessage.zonecCs||jd<dS)Nr)r4)r1�vr
r
rrbscCs
|jdS)zThe prerequisite section.r)r4)r1r
r
r�prerequisitefszUpdateMessage.prerequisitecCs||jd<dS)Nr)r4)r1r5r
r
rr6kscCs
|jdS)zThe update section.r)r4)r1r
r
r�updateoszUpdateMessage.updatecCs||jd<dS)Nr)r4)r1r5r
r
rr7tsc
CsB|dkr|j}|��}|�|||j|j||dd�}|�||�dS)z&Add a single RR to the update section.NT)r7�coversr.r-�rdtype�add)r1r'�ttl�rd�deleting�sectionr8�rrsetr
r
r�_add_rrxszUpdateMessage._add_rrc
Gs,t|t�rtj�|d�}t|dtjj�rnx�|D]8}|rF|�||j�x |D]}|j	||j
||d�qLWq0Wn�t|�}t|�
d��}t|dtjj�r�|r�|�||dj�xz|D]}|j	||||d�q�WnZtjj�|�
d��}|r�|�||�x4|D],}	tj�|j||	|j�}|j	||||d�q�WdS)a�Add records.

        *replace* is the replacement mode.  If ``False``,
        RRs are added to an existing RRset; if ``True``, the RRset
        is replaced with the specified contents.  The second
        argument is the section to add to.  The third argument
        is always a name.  The other arguments can be:

                - rdataset...

                - ttl, rdata...

                - ttl, rdtype, string...
        Nr)r>)r%r&r#r'r(�rdataset�Rdataset�deleter9r@r;�list�int�pop�rdata�Rdatar/�	RdataTyper,r-r))
r1�replacer>r'�args�rdsr<r;r9�sr
r
r�_add�s*




zUpdateMessage._add)r'rKr3cGs|jd|j|f|��dS)z�Add records.

        The first argument is always a name.  The other
        arguments can be:

                - rdataset...

                - ttl, rdata...

                - ttl, rdtype, string...
        FN)rNr7)r1r'rKr
r
rr:�s
zUpdateMessage.addc
GsZt|t�rtj�|d�}t|�dkrR|�|j|tjj	tj
j	tj
jtjj	dd��nt|dtjj
�r�x�|D]&}x |D]}|�|d|tjj�qtWqjWn�t|�}t|dtjj�r�x�|D]}|�|d|tjj�q�Wn�tj
j�|�d��}t|�dk�r|�|j||j|tj
jtjj	dd�n:x8|D]0}tj�|j|||j�}|�|d|tjj��q"WdS)z�Delete records.

        The first argument is always a name.  The other
        arguments can be:

                - *empty*

                - rdataset...

                - rdata...

                - rdtype, [string...]
        NrT)r%r&r#r'r(�lenr.r7r*�ANYr/�NONErArBr@rDrGrHrIr,rFr-r))r1r'rKrLr<�largsr9rMr
r
rrC�sL





zUpdateMessage.deletecGs|jd|j|f|��dS)abReplace records.

        The first argument is always a name.  The other
        arguments can be:

                - rdataset...

                - ttl, rdata...

                - ttl, rdtype, string...

        Note that if you want to replace the entire node, you should do
        a delete of the name followed by one or more calls to add.
        TN)rNr7)r1r'rKr
r
rrJ�szUpdateMessage.replacec
Gs
t|t�rtj�|d�}t|�dkrL|�|j|tjj	tj
j	tj
jddd�n�t|dtjj
�s|t|dtjj�s|t|�dkr�t|dtjj
�s�t|�}|�dd�|jd|j|f|��n|jd|j|f|��n4tj
j�|d�}|�|j|tjj	|tj
jddd�dS)aSRequire that an owner name (and optionally an rdata type,
        or specific rdataset) exists as a prerequisite to the
        execution of the update.

        The first argument is always a name.
        The other arguments can be:

                - rdataset...

                - rdata...

                - rdtype, string...
        NrTrF)r%r&r#r'r(rOr.r6r*rPr/rQrArBrGrHrD�insertrNrIr,)r1r'rKrRr9r
r
r�presents<
zUpdateMessage.present)r'r9r3c
Cs|t|t�rtj�|d�}|dkrH|�|j|tjjtj	j
tj	jddd�n0tj	j�|�}|�|j|tjj|tj	jddd�dS)z�Require that an owner name (and optionally an rdata type) does
        not exist as a prerequisite to the execution of the update.NT)
r%r&r#r'r(r.r6r*rQr/rPrIr,)r1r'r9Z
the_rdtyper
r
r�absent=s,
zUpdateMessage.absentcCsdS)NTr
)r1�valuer
r
r�_get_one_rr_per_rrset_sz#UpdateMessage._get_one_rr_per_rrsetcCs�d}d}|tjkr:tj�|�s0|tjjks0|jr�tjj	�nH|jsHtjj	�|tjj
tjjfkr�|}|jdj}|tjj
kp�|tj
k}||||fS)NFr)rrr#r*Zis_metaclassr/r0r�	exceptionZ	FormErrorrPrQrr)r1r>r'rr9r=�emptyr
r
r�_parse_rr_headercs

zUpdateMessage._parse_rr_header)NN)N)'rrrrZ
_section_enumr#r*�INZtsigZdefault_algorithmrrr'�Namer&r+rrEr!�propertyrr?ZRRsetr�setterr6r7r@rNr:rCrJrTr/rIrUrWrZ�
__classcell__r
r
)r2rr-s4P$
(<8"r)r�typingrrrrZdns.messager#Zdns.nameZ
dns.opcodeZ	dns.rdataZdns.rdataclassZ
dns.rdatatypeZdns.rdatasetZdns.tsig�enum�IntEnumr�message�MessagerZUpdaterrrrr
r
r
r�<module>s$
O