%PDF- %PDF-
| Direktori : /usr/lib/python3/dist-packages/samba/kcc/__pycache__/ |
| Current File : //usr/lib/python3/dist-packages/samba/kcc/__pycache__/graph.cpython-312.pyc |
�
�I�d�n � �v � d dl Z d dlZd dlmZmZmZ d dlmZ d dlm Z d dl
mZ d dlm
Z
mZmZ dZ G d� d e� Zd
� Zd� Zd� Z d)d
�Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Z d� Z!d� Z"d� Z#d� Z$d� Z% G d� de� Z& G d� d e� Z' G d!� d"e� Z( G d#� d$e� Z) G d%� d&e� Z* G d'� d(e� Z+y)*� N)�write_dot_file�verify_and_dot�verify_graph)�KCCError)�ndr_pack)�misc)�DEBUG�DEBUG_FN�WARN� �� c � � e Zd ZdZd� Zd� Zy)�ReplInfoz�Represents information about replication
NTDSConnections use one representation a replication schedule, and
graph vertices use another. This is the Vertex one.
c �J � d| _ d| _ d| _ d | _ d| _ y )Nr � )�cost�interval�options�schedule�duration��selfs �1/usr/lib/python3/dist-packages/samba/kcc/graph.py�__init__zReplInfo.__init__* s% � ��� ���
������
���
� c �X � t |� | _ t | j � | _ y)zfConvert the schedule and calculate duration
:param schedule: the schedule to convert
N)�convert_schedule_to_repltimesr �total_scheduler )r r s r �set_repltimes_from_schedulez$ReplInfo.set_repltimes_from_schedule1 s � �
6�h�?��
�&�t�}�}�5��
r N)�__name__�
__module__�__qualname__�__doc__r r � r r r r # s � ���6r r c �P � | �yd}| D ] }|dk7 s� ||dz z
}|dz }|dk7 r�� |S )a Return the total number of 15 minute windows in which the schedule
is set to replicate in a week. If the schedule is None it is
assumed that the replication will happen in every 15 minute
window.
This is essentially a bit population count.
r r � r# )r �total�bytes r r r : sO � � ���
�E�� ���a�i��T�A�X��E��Q�J�D� �a�i�� �Lr c �� � | �| j d �dgdz S g }| j d j }t d� D ]. }|j ||dz dz dz ||dz dz dz z � �0 |S )a2 Convert NTDS Connection schedule to replTime schedule.
Schedule defined in MS-ADTS 6.1.4.5.2
ReplTimes defined in MS-DRSR 5.164.
"Schedule" has 168 bytes but only the lower nibble of each is
significant. There is one byte per hour. Bit 3 (0x08) represents
the first 15 minutes of the hour and bit 0 (0x01) represents the
last 15 minutes. The first byte presumably covers 12am - 1am
Sunday, though the spec doesn't define the start of a week.
"ReplTimes" has 84 bytes which are the 168 lower nibbles of
"Schedule" packed together. Thus each byte covers 2 hours. Bits 7
(i.e. 0x80) is the first 15 minutes and bit 0 is the last. The
first byte covers Sunday 12am - 2am (per spec).
Here we pack two elements of the NTDS Connection schedule slots
into one element of the replTimes list.
If no schedule appears in NTDS Connection then a default of 0x11
is set in each replTimes slot as per behaviour noted in a Windows
DC. That default would cause replication within the last 15
minutes of each hour.
r � �T � � � r% )� dataArray�slots�range�append)r �times�data�is r r r N s� � �6 ��8�-�-�a�0�8��v��{���E����a� �&�&�D�
�2�Y� I��
���d�1�q�5�k�C�'�A�-��a�!�e�a�i��3�1F�G�H�I� �Lr c �
� t � }t | j |j � |_ | j |j z |_ | j �dgdz | _ |j �dgdz |_ t | j |j � D ��cg c]
\ }}||z �� c}}|_ t
|j � |_ t | j |j z t � |_ |S c c}}w )a� Generate an repl_info combining two others
The schedule is set to be the intersection of the two input schedules.
The duration is set to be the duration of the new schedule.
The cost is the sum of the costs (saturating at a huge value).
The options are the intersection of the input options.
The interval is the maximum of the two intervals.
:param info_a: An input replInfo object
:param info_b: An input replInfo object
:return: a new ReplInfo combining the other 2
� r* )r �maxr r r �zipr r �minr � MAX_DWORD)�info_a�info_b�info_c�a�bs r �combine_repl_infor@ u s� � � �Z�F��&�/�/�6�?�?�;�F�O��^�^�f�n�n�4�F�N� �����&�2�+���
�����&�2�+���),�V�_�_�f�o�o�)N�O���A�q�1�u�O�F�O�$�V�_�_�5�F�O��f�k�k�F�K�K�/��;�F�K��M�� Ps �C?c � � t � }| j D �]� }d}| j D ] }g |_ � |j D ]: } | j }| j D ] }|j j | � � �< |s|��t
j d� |j D � � D �
�cg c]1 \ }
}|
j j |j j f��3 }}
}| j D �cg c] }|j j �� }
}|�t d|��||
|�� |rEt ||
d�� }|r5t d|z � |D ] \ }} }t |d�d | ��� � t d
� �t | |d� t | ||� t | |d� t | ||� ��� t! | � t | d|� |s|��|D � cg c]B } | j"