%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/samba/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/samba/__pycache__/dnsserver.cpython-312.pyc

�

�I�d8���ddlZddlZddlmZmZddlmZmZGd�de�Z	Gd�dej�ZGd�d	ej�ZGd
�dej�Z
Gd�d
ej�ZGd�dej�ZGd�dej�ZGd�dej�ZGd�dej�ZGd�dej�ZiZd�Ze�[dd�Zd�Zd�Zd�Zd�Zd�Zy) �N)�	dnsserver�dnsp)�WERRORError�werrorc��eZdZy)�
DNSParseErrorN)�__name__�
__module__�__qualname__���1/usr/lib/python3/dist-packages/samba/dnsserver.pyrr-s��r
rc�N��eZdZddejdf�fd�	Zedd��Z�xZS)�ARecord��rc���tt|��tj|_||z|_||_||_||_	y�N)
�superr�__init__r�
DNS_TYPE_A�wType�dwFlags�dwSerial�dwTtlSeconds�data)�self�ip_addr�serial�ttl�rank�	node_flag�	__class__s      �rrzARecord.__init__2s=���
�g�t�%�'��_�_��
��i�'�����
������	r
c��||fi|��Srr��clsr�sep�kwargss    r�from_stringzARecord.from_string;����4�"�6�"�"r
r�	r	r
rr�
DNS_RANK_ZONEr�classmethodr)�
__classcell__�r#s@rrr1s,���'(�c��8J�8J����#��#r
rc�N��eZdZddejdf�fd�	Zedd��Z�xZS)�
AAAARecordrrrc���tt|��tj|_||z|_||_||_||_	yr)
rr1rr�
DNS_TYPE_AAAArrrrr)r�ip6_addrrr r!r"r#s      �rrzAAAARecord.__init__Bs?���
�j�$�(�*��'�'��
��i�'�����
������	r
c��||fi|��Srrr%s    rr)zAAAARecord.from_stringKr*r
rr+r/s@rr1r1@s,���()�s��9K�9K����#��#r
r1c�N��eZdZddejdf�fd�	Zedd��Z�xZS)�	PTRRecordrrrc����tt|��tj|_||z|_||_||_tj�}||_t|�|_||_
yr)rr7rr�DNS_TYPE_PTRrrrrr�DNS_RPC_NAME�str�lenr)r�ptrrr r!r"�ptr_namer#s       �rrzPTRRecord.__init__Rs_���
�i��'�)��&�&��
��i�'�����
�����)�)�+������3�x�����	r
c��||fi|��Srrr%s    rr)zPTRRecord.from_string^r*r
rr+r/s@rr7r7Ps,���#$�#�D�4F�4F��
��#��#r
r7c�N��eZdZddejdf�fd�	Zedd��Z�xZS)�CNAMERecordrrrc����t�|��tj|_||z|_||_||_tj�}||_
t|�|_||_yr)
rrr�DNS_TYPE_CNAMErrrrrr:r;r<r)r�cnamerr r!r"�
cname_namer#s       �rrzCNAMERecord.__init__es]���
�����(�(��
��i�'�����
�����+�+�-�
��
���U��
����	r
c��||fi|��Srrr%s    rr)zCNAMERecord.from_stringqr*r
rr+r/s@rrArAcs,���%&�C�d�6H�6H��
��#��#r
rAc�N��eZdZddejdf�fd�	Zedd��Z�xZS)�NSRecordrrrc����tt|��tj|_||z|_||_||_tj�}||_t|�|_||_
yr)rrHrr�DNS_TYPE_NSrrrrrr:r;r<r)r�
dns_serverrr r!r"�nsr#s       �rrzNSRecord.__init__xs_���
�h��&�(��%�%��
��i�'�����
����
�
#�
#�
%������Z������	r
c��||fi|��Srrr%s    rr)zNSRecord.from_string�r*r
rr+r/s@rrHrHvs,���*+��4�;M�;M��
��#��#r
rHc�N��eZdZddejdf�fd�	Zedd��Z�xZS)�MXRecordrrrc���tt|��tj|_||z|_||_||_tj�}||_||j_
t|�|j_||_yr)rrOrr�DNS_TYPE_MXrrrrr�DNS_RPC_RECORD_NAME_PREFERENCE�wPreference�nameExchanger;r<r)	r�mail_server�
preferencerr r!r"�mxr#s	        �rrzMXRecord.__init__�sq���
�h��&�(��%�%��
��i�'�����
����
�
5�
5�
7��#���)�����!�+�.�������	r
c��	|j|�\}}t|�}|||fi|��S#t$r}td|z�|�d}~wwxYw)Nz?MX data must have server and priority (space separated), not %r)�split�int�
ValueErrorr)r&rr'r(�server�priority�es       rr)zMXRecord.from_string�sk��	K�#�z�z�#���F�H��8�}�H��6�8�.�v�.�.���	K��!<�>B�!C�D�IJ�
K��	K�s�+�	A�A�Arr+r/s@rrOrO�s,���78�c��(�(�A���/��/r
rOc�j��eZdZddddddejej
f�fd�	Zedd��Z�xZ	S)	�	SOARecordrriXi�Qic���tt|��tj|_|	|
z|_||_||_tj�}||_||_||_
||_||_||j _t%|�|j _||j&_t%|�|j&_||_yr)rr`rr�DNS_TYPE_SOArrrrr�DNS_RPC_RECORD_SOA�
dwSerialNo�	dwRefresh�dwRetry�dwExpire�dwMinimumTtl�NamePrimaryServerr;r<�ZoneAdministratorEmailr)
r�mname�rnamer�refresh�retry�expire�minimumr r!r"�soar#s
            �rrzSOARecord.__init__�s����	�i��'�)��&�&��
��i�'�����
�����*�*�,�������
�������"���$)����!�$'��J����!�).��"�"�&�),�U���"�"�&���	r
c���|j|�}t|�dk7rtd��	tdd�D]}t	||�||<�	||i|��S#t
$r}td�|�d}~wwxYw)N�zhData requires 7 space separated elements - nameserver, email, serial, refresh, retry, expire, minimumttl�zBSOA serial, refresh, retry, expire, minimumttl' should be integers)rYr<r�rangerZr[)r&rr'r(�args�ir^s       rr)zSOARecord.from_string�s����z�z�#����t�9��>��!E�F�
F�	=��1�a�[�
'���d�1�g�,��Q��
'�
�D�#�F�#�#���	=��!5�6�;<�
=��	=�s�"A�	A1� A,�,A1r)
r	r
rrr,�DNS_RPC_FLAG_AUTH_ZONE_ROOTrr-r)r.r/s@rr`r`�s;���,-�s�#��t��D�<N�<N��;�;��(�$��$r
r`c�R��eZdZddddejdf�fd�	Zedd��Z�xZS)�	SRVRecordr�drrc	�:��tt|��tj|_||z|_||_||_tj�}	||	_||	_||	_
||	j_t!|�|	j_|	|_yr)rrzrr�DNS_TYPE_SRVrrrrr�DNS_RPC_RECORD_SRV�	wPriority�wWeight�wPort�
nameTargetr;r<r)r�target�portr]�weightrr r!r"�srvr#s          �rrzSRVRecord.__init__�s~���
�i��'�)��&�&��
��i�'�����
�����*�*�,�� ��
������	�#����� ��[�������	r
c��	|j|�\}}}}	|t|�t|�t|�f}	||	i|��S#t$r}td|z�|�d}~wwxYw#t$r}td�|�d}~wwxYw)NzXSRV data must have four space separated elements: server, port, priority, weight; not %rz/SRV port, priority, and weight must be integers)rYr[rrZ)
r&rr'r(r�r�r]r�r^rvs
          rr)zSRVRecord.from_string�s���	8�-1�Z�Z��_�*�F�D�(�F�	;��C��I�s�8�}�c�&�k�B�D�
�D�#�F�#�#���	8��!)�,0�!0�1�78�
8��	8���	;��!3�4�9:�
;��	;�s.�A�!A"�	A�A�A�"	A<�+A7�7A<rr+r/s@rrzrz�s0���./��A�3��(�(�A�
��$��$r
rzc�N��eZdZddejdf�fd�	Zedd��Z�xZS)�	TXTRecordrrrc���tt|��tj|_||z|_||_||_t|t�r|g}g}|D]>}tj�}||_
t|�|_
|j|��@tj�}	t|�|	_||	_
|	|_yr)rr�rr�DNS_TYPE_TXTrrrr�
isinstancer;rr:r<�append�DNS_RPC_RECORD_STRING�countr)r�slistrr r!r"�names�s�name�txtr#s          �rrzTXTRecord.__init__�s����
�i��'�)��&�&��
��i�'�����
�����e�S�!��G�E����	�A��)�)�+�D��D�H��1�v�D�H��L�L���		�
�-�-�/����J��	������	r
c�>�tj|�}||fi|��Sr)�shlexrY)r&rr'r(r�s     rr)zTXTRecord.from_strings �����D�!���5�#�F�#�#r
rr+r/s@rr�r��s,���%&�C�d�6H�6H���(�$��$r
r�c��t�j�D]8\}}|dddk(s�|dd}ttd|z�}|t|<|t|<�:y)Ni�����Record�	DNS_TYPE_)�globals�items�getattrr�_RECORD_TYPE_LUT)�k�v�flags   r�_setup_record_type_lutr�s]���	���!�'���1��R�S�6�X���#�2��A��4��q��1�D�"#��Q��%&��T�"�'r
c��t|t�r|j�}	t|}|j|fd|i|��S#t$r}td�|�d}~wwxYw)z�Get a DNS record of type t based on the data string.
    Additional keywords (ttl, rank, etc) can be passed in.

    t can be a dnsp.DNS_TYPE_* integer or a string like "A", "TXT", etc.
    zUnsupported record typeNr')r�r;�upperr��KeyErrorrr))�trr'r(r�r^s      r�record_from_stringr�sg���!�S��
�G�G�I��>�!�!�$���6���d�6��6�v�6�6���>��5�6�A�=��>�s�	A�	A�	A�Ac��|j�}	ttd|z�S#t$r}t	d|z�|�d}~wwxYw)Nr�zUnknown type of DNS record %s)r�r�r�AttributeErrorr)�rec_type�rtyper^s   r�flag_from_stringr�(sK���N�N��E�O��t�[�5�0�1�1���O��;�h�F�G�Q�N��O�s�%�	A�=�Ac�R�t|i|��}tj�}||_|Sr)r�r�DNS_RPC_RECORD_BUF�rec)rvr(r��bufs    r�recbuf_from_stringr�0s+��
�d�
-�f�
-�C�
�
&�
&�
(�C��C�G��Jr
c��|jjd�j�|jjd�j�k(S)z%Match dns name (of type DNS_RPC_NAME)�.)r;�rstrip�lower)�n1�n2s  r�dns_name_equalr�7s9��
�6�6�=�=���#�#�%������s�);�)A�)A�)C�C�Cr
c��tjtj|�}tjtj|�S)z.Convert an AAAA address into a canonical form.)�socket�	inet_pton�AF_INET6�	inet_ntop)�addr�packeds  r�ipv6_normaliser�<s/��
�
�
�f�o�o�t�
4�F����F�O�O�V�4�4r
c�
�t||�}tj}	|jtjd|||d||dd�
\}}	|	r|	jdk(ry|	jdjD�]�}|j|k7r�d}|tjk(r|j|jk(�rUd}�nQ|tj k(r0t#|j�t#|j�k(�rd}�n|tj$k(r%t'|j|j��r�d}�n�|tj(k(r%t'|j|j��r�d}�n�|tj*k(r%t'|j|j��rjd}�nf|tj,k(rgt'|jj.|jj.��r|jj0|jj0k(�r�d}�n�|tj2k(r�|jj4|jj4k(�r�|jj6|jj6k(�r}|jj8|jj8k(�rOt'|jj:|jj:��rd}�n|tj<k(�rQ|jj>|jj>k(�r�|jj@|jj@k(�r�|jjB|jjBk(�rx|jjD|jjDk(�rJ|jjF|jjFk(�rt'|jjH|jjH�r�t'|jjJ|jjJ�r�d}n�|tjLk(r�|jj|jjk(rqd}tO|jj�D]M}
|xrG|jjP|
jP|jjP|
jPk(}�O|s���|cSy#t
$r,}
|
jdtjk(rYd}
~
y|
�d}
~
wwxYw)z1Find a dns record that matches the specified datarNFT))r�r�DNS_RPC_VIEW_AUTHORITY_DATA�DnssrvEnumRecords2�DNS_CLIENT_VERSION_LONGHORNrrvr�"WERR_DNS_ERROR_NAME_DOES_NOT_EXISTr�r��recordsrrrrr3r�r9r�rCrJrQrTrSr}rr�r�r�rbrdrerfrgrhrirjr�rur;)�dns_connr\�zoner��record_typer�urec�select_flags�buflen�resr^r��foundrws              r�dns_record_matchr�Bs����k�4�0�D��8�8�L�	��1�1��1�1�1�f�d�D�$���t�T�3�����#�)�)�q�.���w�w�q�z�!�!�1���9�9��#�����$�/�/�)��x�x�4�9�9�$���
�D�.�.�
.��c�h�h�'�>�$�)�)�+D�D���
�D�-�-�
-��c�h�h��	�	�2���
�D�/�/�
/��c�h�h��	�	�2���
�D�,�,�
,��c�h�h��	�	�2���
�D�,�,�
,��c�h�h�3�3�T�Y�Y�5K�5K�L��x�x�#�#�t�y�y�'<�'<�<���
�D�-�-�
-��x�x�!�!�T�Y�Y�%8�%8�8��x�x���4�9�9�#4�#4�4��x�x�~�~������0��c�h�h�1�1�4�9�9�3G�3G�H���
�D�-�-�
-��x�x�"�"�d�i�i�&:�&:�:��x�x�!�!�T�Y�Y�%8�%8�8��x�x���4�9�9�#4�#4�4��x�x� � �D�I�I�$6�$6�6��x�x�$�$��	�	�(>�(>�>��c�h�h�8�8�"�i�i�9�9�;��c�h�h�=�=�"�i�i�>�>�@���
�D�-�-�
-��x�x�~�~������0����s�x�x�~�~�.�J�A�!�J� �X�X�\�\�!�_�0�0�D�I�I�M�M�!�4D�4H�4H�H��J���J�c1�f��{���6�6�!�9��A�A�A������s�+T�	U� U�U�Ur)r�r��samba.dcerpcrr�sambarrr[r�DNS_RPC_RECORDrr1r7rArHrOr`rzr�r�r�r�r�r�r�r�r�rr
r�<module>r�s���&
�
�(�%�.	�J�	�#�i�&�&�#�
#��)�)�
#� #�	�(�(�#�&#�)�*�*�#�&#�y�'�'�#�&/�y�'�'�/�4#$�	�(�(�#$�L $�	�(�(� $�F$�	�(�(�$�>��'����
7� O��D�
5�Sr

Zerion Mini Shell 1.0