%PDF- %PDF-
Mini Shell

Mini Shell

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

�

�I�d�6��f�ddlZddlmZmZmZddlmZddlmZm	Z	Gd�de
�Zd�Zd
d�Z
d	�Zy)�N)�Ldb�ldb�read_and_sub_file)�system_session)�SamDB�dsdb_Dnc��eZdZy)�	LdifErrorN)�__name__�
__module__�__qualname__���>/usr/lib/python3/dist-packages/samba/kcc/ldif_import_export.pyr
r
s��rr
c�z�|D]6}|j|tj�}|jd|z��8y)Nz%s)�
write_ldifr�CHANGETYPE_NONE�write)�samdb�f�res�msg�lstrs     r�write_search_resultr!s9���������S�%8�%8�9��	����t���rc���tjj|�rtd|z��t	|t�|dg��}|j
�	t|d�}|j|d�|r|jd|z�|jd�|j�t|t�|�	�}|S#t$r&}|j�td|�d|����d}~wwxYw)
a�Routine to import all objects and attributes that are relevant
    to the KCC algorithms from a previously exported LDIF file.

    The point of this function is to allow a programmer/debugger to
    import an LDIF file with non-security relevant information that
    was previously extracted from a DC database.  The LDIF file is used
    to create a temporary abbreviated database.  The KCC algorithm can
    then run against this abbreviated database for debug or test
    verification that the topology generated is computationally the
    same between different OSes and algorithms.

    :param dburl: path to the temporary abbreviated db to create
    :param ldif_file: path to the ldif file to import
    z3Specify a database (%s) that doesn't already exist.zmodules:)�url�session_info�lp�optionsNzfdn: @ROOTDSE
changetype: modify
replace: dsServiceName
dsServiceName: CN=NTDS Settings,%s
            zLdn: @MODULES
@LIST: rootdse,extended_dn_in,extended_dn_out_ldb,objectguid
-
zFailed to import z: )rrr)�os�path�existsr
rr�transaction_startr�add_ldif�modify_ldif�	Exception�transaction_cancel�transaction_commitr)�dburlr�	ldif_file�forced_local_dsa�tmpdb�data�estrrs        r�
ldif_to_samdbr/'s���
�w�w�~�~�e���M����	�

�E��(8��
�|�
-�E�
����G� ��D�1��
���t�T�"������#�	#�
$�	����	�
����

�e�.�*:�r�B�E��L���G�
� � �"��Y��E�F�F��G�s�AC�	C3�
!C.�.C3c
�v
�	t|t�||��}tjj|�rtd|z��	t|d�}	gd�}
d	|j�z}|j|tj|
d
��}t|||�gd�}
d	|j�z}|j|tj|
d
��}t|||�gd�}
d|j�z}|j|tj|
d��}
t|||
�|
D]O}t|j �}gd�}
d|z}|j|tj"|
��}t|||��Qg}|
D]�}t|j �}gd�}gd�}
|j|tj|
|zd��}|D]l}|j%�D]W}||vs�||D]H}t'||j)d��}t|j �}||vs�8|j+|��J�Y�nt|||���|
D]K}t|j �}gd�}
|j|tj|
d��}t|||��Mgd�}
d|j�z}|j|tj|
d��}t|||�gd�}
d|j�z}|j|tj|
dd g�!�}t|||�gd"�}
d|j�z}|j|tj|
d#��}t|||�gd�}
d|j�z}|j|tj|
d$��}t|||�gd%�}
d|j�z}|j|tj|
d&��}t|||�gd'�}
|D]1}|j|tj"|
�(�}t|||��3gd)�}
d*}|j|tj"|
�(�}tj,|d+�|d,_t|||�|j/�y#tj$r%}|j\}}td|�d|����d}~wwxYw#t$r}	td|�dt|	�����d}	~	wwxYw#tj$r%}|j\}}td-�d|����d}~wwxYw).a�Routine to extract all objects and attributes that are relevant
    to the KCC algorithms from a DC database.

    The point of this function is to allow a programmer/debugger to
    extract an LDIF file with non-security relevant information from
    a DC database.  The LDIF file can then be used to "import" via
    the import_ldif() function this file into a temporary abbreviated
    database.  The KCC algorithm can then run against this abbreviated
    database for debug or test verification that the topology generated
    is computationally the same between different OSes and algorithms.

    :param dburl: LDAP database URL to extract info from
    :param ldif_file: output LDIF file name to create
    )rr�credentialsrzUnable to open sam database (z) : Nz/Specify a file (%s) that doesn't already exist.�wzUnable to open ()�objectClass�
objectGUID�cn�whenChanged�	objectSid�Enabled�systemFlags�dnsRoot�nCNamezmsDS-NC-Replica-LocationszmsDS-NC-RO-Replica-LocationszCN=Partitions,%sz(objectClass=crossRef))�base�scope�attrs�
expression)r3r4r5r6�
fSMORoleOwnerr9�msDS-Behavior-VersionzmsDS-EnabledFeaturez(objectClass=crossRefContainer))r3r4r5r6r9zCN=Sites,%sz(objectClass=site))r3r4r5r6�interSiteTopologyGenerator�interSiteTopologyFailover�schedulerzCN=NTDS Site Settings,%s)r<r=r>)�hasMasterNCszmsDS-hasMasterNCs�hasPartialReplicaNCszmsDS-HasDomainNCszmsDS-hasFullReplicaNCszmsDS-HasInstantiatedNCs)r3r4r5r6�invocationIDrzmsDS-isRODCrAz(objectClass=nTDSDSA)�utf8)r3r4r5r6r�whenCreated�enabledConnectionrD�
transportType�
fromServerr9z(objectClass=nTDSConnection))r3r4r5r6r�name�bridgeheadServerListBL�transportAddressAttributez$CN=Inter-Site Transports,CN=Sites,%sz (objectClass=interSiteTransport))r=r>r?)
r3r4r5r6r9rrD�replInterval�siteList�costz(objectClass=siteLink)z
extended_dn:0)r=r>r?�controls)r3r4r5r6�siteLinkListz(objectClass=siteLinkBridge)z(objectClass=serversContainer))r3r4r5r6r9�dNSHostName�mailAddressz(objectClass=server))	r3r4r5r6r7r@rA�repsFrom�repsTo)r=r>)	r3r4r5r6�rootDomainNamingContext�configurationNamingContext�schemaNamingContext�defaultNamingContext�
dsServiceName�z@ROOTDSErzError processing ()rrr�LdbError�argsr
r r!r"�open�IOError�str�get_config_basedn�search�
SCOPE_SUBTREEr�dn�
SCOPE_BASE�keysr�decode�append�Dn�close)rr)r�credsr*�e�enumr.r�ioerrr>�sstrr�sitesr�sitestr�nclist�ncattrs�res_msg�k�value�dsdn�dnstr�e1s                        r�samdb_to_ldif_filer}\s���'��%�#1�#3�"'�B�0��
�w�w�~�~�i� ��I�!�"�#�	#�N���C� ��TE�
1��"�E�$;�$;�$=�=���l�l��C�,=�,=�!&�&>��@��
	�E�1�c�*�(��"�E�$;�$;�$=�=���l�l��C�,=�,=�!&�&G��I��
	�E�1�c�*� ���u�6�6�8�8�����$�c�.?�.?�#(�(<��>��
	�E�1�e�,��	/�C��#�&�&�k�G� �E�.��7�D��,�,�D����%*��,�C�
 ��q�#�.�#	/�(���%	/�C��s�v�v�;�D�2�G�.�E��,�,�D��0A�0A�%*�W�_�*A��C�C��	
5�� ����5�A��G�|�%,�Q�Z�5�E�$+�5�%�,�,�v�2F�#G�D�$'����L�E�$�F�2� &�
�
�e� 4�
5�5�	
5�
 ��q�#�.�K%	/�P�	/�C��s�v�v�;�D�
$�E��,�,�D��0A�0A�%*�*H��J�C�
 ��q�#�.�'	/�,.��6��&�&�(�)���l�l�4�s�'8�'8�!&�&H��J��
	�E�1�c�*�	����&�&�(�)���l�l�4�s�'8�'8�!&�&>�%4�$5��7��	�E�1�c�*�!���u�6�6�8�8���l�l�4�s�'8�'8�!&�&D��F��
	�E�1�c�*� ���u�6�6�8�8���l�l�4�s�'8�'8�!&�&F��H��
	�E�1�c�*� ���u�6�6�8�8���l�l�4�s�'8�'8�!&�&<��>��
	�E�1�c�*����	/�D��,�,�t�3�>�>�%*��,�C�
 ��q�#�.�	/�"�����l�l�4�s�~�~�!&��(���F�F�5�*�-��A��	�	�E�1�c�*��G�G�I��I	�<�<�'��v�v���t����&�'�	'��'���N��i��U��L�M�M��N��j�<�<�E��w�w���t���d�C�D�D��E�sU�R�S�FT�$<T�!I(T�S�- S
�
S�	S=�S8�8S=�T8� T3�3T8)N)r �sambarrr�
samba.authr�samba.samdbrrr&r
rr/r}rrr�<module>r�s3��,
�-�-�%�&�	�	�	��2�jwr

Zerion Mini Shell 1.0