shell bypass 403

Cubjrnet7 Shell


name : transaction.cpython-39.opt-1.pyc
a

�M�elX�@s.ddlZddlmZmZmZmZmZmZmZddl	Z
ddlZ
ddlZ
ddl
Z
ddlZ
ddlZ
ddlZ
ddlZ
ddlZ
Gdd�d�ZGdd�de
jj�ZGdd�de
jj�ZGd	d
�d
e
jj�Zdd�Zd
d�Zede
jje
jjgdfZede
jje
j j!e
j j!gdfZ"ede
jjgdfZ#Gdd�d�Z$dS)�N)�Any�Callable�Iterator�List�Optional�Tuple�Unionc@s|eZdZdd�dd�Zdedd�dd�Zeeej	j
eeej	j
fd�d	d
�Zejj
d�dd�Zeej	j
d�d
d�ZdS)�TransactionManager�Transaction��returncCst�dS)zBegin a read-only transaction.N��NotImplementedError��self�r�3/usr/lib/python3.9/site-packages/dns/transaction.py�readerszTransactionManager.readerF)�replacementrcCst�dS)aBegin a writable transaction.

        *replacement*, a ``bool``.  If `True`, the content of the
        transaction completely replaces any prior content.  If False,
        the default, then the content of the transaction updates the
        existing content.
        Nr
)rrrrr�writerszTransactionManager.writercCst�dS)aqReturns a tuple

            (absolute_origin, relativize, effective_origin)

        giving the absolute name of the default origin for any
        relative domain names, the "effective origin", and whether
        names should be relativized.  The "effective origin" is the
        absolute origin if relativize is False, and the empty name if
        relativize is true.  (The effective origin is provided even
        though it can be computed from the absolute_origin and
        relativize setting because it avoids a lot of code
        duplication.)

        If the returned names are `None`, then no origin information is
        available.

        This information is used by code working with transactions to
        allow it to coordinate relativization.  The transaction code
        itself takes what it gets (i.e. does not change name
        relativity).

        Nr
rrrr�origin_information sz%TransactionManager.origin_informationcCst�dS)z%The class of the transaction manager.Nr
rrrr�	get_class;szTransactionManager.get_classcCs|��\}}}|r|SdSdS)z#Origin to use in from_wire() calls.N)r)rZabsolute_originZ
relativize�_rrr�from_wire_origin?sz#TransactionManager.from_wire_originN)F)�__name__�
__module__�__qualname__r�boolrrr�dns�name�NamerZ
rdataclassZ
RdataClassrrrrrrr	s�r	c@seZdZdZdS)�DeleteNotExactz>Existing data did not match data specified by an exact delete.N�rrr�__doc__rrrrr!Hsr!c@seZdZdZdS)�ReadOnlyz*Tried to write to a read-only transaction.Nr"rrrrr$Lsr$c@seZdZdZdS)�AlreadyEndedz*Tried to use an already-ended transaction.Nr"rrrrr%Psr%cCs&|dust|tjj�r|Stj�|�S�N)�
isinstancer�rdataset�ImmutableRdataset)r(rrr�_ensure_immutable_rdatasetTsr*cCs |dus|��r|Stj�|�Sr&)Zis_immutabler�nodeZ
ImmutableNode)r+rrr�_ensure_immutable_nodeZsr,r
c@sdeZdZd`eeed�dd�Zejjfe	e
ejje
fe
ejje
fe
ejje
fejjd�dd�Zejje	ejjd�d	d
�Zdd�d
d�Zedd�dd�Zedd�dd�Zedd�dd�Zedd�dd�Ze
ejje
fed�dd�Zddejjfeeejjdd�dd�Zdd �Zed�d!d"�Z dd�d#d$�Z!dd�d%d&�Z"e#dd'�d(d)�Z$e%dd'�d*d+�Z&e'dd'�d,d-�Z(e)e*ejjejjfd�d.d/�Z+e)ejjd�d0d1�Z,d2d3�Z-d4d5�Z.d6d7�Z/d8d9�Z0d:d;�Z1d<d=�Z2d>d?�Z3d@dA�Z4dBdC�Z5dDdE�Z6dFdG�Z7dHdI�Z8dJdK�Z9dLdM�Z:dNdO�Z;dPdQ�Z<dRdS�Z=dTdU�Z>dVdW�Z?dXdY�Z@dZd[�ZAd\d]�ZBd^d_�ZCdS)ar
F)�managerr�	read_onlycCs.||_||_||_d|_g|_g|_g|_dS�NF)r-rr.�_ended�_check_put_rdataset�_check_delete_rdataset�_check_delete_name)rr-rr.rrr�__init__kszTransaction.__init__)r�rdtype�coversrcCsR|��t|t�r tj�|d�}tjj�|�}tjj�|�}|�	|||�}t
|�S)z�Return the rdataset associated with *name*, *rdtype*, and *covers*,
        or `None` if not found.

        Note that the returned rdataset is immutable.
        N)�_check_endedr'�strrr�	from_text�	rdatatype�	RdataType�make�
_get_rdatasetr*)rrr5r6r(rrr�get�s
zTransaction.get)rrcCst|�|��S)z[Return the node at *name*, if any.

        Returns an immutable node or ``None``.
        )r,�	_get_node�rrrrr�get_node�szTransaction.get_nodeNrcCs|jr
t�dSr&)r.r$rrrr�_check_read_only�szTransaction._check_read_only)�argsrcGs |��|��|�d|�dS)z�Add records.

        The arguments may be:

            - rrset

            - name, rdataset...

            - name, ttl, rdata...
        FN�r7rB�_add�rrCrrr�add�szTransaction.addcGs |��|��|�d|�dS)a�Replace the existing rdataset at the name with the specified
        rdataset, or add the specified rdataset if there was no existing
        rdataset.

        The arguments may be:

            - rrset

            - name, rdataset...

            - name, ttl, rdata...

        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() or
        replace().
        TNrDrFrrr�replace�szTransaction.replacecGs |��|��|�d|�dS)a Delete records.

        It is not an error if some of the records are not in the existing
        set.

        The arguments may be:

            - rrset

            - name

            - name, rdatatype, [covers]

            - name, rdataset...

            - name, rdata...
        FN�r7rB�_deleterFrrr�delete�szTransaction.deletecGs |��|��|�d|�dS)a4Delete records.

        The arguments may be:

            - rrset

            - name

            - name, rdatatype, [covers]

            - name, rdataset...

            - name, rdata...

        Raises dns.transaction.DeleteNotExact if some of the records
        are not in the existing set.

        TNrIrFrrr�delete_exact�szTransaction.delete_exactcCs*|��t|t�r tj�|d�}|�|�S)zDoes the specified name exist?N)r7r'r8rrr9�_name_existsr@rrr�name_exists�s
zTransaction.name_exists�T)�value�relativerrcCs�|��|dkrtd��t|t�r0tj�|d�}|�|tjj	tjj
�}|dusZt|�dkr^t�|rztj
�|dj
�|}ntj
�|�}|j}|dkr�d}|dj|d�}tj�|j|�}|�||�dS)a�Update the serial number.

        *value*, an `int`, is an increment if *relative* is `True`, or the
        actual value to set if *relative* is `False`.

        Raises `KeyError` if there is no SOA rdataset at *name*.

        Raises `ValueError` if *value* is negative or if the increment is
        so large that it would cause the new serial to be less than the
        prior value.
        rznegative update_serial() valueNrO)�serial)r7�
ValueErrorr'r8rrr9r=r:�SOA�NONE�len�KeyErrorrRZSerialrPrHr(�
from_rdata�ttl)rrPrQrr(rR�rdataZnew_rdatasetrrr�
update_serial�s"
zTransaction.update_serialcCs|��|��Sr&�r7�_iterate_rdatasetsrrrr�__iter__szTransaction.__iter__cCs|��|��S)aHas this transaction changed anything?

        For read-only transactions, the result is always `False`.

        For writable transactions, the result is `True` if at some time
        during the life of the transaction, the content was changed.
        )r7�_changedrrrr�changedszTransaction.changedcCs|�d�dS)a�Commit the transaction.

        Normally transactions are used as context managers and commit
        or rollback automatically, but it may be done explicitly if needed.
        A ``dns.transaction.Ended`` exception will be raised if you try
        to use a transaction after it has been committed or rolled back.

        Raises an exception if the commit fails (in which case the transaction
        is also rolled back.
        TN��_endrrrr�commit)szTransaction.commitcCs|�d�dS)avRollback the transaction.

        Normally transactions are used as context managers and commit
        or rollback automatically, but it may be done explicitly if needed.
        A ``dns.transaction.AlreadyEnded`` exception will be raised if you try
        to use a transaction after it has been committed or rolled back.

        Rollback cannot otherwise fail.
        FNrarrrr�rollback6s
zTransaction.rollback)�checkrcCs|j�|�dS)a�Call *check* before putting (storing) an rdataset.

        The function is called with the transaction, the name, and the rdataset.

        The check function may safely make non-mutating transaction method
        calls, but behavior is undefined if mutating transaction methods are
        called.  The check function should raise an exception if it objects to
        the put, and otherwise should return ``None``.
        N)r1�append�rrerrr�check_put_rdatasetBs
zTransaction.check_put_rdatasetcCs|j�|�dS)a�Call *check* before deleting an rdataset.

        The function is called with the transaction, the name, the rdatatype,
        and the covered rdatatype.

        The check function may safely make non-mutating transaction method
        calls, but behavior is undefined if mutating transaction methods are
        called.  The check function should raise an exception if it objects to
        the put, and otherwise should return ``None``.
        N)r2rfrgrrr�check_delete_rdatasetNsz!Transaction.check_delete_rdatasetcCs|j�|�dS)a�Call *check* before putting (storing) an rdataset.

        The function is called with the transaction and the name.

        The check function may safely make non-mutating transaction method
        calls, but behavior is undefined if mutating transaction methods are
        called.  The check function should raise an exception if it objects to
        the put, and otherwise should return ``None``.
        N)r3rfrgrrr�check_delete_name[s
zTransaction.check_delete_namecCs|��|��S)a@Iterate all the rdatasets in the transaction, returning
        (`dns.name.Name`, `dns.rdataset.Rdataset`) tuples.

        Note that as is usual with python iterators, adding or removing items
        while iterating will invalidate the iterator and may raise `RuntimeError`
        or fail to iterate over all entries.r\rrrr�iterate_rdatasetsgs	zTransaction.iterate_rdatasetscCs|��|��S)z�Iterate all the names in the transaction.

        Note that as is usual with python iterators, adding or removing names
        while iterating will invalidate the iterator and may raise `RuntimeError`
        or fail to iterate over all entries.)r7�_iterate_namesrrrr�
iterate_namessszTransaction.iterate_namescCst|�dkrtd|����dS)Nrzextra parameters to )rV�	TypeError)r�methodrCrrr�_raise_if_not_empty�szTransaction._raise_if_not_emptycCs�z�|��}t|tjj�r"|��}n�t|tjj�r6|}nv|r@d}n@t|t�rj|}|tj	j
krxt|�d���nt|�d���|��}t|tj
j�r�tj�||�}nt|�d���|WSty�|r�YdSt|�d���Yn0dS)Nrz: TTL value too bigz: expected a TTLz: expected an Rdataz: expected more arguments)�popleftr'r�rrset�RRset�to_rdatasetr(�Rdataset�intrYZMAX_TTLrSrnrZZRdatarX�
IndexError)rroZdeletingrC�argr(rYrrr�_rdataset_from_args�s,

zTransaction._rdataset_from_argscCs��zVt�|�}|rd}nd}|��}t|t�r<tj�|d�}t|tjj�r^|}|�	|d|�}n0t|tj
j�r�|}|j}|��}nt
|�d���|j|j��kr�t|�d���|jtjjkr�|��\}}}	||	kr�t|�d���|�||�|�sJ|�||j|j�}
|
du�rJt|
tjj��r@tj�|
j|
j|
j�}|�|
�|}
|
�|�}|�||�Wn"t�yzt
d|����Yn0dS)Nz	replace()zadd()F�/ requires a name or RRset as the first argument�  has objects of wrong RdataClassz has non-origin SOA�not enough parameters to ) �collections�dequerqr'r8rrr9r ryrrrsrtrn�rdclassr-rrSr5r:rT�_origin_informationrpr=r6r(r)ru�update�union�_checked_put_rdatasetrw)rrHrCrorxrr(rrr�origin�existingZtrdsrrrrE�sL


�
�

zTransaction._addcCsP�z&t�|�}|rd}nd}|��}t|t�r<tj�|d�}t|tjj��r|}t	|�dkr�t|dt
�sxt|dt�r�tjj�
|���}t	|�dkr�tjj�
|���}ntjj}|�||�|�|||�}|dur�|r�t|�d���n|�|||�WdS|�|d|�}	n*t|tjj��r(|}	|	j}nt|�d���|�||�|	�r�|	j|j��k�rht|�d���|�||	j|	j�}|du�r�|�r�|�|	�}
|
|	k�r�t|�d���|�|	�}	t	|	�dk�r�|�||	j|	j�n|� ||	�n|�r&t|�d���n*|�r|�!|��st|�d	���|�"|�Wn"t#�yJtd
|����Yn0dS)Nzdelete_exact()zdelete()rz: missing rdatasetTrzr{z: missing rdatasz: name not knownr|)$r}r~rqr'r8rrr9r rVrvr:r;r<rUrpr=r!�_delete_rdatasetryrrrsrnrr-rrSr5r6�intersection�
difference�_checked_delete_rdatasetr�rM�_checked_delete_namerw)r�exactrCrorxrr5r6r�r(r�rrrrJ�sp

���




�zTransaction._deletecCs|jr
t�dSr&)r0r%rrrrr7szTransaction._check_endedcCs4|��|jrt�z|�|�Wd|_nd|_0dS)NT)r7r0r%�_end_transaction�rrcrrrrbszTransaction._endcCs(|jD]}||||�q|�||�dSr&)r1�
_put_rdataset)rrr(rerrrr�s
z!Transaction._checked_put_rdatasetcCs,|jD]}|||||�q|�|||�dSr&)r2r�)rrr5r6rerrrr� s
z$Transaction._checked_delete_rdatasetcCs$|jD]}|||�q|�|�dSr&)r3�_delete_name)rrrerrrr�%s
z Transaction._checked_delete_namecCs|Sr&rrrrr�	__enter__.szTransaction.__enter__cCs$|js |dur|��n|��dSr/)r0rcrd)r�exc_typeZexc_valZexc_tbrrr�__exit__1s

zTransaction.__exit__cCst�dS)zlReturn the rdataset associated with *name*, *rdtype*, and *covers*,
        or `None` if not found.
        Nr
�rrr5r6rrrr=>szTransaction._get_rdatasetcCst�dS)zStore the rdataset.Nr
)rrr(rrrr�DszTransaction._put_rdatasetcCst�dS)zhDelete all data associated with *name*.

        It is not an error if the name does not exist.
        Nr
r@rrrr�HszTransaction._delete_namecCst�dS)z�Delete all data associated with *name*, *rdtype*, and *covers*.

        It is not an error if the rdataset does not exist.
        Nr
r�rrrr�OszTransaction._delete_rdatasetcCst�dS)z2Does name exist?

        Returns a bool.
        Nr
r@rrrrMVszTransaction._name_existscCst�dS)z&Has this transaction changed anything?Nr
rrrrr_]szTransaction._changedcCst�dS)z�End the transaction.

        *commit*, a bool.  If ``True``, commit the transaction, otherwise
        roll it back.

        If committing and the commit fails, then roll back and raise an
        exception.
        Nr
r�rrrr�as	zTransaction._end_transactioncCst�dS)z�Set the origin.

        This method is called when reading a possibly relativized
        source, and an origin setting operation occurs (e.g. $ORIGIN
        in a zone file).
        Nr
)rr�rrr�_set_originlszTransaction._set_origincCst�dS)z7Return an iterator that yields (name, rdataset) tuples.Nr
rrrrr]uszTransaction._iterate_rdatasetscCst�dS)z&Return an iterator that yields a name.Nr
rrrrrlyszTransaction._iterate_namescCst�dS)zPReturn the node at *name*, if any.

        Returns a node or ``None``.
        Nr
r@rrrr?}szTransaction._get_nodecCs
|j��Sr&)r-rrrrrr��szTransaction._origin_information)FF)Drrrr	rr4rr:rUrrrr r8r;r(rur>r+ZNoderArBrrGrHrKrLrN�emptyrvr[r^r`rcrd�CheckPutRdatasetTyperh�CheckDeleteRdatasetTyperi�CheckDeleteNameTyperjrrrkrmrpryrErJr7rbr�r�r�r�r�r=r�r�r�rMr_r�r�r]rlr?r�rrrrr
js~����	��$

�
,@		
	)%r}�typingrrrrrrrZ
dns.exceptionrZdns.nameZdns.nodeZdns.rdataclassZdns.rdatasetZ
dns.rdatatypeZ	dns.rrsetZ
dns.serialZdns.ttlr	�	exceptionZDNSExceptionr!r$r%r*r,rr r(rur�r:r;r�r�r
rrrr�<module>s4$7���

© 2025 Cubjrnet7