%PDF- %PDF-
Mini Shell

Mini Shell

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

�

�I�d����ddlmZddlZddlZddlmZddlZddlm	Z	ddl
mZmZm
Z
mZddlmZddlmZddlmZmZmZdd	lmZmZdd
lmZddlmZddlmZmZm Z m!Z!m"Z"dd
l#m$Z$ddlm%Z%d�Z&d�Z'd�Z(d�Z)dZ*Gd�de�Z+Gd�de�Z,Gd�de�Z-Gd�de�Z.Gd�de�Z/Gd�de�Z0Gd �d!e�Z1Gd"�d#e�Z2y)$�N�)�common)�system_session)�Command�CommandError�Option�SuperCommand)�attr_default)�SamDB)�	drs_utils�
nttime2string�dsdb)�drsuapi�misc)�
join_clone)�colour)�get_partition_maps�get_utdv_edges�get_utdv_distances�get_utdv_summary�get_kcc_and_dsas)�
get_string)�get_default_backend_storec���	tj|j|j|j�\|_|_|_y#t$r}td|jz|��d}~wwxYw)z'make a DRSUAPI connection to the serverzDRS connection to %s failedN)
r�drsuapi_connect�server�lp�credsr�drsuapi_handle�bind_supported_extensions�	Exceptionr��ctx�es  �2/usr/lib/python3/dist-packages/samba/netcmd/drs.pyrr4su��J�KT�Kd�Kd�eh�eo�eo�qt�qw�qw�y|�zC�zC�LD�H���c�(�#�*G���J��8�3�:�:�E�q�I�I��J�s�AA�	A2�A-�-A2c���	td|jzt�|j|j��|_y#t$r}td|jz|��d}~wwxYw)z$make a ldap connection to the server�	ldap://%s��url�session_info�credentialsrzLDAP connection to %s failedN)rrrrr�samdbr!rr"s  r%�
samdb_connectr-<s]��K��k�C�J�J�6�'5�'7�&)�i�i�C�F�F�<��	���K��9�C�J�J�F��J�J��K�s�=A�	A'�	A"�"A'c�&�|\}}|dk(ryd||fzS)z*return "was successful" or an error stringrzwas successfulzfailed, result %u (%s)�)�werr�ecode�estrings   r%�
drs_errmsgr3Fs&����U�G���z��#�u�g�&6�6�6�c���|jd�}|ddk7s|ddk7s|ddk7rtd|z��|d	jd
�d	}|djd
�d	}||fS)z+parse a NTDS DN returning a site and server�,rzCN=NTDS Settings�z
CN=Servers�zCN=Siteszbad NTDS DN %sr�=�)�split�RuntimeError)�ntds_dn�ar�sites    r%�drs_parse_ntds_dnr@Nsz���
�
�c��A���t�!�!�Q�q�T�\�%9�Q�q�T�Z�=O��+�g�5�6�6�
�q�T�Z�Z��_�Q�
�F�
�q�T�Z�Z��_�Q�
�D��&�>�r4�classicc�F�eZdZdZdZejejejd�Z	e
ddddd�	�e
d
dddd�	�e
d
dddd�	�e
ddddd��e
ddddde��e
dddd��gZdgZ
d�Zd�Zd �Zd!d!d!d!ed"fd#�Zd$�Zd%�Zd&�Zd'�Zd(�Zd)�Zd*�Zy!)+�cmd_drs_showreplzShow replication status.�%prog [<DC>] [options]��	sambaopts�versionopts�credopts�--jsonz"replication details in JSON format�format�store_const�json)�help�dest�action�constz	--summaryz5summarize overall DRS health as seen from this server�summaryz--pull-summaryz:Have we successfully replicated from all relevant servers?�pull_summaryz--notify-summary�notify_summaryzsHave we successfully notified all relevant servers of local changes, and did they say they successfully replicated?)rOrPrNrMz	--classiczprint local replication detailsrA)rMrNrOrP�defaultz-vz	--verbosez
Be verbose�
store_true�rMrO�DC?c	�^�t|j�}|j|t|j�t|j�|jt|j�t|j�dd�}	|jjd|ztjg��	t#|j�\}}|�d|��|d	<|S#tj$r3}|j\}}|tj k(rd|d<n�Yd}~�fd}~wwxYw#t$$rY|SwxYw)
z8Convert an ldb neighbour object into a python dictionaryF)�NC dn�DSA objectGUID�last attempt time�last attempt message�consecutive failures�last success�NTDS DN�
is deletedz	<GUID=%s>��base�scope�attrsTr`N�\�DSA)�str�source_dsa_obj_guid�naming_context_dnr
�last_attemptr3�result_last_attempt�consecutive_sync_failures�last_success�source_dsa_obj_dnr,�search�ldb�
SCOPE_BASE�LdbError�args�ERR_NO_SUCH_OBJECTr@r<)	�self�n�dsa_objectguid�dr$�errno�_r?rs	         r%�parse_neighbourz cmd_drs_showrepl.parse_neighbour|s���Q�2�2�3���(�(�,�!.�q�~�~�!>�$.�q�/D�/D�$E�$%�$?�$?�)�!�.�.�9��1�.�.�/��	
��		��J�J���;��#?�$'�N�N�$&�
�
(�	�.�q�/B�/B�C�N�T�6�#'��0�A�e�H�����|�|�	����J�U�A���.�.�.�"&��,��� ��	���	����	�s*�/C�2"D�D�))D�D�	D,�+D,c�~�|jd|dz�d|vr|jd|dz�n|jd|dz�|jd|dz�|jd	|d
�d|d���|jd
|dz�|jd|dz�|jd�y)z&print one set of neighbour informationz%srYrfz	%s via RPCz	NTDS DN: %sr_z		DSA object GUID: %srZz		Last attempt @ r[� r\z		%u consecutive failure(s).r]z		Last success @ %sr^�N)�message)rurxs  r%�print_neighbourz cmd_drs_showrepl.print_neighbour�s������T�A�g�J�&�'��A�:��L�L��!�E�(�2�3��L�L��1�Y�<�7�8����.��3C�1D�D�E����1�5H�3I�34�5K�3L�N�	O����5��-�.�/�	0����,�q��/@�@�A����R�r4c�,�tj�}||_	|jj|jd|�\}}|jD�cgc]}|j|���}}|S#t
$r}t
d|z|��d}~wwxYwcc}w)Nrz"DsReplicaGetInfo of type %u failed)	r�DsReplicaGetInfoRequest1�	info_type�DsReplicaGetInforr!r�arrayr{)rur��req1�infor$rv�repss       r%�get_neighbourszcmd_drs_showrepl.get_neighbours�s����/�/�1��"���	T� $��� =� =��#�#�Q��!.��Y��
26���<�A��$�$�Q�'�<��<����	�	T��C�i�O�QR�S�S��	T��=s�*A1�B�1	B�:B	�	BNFc��|j�|_|�tj|j�}||_|j|jd��|_||_|j|j|j|j|jd�j|�}|�td|z��|�S)NT��fallback_machine)rQrSrRrLrAzunknown showrepl format %s)�get_loadparmrr�netcmd_dnsnamer�get_credentialsr�verbose�summary_output�notify_summary_output�pull_summary_output�json_output�classic_output�getr)ru�DCrFrHrGrJr��output_functions        r%�runzcmd_drs_showrepl.run�s����(�(�*���
�:��&�&�t�w�w�/�B�����-�-�d�g�g��-�M��
�����*�*�"�8�8� �4�4��$�$��*�*�
��#�f�+�
	��"��;�f�D�E�E�� � r4c�t�|j�}|d=|d=tj||jd��y)Nr?rr7��indent)�get_local_repl_datarL�dump�outf)ru�datas  r%r�zcmd_drs_showrepl.json_output�s2���'�'�)����L���N��	�	�$��	�	�!�,r4c��g}g}|j�}|dk7r2|dD]*}|dr�	|ddk7s	|ddk(s�|j|��,|dk7r2|dD]*}|dr�	|ddk7s	|ddk(s�|j|��,|s|r�|jtjd	��|r<|jtjd
��|D]}|j|��|r<|jtjd��|D]}|j|��y|jtjd
��y)zcPrint a short message if every seems fine, but print details of any
        links that seem broken.rR�repsTor`r]rr^rS�repsFromzThere are failing connectionszFailing outbound connections:zFailing inbound connection:rz
[ALL GOOD]N)r��appendrr�c_REDr��c_GREEN)ru�
typeof_output�failing_repsto�failing_repsfrom�
local_data�reps      r%�summary_output_handlerz'cmd_drs_showrepl.summary_output_handler�sb�������-�-�/�
��N�*�!�(�+�
/���|�$���-�.�!�3�s�>�7J�a�7O�"�)�)�#�.�	
/��,�,�!�*�-�
1���|�$���-�.�!�3�s�>�7J�a�7O�$�+�+�C�0�	
1��-��L�L����&E�F�G�����V�\�\�*I�J�K�)�.�C��(�(��-�.�����V�\�\�*G�H�I�+�.�C��(�(��-�.�����V�^�^�L�1�2r4c�$�|jd�S)NrQ�r��rus r%r�zcmd_drs_showrepl.summary_output�s���*�*�9�5�5r4c�$�|jd�S)NrSr�r�s r%r�z&cmd_drs_showrepl.notify_summary_output�s���*�*�+;�<�<r4c�$�|jd�S)NrRr�r�s r%r�z$cmd_drs_showrepl.pull_summary_output�s���*�*�>�:�:r4c���t|�t|�|jj�}t	|�\}}	|jj|tjgd���}tt|ddd��t|jjd|ddd��t|jjd|ddd��d�}|jj|d�	�}|jtj �}|jtj"�}	g}
|D�]3}t%|d
d�j'd�\}}
}t%|d�t%|d
d�tt|dd��tt|d
d��j)�dk(d�}|
j+|�	|jj|tjdg��}t%|ddd�|d<g|d<|j7dg�D]A}t%|�j9d�}|dj+|dt|d�f��C��6|||	|
||d�S#t$r}td|z��d}~wwxYw#tj,$r1}|j.\}}|tj0k(rd|d<Yd}~��d}~wt2t4f$rY��wxYw)N)�options�
objectGUID�invocationIdrazFailed to search NTDS DN %srr�r�r�z(objectClass=nTDSConnection))rb�
expression�
fromServerr6�name�enabledConnection�TRUE)r��	remote DNr��enabled�dnsHostName�dns nameTr`�
replicates NCzmS-DS-ReplicatesNCReason�:r:r7)�dsar�r��NTDSConnectionsr?r)rr-r,�get_dsServiceNamer@rorprqr!r�intr
r�schema_format_valuer�r�!DRSUAPI_DS_REPLICA_INFO_NEIGHBORS�DRSUAPI_DS_REPLICA_INFO_REPSTOrg�	partition�upperr�rrrsrt�KeyError�
IndexErrorr�r;)rur=r?r�ntdsr$�dsa_details�conn�repsfrom�repsto�conn_details�c�c_rdn�sep�c_server_dnrx�c_server_resryrz�rr>s                     r%r�z$cmd_drs_showrepl.get_local_repl_datas�������d���*�*�.�.�0��*�7�3���v�	H��:�:�$�$�'����Ox�$�y�D�
�<��Q���A�>�?�$�T�Z�Z�%C�%C��d�1�g�l�3�A�6�&8�9�&�t�z�z�'E�'E��d�1�g�n�5�a�8�(:�;�	
���z�z� � �g�:X� �Y���&�&�w�'P�'P�Q���$�$�W�%K�%K�L�����	=�A�&)�!�L�/�!�*<�&=�&G�&G��&L�#�E�3���A�f�I�� ��<���!3�4��|�A�y�!�<�=�&�|�A�7J�)/�(1�2�27�%�'�V�D�	�A�
����"�

�#�z�z�0�0�k�7:�~�~�8E�� 1� H��!$�L��O�M�$B�1�$E� F��*�
�"$�A�o���U�U�5�r�:�
=����F�L�L��%���/�"�)�)�1�Q�4��Q�q�T��*;�<�
=�1	=�:� ��+���

�	
��Y�	H��<�w�F�G�G��	H��@�<�<�
+��V�V�
����C�2�2�2�&*�A�l�O����j�)�
��
�s7�.J�AJ!�	J�J�J�!K5�4'K � K5�4K5c��|j�}|d}|d}|d}|d}|d}|d}|j|�d|���|jd|d	z�|jd
|dz�|jd|d
z�|jd�|D]}|j|��|jd�|D]}|j|��gd�}	|jd�|D�]Z}
|jd�|
jd�r|jd�|jd|
dz�|jdt	|
d�j�z�|jd|
jd�z�|jd|
dz�|jd�|jd|
d	z�|
drg|
dD]]\}}|jd |z�|jd!|z�|	D]+}
t
t|
d"�|zs�|jd#|
z��-�_��J|jd$���]y)%Nr�r�r�r�r?rrezDSA Options: 0x%08xr�zDSA object GUID: %sr�zDSA invocationId: %s
r�z==== INBOUND NEIGHBORS ====
z==== OUTBOUND NEIGHBORS ====
)
�NTDSCONN_KCC_GC_TOPOLOGY�NTDSCONN_KCC_RING_TOPOLOGY�#NTDSCONN_KCC_MINIMIZE_HOPS_TOPOLOGY�#NTDSCONN_KCC_STALE_SERVERS_TOPOLOGY�,NTDSCONN_KCC_OSCILLATING_CONNECTION_TOPOLOGY�"NTDSCONN_KCC_INTERSITE_GC_TOPOLOGY�NTDSCONN_KCC_INTERSITE_TOPOLOGY�%NTDSCONN_KCC_SERVER_FAILOVER_TOPOLOGY�#NTDSCONN_KCC_SITE_FAILOVER_TOPOLOGY�&NTDSCONN_KCC_REDUNDANT_SERVER_TOPOLOGYz!==== KCC CONNECTION OBJECTS ====
z
Connection --r`z'	WARNING: Connection to DELETED server!z	Connection name: %sr�z	Enabled        : %sr�z	Server DNS name : %sr�z	Server DN name  : %sr�z		TransportType: RPCz		options: 0x%08Xr�z		ReplicatesNC: %sz		Reason: 0x%08xrz			%sz)Warning: No NC replicated for Connection!)r�rr�r�rgr��getattrr)rur�r�r�r�r�r?rrv�reasonsrx�nc�reason�ss              r%r�zcmd_drs_showrepl.classic_output@sR���'�'�)���5�k���
�#���h����-�.���F�|���h�������v�.�/����*�[��-C�C�D����*�[��-F�F�G����-��N�0K�K�L����4�5��	$�A�� � ��#�	$�	
���5�6��	$�A�� � ��#�	$�	=��	
���9�:��	J�A��L�L��)��u�u�\�"����G�H��L�L�0�1�V�9�<�=��L�L�0�3�q��|�3D�3J�3J�3L�L�M��L�L�1�A�E�E�*�4E�E�F��L�L�1�A�k�N�B�C��L�L�1�2��L�L�.��9��=�>���!�"#�O�"4�9�J�B���L�L�!7�"�!<�=��L�L�!5��!>�?�$�9��"�4��A�.��7� �L�L��a��8�9�9����H�I�)	Jr4)�__name__�
__module__�__qualname__�__doc__�synopsisr��SambaOptions�VersionOptions�CredentialsOptions�takes_optiongroupsr�DEFAULT_SHOWREPL_FORMAT�
takes_options�
takes_argsr{r�r�r�r�r�r�r�r�r�r�r/r4r%rCrC[s��"�'�H��)�)��-�-��.�.���	�x�B��]�&�	B��{�#5��]�)�	E�	��(D��]�.�	J�	�!�-�%�H�#�	%�
	�{�!B��]�)�.�	0�	�t�[�|�L�I�#�M�(��J��>
�
��T��t�*��!�.-�#3�J6�=�;�=
�~6Jr4rCc�n�eZdZdZdZejejejd�Z	dgZ
		dd�Zy)�cmd_drs_kccz)Trigger knowledge consistency center run.rDrErWNc��|j�|_|�tj|j�}||_|j|jd��|_t|�tj�}	|jj|jd|�|jd|z�y#t$r}td|��d}~wwxYw)NTr�rzDsExecuteKCC failedz#Consistency check on %s successful.)r�rrr�rr�rrr�
DsExecuteKCC1�DsExecuteKCCrr!rr)rur�rFrHrGr�r$s       r%r�zcmd_drs_kcc.run�s����(�(�*���
�:��&�&�t�w�w�/�B�����-�-�d�g�g��-�M��
�����$�$�&��	9��L�L�%�%�d�&9�&9�1�d�C�	
���:�R�?�@���	9��4�a�8�8��	9�s�'B<�<	C�C�C�NNNN�r�r�r�r�r�r�r�r�r�r�r�r�r/r4r%r�r�ysD��3�'�H��)�)��-�-��.�.�����J�%)�'+�Ar4r�c�$�eZdZdZdZejejejd�Z	gd�Z
eddd��ed	d
d��eddd��ed
dd��eddd��eddd��eddd��eddd��gZ			dd�Z
			dd�Zy)�cmd_drs_replicatez+Replicate a naming context between two DCs.z/%prog <destinationDC> <sourceDC> <NC> [options]rE)�DEST_DC�	SOURCE_DC�NCz	--add-refz&use ADD_REF to add to repsTo on sourcerUrVz
--sync-forcedz,use SYNC_FORCED to force inbound replicationz
--sync-allz&use SYNC_ALL to replicate from all DCsz--full-synczresync all objectsz--localzIpull changes directly into the local database (destination DC is ignored)z--local-onlinez_pull changes into the local database (destination DC is ignored) as a normal online replicationz
--async-opz use ASYNC_OP for the replicationz--single-objectz\Replicate only the object specified, instead of the whole Naming Context (only with --local)c	���||_t|�tt�d|j|j
d��|_td|jzt�|j|j
��|_|jjdtjdg��}|ddd|_|jj|jtjd	g��}tj|jjd	|dd	d��|_tj|jj!��}tj|jj!��}|j}	t"j$}
|rt"j&}
d
}|jj)�t+j,d|jz|j
|j|j|�}|jj/�}	|j1|||	|||
|��\}
}|jj7�|r-|j9d|
|||jj:fz�y|j9d|
|||jj:fz�y#t2$r}t5d
|z|��d}~wwxYw)z+replicate from a source DC to the local SAMNr)r*r)r+r�flagsr'r(r~�
dsServiceNamerar�Tzncacn_ip_tcp:%s[seal])�rodc�	full_sync�exop�sync_forcedzError replicating DN %szMFull Replication of all %d objects and %d links from %s to %s was successful.zPIncremental replication of %d objects and %d links from %s to %s was successful.)rrrrrr�local_samdbr,rorprqr=r�GUIDr��	ntds_guid�get_invocation_idr�DRSUAPI_EXOP_NONE�DRSUAPI_EXOP_REPL_OBJ�transaction_startr�
drs_Replicate�am_rodc�	replicater!r�transaction_commitrr))rur�r�r�
single_objectr�res�source_dsa_invocation_id�dest_dsa_invocation_id�destination_dsa_guidr�replr�num_objects�	num_linksr$s                r%�drs_local_replicatez%cmd_drs_replicate.drs_local_replicate�s���
 ������!�n�.>�D�-1�Z�Z�D�G�G�'(�*����{�T�[�[�8�(6�(8�'+�z�z�d�g�g�?��
�
���%�%�2�S�^�^�-<�,=�&�?���1�v�o�.�q�1������%�%�4�<�<�s�~�~�-9�N�&�<������J�J�*�*�<�+.�q�6�,�+?��+B�
D�E���$(�9�9�T�Z�Z�-I�-I�-K�#L� �!%���4�+;�+;�+M�+M�+O�!P��#�~�~���(�(����0�0�D��I��
�
�$�$�&��&�&�'>����'L�'+�w�w�'+�z�z�4�3C�3C�'=�?�����'�'�)��		B�'+�~�~�b�6N�6J�;?�@I�;?�BM�
(6�(O�$�[�)�	
�
�
�%�%�'���L�L�9�%�y�)��*�*�.�.�0�0�
1�

�L�L�9�%�y�)��*�*�.�.�0�0�
1���	B��8�2�=�q�A�A��	B�s�5K�	K#�K�K#Nc	��||_|j�|_|
j|jd��|_|r|j|||||��y|	r6t
jd|j��}tj�}n#t|�|j}|j}|
sd|_t|�|jj|jj�dt!j"|��dt!j"|��d	�g�
�}t%|�dk(rt'd|z��|dd
}|jj|t j(dddg��}t%|�dk(rt'd|z��|ddd}t+t-|dd��}d}|t.j0zs|tj2z}|r|tj4z}|r|tj6z}|r|tj8z}|r|tj:z}|
r|tj<z}	t?j@|||||�|
r|jEd|�d|�d��y|jEd|�d|�d��y#t>jB$r}t'd|��d}~wwxYw)NTr�)rrrz
irpc:dreplsrv)�lp_ctxi,z!(&(objectCategory=server)(|(name=z)(dNSHostName=z))))rbr�rdrzFailed to find source DC %s�dnz5(|(objectCategory=nTDSDSA)(objectCategory=nTDSDSARO))r�r�)rbrcr�rdz Failed to find source NTDS DN %szDsReplicaSync failedzReplicate from z to z
 was started.z was successful.)#rr�rr�rrrr�
policy_handlerr�request_timeoutr-r,ro�get_config_basednrp�
binary_encode�lenr�SCOPE_ONELEVELr�r
r�$DS_NTDSDSA_OPT_DISABLE_OUTBOUND_REPL�DRSUAPI_DRS_WRIT_REP�DRSUAPI_DRS_ADD_REF�DRSUAPI_DRS_SYNC_FORCED�DRSUAPI_DRS_SYNC_ALL�DRSUAPI_DRS_FULL_SYNC_NOW�DRSUAPI_DRS_ASYNC_OPr�sendDsReplicaSync�drsExceptionr)rur�r�r��add_refr�sync_allr�local�local_online�async_oprrFrHrG�server_bind�server_bind_handle�msg�	server_dn�source_dsa_guid�dsa_options�req_options�estrs                       r%r�zcmd_drs_replicate.run�s���
����(�(�*����-�-�d�g�g��-�M��
���$�$�Y��i�3@�1<�
%�
>�
��!�/�/�/�$�'�'�J�K�!%�!3�!3�!5���D�!��,�,�K�!%�!4�!4���*0�K�'��d���j�j���T�Z�Z�%A�%A�%C����i�(����i�(�,*�')�	 �*��
�s�8�q�=��<�y�H�I�I���F�4�L�	��j�j���Y�c�6H�6H�+b�'3�Y�&?� �A���s�8�q�=��A�I�M�N�N��a�&��.�q�1���,�s�I�q�9�:�����d�G�G�G��7�7�7�7�K���7�6�6�6�K���7�:�:�:�K���7�7�7�7�K���7�<�<�<�K���7�7�7�7�K�	=��'�'��5G��Z\�^i�j���L�L�9�g�V�W��L�L�i�QX�Y�Z���%�%�	=��5�t�<�<��	=�s�J�J=�,J8�8J=)FFF)FFFFFFFFNNN)r�r�r�r�r�r�r�r�r�r�r�rr�rr�r/r4r%r�r��s���5�@�H��)�)��-�-��.�.���0�J�	�{�!I�R^�_���%S�\h�i��|�"J�S_�`��}�#7��M��y�j�s�	A���'H�Q]�	^��|�"D�\�Z�� �(F�O[�	\�	�M�<A�*/�(-�D1�NIN�KP�7;�E[r4r�c�n�eZdZdZdZejejejd�Z	dgZ
		dd�Zy)�cmd_drs_bindz"Show DRS capabilities of a server.rDrErWNc
��|j�|_|�tj|j�}||_|j|jd��|_t|�tj�}d|_
tj�|_|jjtjtj �|�\}}gd�}gd�}	|j#d|z�|j#d�|D]P\}
}t%t|
d�}|jj&|zrd	}
nd
}
|j#d|
d�d
|
�d|�d���Rt)|jtj*�rf|j#d�|	D]P\}
}t%t|
d�}|jj,|zrd	}
nd
}
|j#d|
d�d
|
�d|�d���R|j#d|jj.z�|j#d|jj0z�t)|jtj*�r)|j#d|jj2z�yy)NTr��)")� DRSUAPI_SUPPORTED_EXTENSION_BASE�DRS_EXT_BASE)�-DRSUAPI_SUPPORTED_EXTENSION_ASYNC_REPLICATION�DRS_EXT_ASYNCREPL)�%DRSUAPI_SUPPORTED_EXTENSION_REMOVEAPI�DRS_EXT_REMOVEAPI)�&DRSUAPI_SUPPORTED_EXTENSION_MOVEREQ_V2�DRS_EXT_MOVEREQ_V2)�+DRSUAPI_SUPPORTED_EXTENSION_GETCHG_COMPRESS�DRS_EXT_GETCHG_DEFLATE)�%DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V1�DRS_EXT_DCINFO_V1)�4DRSUAPI_SUPPORTED_EXTENSION_RESTORE_USN_OPTIMIZATION� DRS_EXT_RESTORE_USN_OPTIMIZATION)�$DRSUAPI_SUPPORTED_EXTENSION_ADDENTRY�DRS_EXT_ADDENTRY)�'DRSUAPI_SUPPORTED_EXTENSION_KCC_EXECUTE�DRS_EXT_KCC_EXECUTE)�'DRSUAPI_SUPPORTED_EXTENSION_ADDENTRY_V2�DRS_EXT_ADDENTRY_V2)�4DRSUAPI_SUPPORTED_EXTENSION_LINKED_VALUE_REPLICATION� DRS_EXT_LINKED_VALUE_REPLICATION)�%DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V2�DRS_EXT_DCINFO_V2)�8DRSUAPI_SUPPORTED_EXTENSION_INSTANCE_TYPE_NOT_REQ_ON_MOD�$DRS_EXT_INSTANCE_TYPE_NOT_REQ_ON_MOD)�'DRSUAPI_SUPPORTED_EXTENSION_CRYPTO_BIND�DRS_EXT_CRYPTO_BIND)�)DRSUAPI_SUPPORTED_EXTENSION_GET_REPL_INFO�DRS_EXT_GET_REPL_INFO)�-DRSUAPI_SUPPORTED_EXTENSION_STRONG_ENCRYPTION�DRS_EXT_STRONG_ENCRYPTION)�&DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V01�DRS_EXT_DCINFO_VFFFFFFFF)�1DRSUAPI_SUPPORTED_EXTENSION_TRANSITIVE_MEMBERSHIP�DRS_EXT_TRANSITIVE_MEMBERSHIP)�+DRSUAPI_SUPPORTED_EXTENSION_ADD_SID_HISTORY�DRS_EXT_ADD_SID_HISTORY)�&DRSUAPI_SUPPORTED_EXTENSION_POST_BETA3�DRS_EXT_POST_BETA3)�(DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V5�DRS_EXT_GETCHGREQ_V5)�,DRSUAPI_SUPPORTED_EXTENSION_GET_MEMBERSHIPS2�DRS_EXT_GETMEMBERSHIPS2)�(DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V6�DRS_EXT_GETCHGREQ_V6)�)DRSUAPI_SUPPORTED_EXTENSION_NONDOMAIN_NCS�DRS_EXT_NONDOMAIN_NCS)�(DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V8�DRS_EXT_GETCHGREQ_V8)�*DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V5�DRS_EXT_GETCHGREPLY_V5)�*DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V6�DRS_EXT_GETCHGREPLY_V6)�,DRSUAPI_SUPPORTED_EXTENSION_ADDENTRYREPLY_V3�DRS_EXT_WHISTLER_BETA3)�*DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V7ru)�)DRSUAPI_SUPPORTED_EXTENSION_VERIFY_OBJECTru)�+DRSUAPI_SUPPORTED_EXTENSION_XPRESS_COMPRESS�DRS_EXT_W2K3_DEFLATE)�)DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V10�DRS_EXT_GETCHGREQ_V10)�*DRSUAPI_SUPPORTED_EXTENSION_RESERVED_PART2�*DRS_EXT_RESERVED_FOR_WIN2K_OR_DOTNET_PART2)�*DRSUAPI_SUPPORTED_EXTENSION_RESERVED_PART3�*DRS_EXT_RESERVED_FOR_WIN2K_OR_DOTNET_PART3))� DRSUAPI_SUPPORTED_EXTENSION_ADAM�DRS_EXT_ADAM)�$DRSUAPI_SUPPORTED_EXTENSION_LH_BETA2�DRS_EXT_LH_BETA2)�'DRSUAPI_SUPPORTED_EXTENSION_RECYCLE_BIN�DRS_EXT_RECYCLE_BINzBind to %s succeeded.zExtensions supported:r�YeszNo �  �60�: z (�)z
Extended Extensions supported:z
Site GUID: %szRepl epoch: %uzForest GUID: %s)r�rrr�rr�rrr�
DsBindInfoCtr�length�DsBindInfo28r��DsBindrr�DRSUAPI_DS_BIND_GUIDrr��supported_extensions�
isinstance�DsBindInfo48�supported_extensions_ext�	site_guid�
repl_epoch�config_dn_guid)rur�rFrHrG�	bind_infor��handle�optmap�
optmap_ext�optrg�optval�yesnos              r%r�zcmd_drs_bind.runMs���(�(�*���
�:��&�&�t�w�w�/�B�����-�-�d�g�g��-�M��
�����)�)�+�	��	�� �-�-�/�	�����,�,�T�Y�Y�w�7S�7S�-T�V_�`���v�#
��JP�
�
	
���,�r�1�2����,�-� �	A�J�S�#��W�c�1�-�F��y�y�-�-��6������L�L�s�E�3�?�@�
	A��d�i�i��!5�!5�6��L�L�;�<�(�
E�
��c� ��#�q�1���9�9�5�5��>�!�E�!�E����3��s�C�D�

E�	
���&����)<�)<�<�=����%��	�	�(<�(<�<�=��d�i�i��!5�!5�6��L�L�*�T�Y�Y�-E�-E�E�F�7r4r�r�r/r4r%r;r;@sE��,�'�H��)�)��-�-��.�.�����J�%)�'+�QGr4r;c��eZdZdZdZejejejd�Z	dgZ
edddd�	�gZd
ddd
d�Z
		dd�Zy)�cmd_drs_optionszJQuery or change 'options' for NTDS Settings object of a Domain Controller.rDrErWz--dsa-optionzDSA option to enable/disablergza{+|-}IS_GC | {+|-}DISABLE_INBOUND_REPL | {+|-}DISABLE_OUTBOUND_REPL | {+|-}DISABLE_NTDSCONN_XLATE)rM�type�metavarrr7r8�)�IS_GC�DISABLE_INBOUND_REPL�DISABLE_OUTBOUND_REPL�DISABLE_NTDSCONN_XLATENc���|j�|_|�tj|j�}||_|j|jd��|_t|�|jj�}|jj|tjdg��}t|ddd�}|jD�	cgc]}	|j|	|zs�|	��}
}	|jddj!|
�z�|�rG|ddd	vrt#d
|z��|dd}||jj%�vrt#d
|z��|dddk(r||j|z}n||j|z}tj&�}tj(|j|�|_tj,t/|�tj0d�|d<|jj3|�|jD�	cgc]}	|j|	|zs�|	��}
}	|jddj!|
�z�yycc}	wcc}	w)
NTr�r�rarzCurrent DSA options: z, r)�+�-zUnknown option %sr�zNew DSA options: )r�rrr�rr�rr-r,r�rorprqr��
option_mapr�joinr�keys�Message�Dnr�MessageElementrg�FLAG_MOD_REPLACE�modify)
rur��
dsa_optionrFrHrGr=r�dsa_opts�x�cur_opts�flag�ms
             r%r�zcmd_drs_options.run�s���(�(�*���
�:��&�&�t�w�w�/�B�����-�-�d�g�g��-�M��
��d���*�*�.�.�0���j�j���W�C�N�N�9�+��V���s�1�v�i�(��+�,�� $���P�!�$�/�/�!�2D�x�2O�A�P��P����,�t�y�y��/B�B�C���"�1�~�Z�/�"�#6��#C�D�D��a�b�>�D��4�?�?�/�/�1�1�"�#6��#C�D�D��"�1�~��$��D�O�O�D�1�1���T�_�_�T�2�2�2�����
�A��6�6�$�*�*�g�.�A�D��-�-�c�(�m�S�=Q�=Q�S\�]�A�i�L��J�J���a� �#'�?�?�T�a�d�o�o�a�6H�8�6S��T�H�T��L�L�,�t�y�y��/B�B�C�#��	Q��(Us�I �,I �I%�5I%)NNNNN)r�r�r�r�r�r�r�r�r�r�r�rr�r�r�r/r4r%r�r��sw��T�'�H��)�)��-�-��.�.�����J�	�~�$B��z�	|��M�
&�*4�+5�,6�8�J�
'+�7;�%Dr4r�c
�
�eZdZdZdZejejejd�Z	e
dde��e
dde��e
d	d
dd�
�e
ddd�
�e
dddddgde�z��e
dddd��gZ
dgZ				dd�Zy) �cmd_drs_clone_dc_databasez9Replicate an initial clone of domain, but DO NOT JOIN it.z%prog <dnsdomain> [options]rEz--serverz
DC to join)rMr�z--targetdirz#where to store provision (required)z-qz--quietzBe quietrUrVz--include-secretszAlso replicate secret valuesz--backend-store�choice�BACKENDSTORE�tdb�mdbz7Specify the database backend to be used (default is %s))r�r��choicesrMz--backend-store-size�bytes�SIZEzeSpecify the size of the backend database, currentlyonly supported by lmdb backends (default is 8 Gb).)r�r�rM�domainNc��|j�}|j|�}
|j||��}|�td��t	|||
||d||	|
|��
y)N)r��quietz$--targetdir option must be specified�SAMBA_INTERNAL)
�loggerrrrr��dns_backend�	targetdir�include_secrets�
backend_store�backend_store_size)r�r��
get_loggerrr)rur�rFrHrGrr�r�r�r�r�r�rrr�s               r%r�zcmd_drs_clone_dc_database.run�sg���
#�
#�
%���(�(��,��������>�����E�F�F��&��u�� �.>�&��!.�&8�		:r4)
NNNNNFFFNN)r�r�r�r�r�r�r�r�r�r�rrgrr�r�r�r/r4r%r�r��s���C�,�H��)�)��-�-��.�.���	�z��3�7��}�#H�s�S��t�Y�Z��E��"�)G�P\�]�� �x���u�~�&�(A�(C�D�	E�	�%�G�V�I�	J��M���J�37�59�8=�37�:r4r�c
��eZdZdZdZejejejd�Z	e
ddddd�	�e
d
dd�
�e
ddd��e
ddd��e
ddd��e
ddd��gZd�Zd�Z
				dd�Zy)�cmd_drs_uptodatenesszShow uptodateness statusz%prog [options]rEz-Hz--URL�URL�Hz%LDB URL for database or target server)r�rNrMz-pz--partitionzrestrict to this partition)rMrIrUzPrint data in json format)rOrMz	--maximumz#Print maximum out-of-date-ness onlyz--medianz"Print median out-of-date-ness onlyz--fullz Print full out-of-date-ness datac�0�tj|d��S)Nr7r�)rL�dumps)ru�partitions_summariess  r%�format_as_jsonz#cmd_drs_uptodateness.format_as_json(s���z�z�.�q�9�9r4c��g}|j�D]T\}}|j�D��cgc]\}}|�d|����}}}|d�ddj|���}|j|��Vdj|�Scc}}w)Nr��15r}r��
)�itemsr�r�)	rur��lines�	part_namerQ�k�vr��lines	         r%�format_as_textz#cmd_drs_uptodateness.format_as_text+s|����"6�"<�"<�">�	��I�w�3:�=�=�?�C�4�1�a��A�&�C�E�C�!*�D�I�I�e�,<�=�D��L�L���	��y�y�����Ds�A;Nc�f�|j�}|j|d��}
t|||
�\}}|j}t	|�\}}|r||vr
||}||i}ntd|z��g}|r|j
d�|r|j
d�i}i}|j�D]7\}}t|||||
�}t||�}t||��}|||<|||<�9|r|j|�}n%|r|j|�}n|j|�}t||j��y)NTr�zunknown partition %s�maximum�median)�filters)�file)r�r�rr,rrr�r�rrrr�r��printr�)rur�r�rLr�r��fullrFrHrGr�r�rr�	local_kcc�dsasr,�short_partitionsrz�part_dnr��partitions_distancesr�r��
utdv_edges�	distancesrQ�outputs                            r%r�zcmd_drs_uptodateness.run3sY��
�
#�
#�
%���(�(��d�(�C��*�1�b�%�8��	�4�����0��7���!���,�,�*�9�5��$-�w�#7� �"�#9�I�#E�F�F�����N�N�9�%���N�N�8�$�!��!��"2�"8�"8�":�	6��I�w�'�	�4��"�e�L�J�*�:�t�<�I�&�y�'�B�G�.7� ��+�.5� ��+�	6���(�(�)=�>�F���,�,�-A�B���,�,�-A�B��
�f�4�9�9�%r4)NNFFFFNNNFF)r�r�r�r�r�r�r�r�r�r�rr�r�r�r�r/r4r%r�r�s���"� �H��)�)��-�-��.�.���	�t�W�e�#�;�	=��t�]�0�	2��x��/�	1��{�<�9�	;��z�,�8�	:��x��6�	8�
�M�:� �%)�:?�7;�!&�*&r4r�c��eZdZdZiZe�ed<e�ed<e�ed<e�ed<e	�ed<e
�ed<e�ed<y	)
�cmd_drsz0Directory Replication Services (DRS) management.�bind�kccr�showreplr�zclone-dc-database�uptodatenessN)r�r�r�r��subcommandsr;r�r�rCr�r�r�r/r4r%r�r�`sd��:��K�&�.�K���$��K���0�2�K���.�0�K�
��,�.�K�	��'@�'B�K�#�$�"6�"8�K��r4r�)3�samba.getopt�getoptr�rp�loggingr~rrL�
samba.authr�samba.netcmdrrrr	�samba.netcmd.commonr
�samba.samdbr�sambarr
r�samba.dcerpcrr�
samba.joinrr�samba.uptodatenessrrrrr�samba.commonrrrr-r3r@r�rCr�r�r;r�r�r�r�r/r4r%�<module>rs���,�
����%���-��0�0�&�!����$�1�J�K�7��$��[J�w�[J�|A�'�A�Bc[��c[�L^G�7�^G�B<D�g�<D�~+:��+:�\O&�7�O&�d
9�l�
9r4

Zerion Mini Shell 1.0