%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__/uptodateness.cpython-312.pyc

�

�I�d<���ddlZddlZddlmZmZddlmZmZddlm	Z	ddl
mZddlm
Z
d�Zd�Zd	�Zd
�Zd�Zd�Zd
�Zd�Zdd�Zy)�N)�
SCOPE_BASE�LdbError)�nttime2unix�dsdb)�CommandError)�SamDB)�KCCc��ttj��}t|d��}|j|||�|j	�}t|�}t
|�t
|�k7rtdtj��||fS)z>Get a readonly KCC object and the list of DSAs it knows about.T)�readonlyzThere seem to be duplicate dsas��file)
�int�timer	�
load_samdb�	list_dsas�set�len�print�sys�stderr)�url�lp�creds�unix_now�kcc�dsa_list�dsass       �4/usr/lib/python3/dist-packages/samba/uptodateness.py�get_kcc_and_dsasrsk���4�9�9�;��H�

�h��
&�C��N�N�3��E�"��}�}��H��x�=�D�
�4�y�C��M�!�
�/�c�j�j�A���9��c���|j�}|t|j��d|j�zd|zd|zd�}i}|j�D]
\}}|||<�||fS)zOGenerate dictionaries mapping short partition names to the
    appropriate DNs.zCN=Schema,%szDC=DomainDnsZones,%szDC=ForestDnsZones,%s)�DOMAIN�
CONFIGURATION�SCHEMA�	DNSDOMAIN�	DNSFOREST)�	domain_dn�str�get_config_basedn�items)�samdb�base_dn�
short_to_long�
long_to_short�s�ls      r�get_partition_mapsr1-s����o�o��G���U�4�4�6�7� �5�#:�#:�#<�<�+�g�5�+�g�5��M��M��#�#�%����1��
�a����-�'�'r c��|�@t|�\}}|j|j�|�}||vrtd|z��|S)Nzunknown partition %s)r1�get�upperr)r+�part�short_partitions�long_partitionss    r�
get_partitionr8@sP����,>�u�,E�)��/��#�#�D�J�J�L�$�7����&��5��<�=�=��Kr c	���g}|j�}tj||�D]�}t|j�}|j|d|zddg��}	t|ddd�}|j
dd�\}}	|d	k7rtd
|z��|j|	|t|j�t|j�f���|S#t$r
}
Yd}
~
��d}
~
wwxYw)z3This finds the uptodateness vector in the database.z)(&(invocationId=%s)(objectClass=nTDSDSA))�distinguishedName�invocationId)�base�
expression�attrsr�,�NzCN=NTDS Settingsz!Expected NTDS Settings DN, got %s)r)r�_dsdb_load_udv_v2r(�source_dsa_invocation_id�search�split�
IndexErrorr�appendr�highest_usnr�last_sync_success)r+�dn�cursors�	config_dn�c�inv_id�res�settings_dn�prefix�dsa_dn�es           r�get_utdvrSKs���G��'�'�)�I�
�
#�
#�E�2�
.�;���Q�/�/�0���l�l�	�(@�BH�(I�"5�~�!F��H��	��c�!�f�%8�9�!�<�=�K�(�.�.�s�A�6�N�F�F��'�'��B�*� +�,�
,�	������A�M�M�*�#�A�$7�$7�8�:�	;�;�&�N���	���	�s�)C�	C)�$C)c��|jdtdg��}t|ddd�}ttj��}||fS)N��highestCommittedUSN)r<�scoper>r)rCrrr)r+rN�usn�nows    r�get_own_cursorrZesU��
�,�,�B�'�3�4��6�C��c�!�f�*�+�A�.�
/�C�

�d�i�i�k�
�C���:�r c	�r�i}|D]w}|jj|tdg��}d|dddz}	t|||��}	t	|	|�}
t|	�\}}||i}
|
D]\}}}}||
|<�	|
||<�y|S#t$r,}td|�d|�d�tj�	�Yd}~��d}~wwxYw)
N�dNSHostName)rWr>z	ldap://%sr)r�credentialsrzCould not contact z (�)r)
r+rCrrrSrZrrrr)�	local_kccr�part_dnrr�
utdv_edgesrQrN�ldap_urlr+rJ�own_usn�own_time�remotesrI�guidrX�trRs                   r�get_utdv_edgesrhns����J��%���o�o�$�$�V�+5�,9�?�%�<����Q��
�!6�q�!9�9��
	��h�E�b�A�E��u�g�.�G� .�u� 5��G�X��w�'�G�$+�
"� ��D�#�q�!����
"�%�
�6��!%�"����	���1�=��z�z�
#���	�s�=B�	B6�
"B1�1B6c�.�i}|D]u}	|||}i}|||<|D]^}||vr:|||vr||||z
}|||<�td|�d|��tj���Atd|ztj���`�w|S#t$r}d}Yd}~�~d}~wwxYw)NrzMissing dn z from UTD vector for dsa rz"missing dn %s from UTD vector list)�KeyErrorrrr)	rar�	distances�dn1�peakrR�d�dn2�dists	         r�get_utdv_distancesrq�s����I��'��	��c�?�3�'�D�
���	�#���
	'�C��j� ��*�S�/�)��*�S�/�#�"6�6�D�!�A�c�F��K��u�,E�c�U�K�"�z�z�+��:�S�@��:�:�'�
	'�'�$����	��D��	�s�A?�?	B�B�Bc�v�d}|j�D]#}|j�D]}t||�}��%|S)Nr)�values�max)rk�max_distance�vector�distances    r�get_utdv_max_distancerx�sH���L��"�"�$�7���
�
��	7�H��|�X�6�L�	7�7��r c���dx}}d}g}|j�D]4\}}|j�D]\}}	||k7s�|j|	���6|r�|j�|d}t|�}
|
dzdk(r&|
dzdz
}||||dzzdz}t	|d�}n|
dz
dz}||}t|�}t|�t|�dz
z}||
z
}|||d�}
|r|D�cic]}||
|��
c}S|
Scc}w)Nrg����r@g@)�maximum�median�failure)r*rF�sortr�round�float)rk�filtersr|r~r}rs�dn_outerrv�dn_innerrw�length�index�expected_length�summary�keys               r�get_utdv_summaryr��s9����G�g�
�F�
�F�%�O�O�-�(���&�"(�,�,�.�	(��H�h��8�#��
�
�h�'�	(�(�
����
���*���V����A�:��?��A�I��M�E��U�m�f�U�1�W�o�5�s�:�F��6�1�%�F��a�Z�!�O�E��E�]�F��6�]�F��i�.�C�	�N�Q�,>�?��!�F�*������G��-4�5�c��W�S�\�!�5�5����6s�#
C5)N)rr�ldbrr�sambarr�samba.netcmdr�samba.samdbr�	samba.kccr	rr1r8rSrZrhrqrxr��r r�<module>r�sI��(��$�#�%����(�&��4��2�.�#r 

Zerion Mini Shell 1.0