%PDF- %PDF-
Mini Shell

Mini Shell

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

�

�I�d;���ddlZddlmZddlmZmZmZddlm	Z	ddl
mZmZddl
mZddlmZmZmZmZmZmZddlmZddlmZmZmZdd	lmZGd
�de�Zy)�N)�dsdb�	remove_dc�werror)�system_session)�drsuapi�misc)�drsuapi_connect)�#DS_NTDSDSA_OPT_DISABLE_INBOUND_REPL�$DS_NTDSDSA_OPT_DISABLE_OUTBOUND_REPL�UF_PARTIAL_SECRETS_ACCOUNT�UF_SERVER_TRUST_ACCOUNT�UF_TRUSTED_FOR_DELEGATION�UF_WORKSTATION_TRUST_ACCOUNT)�Net)�Command�CommandError�Option)�SamDBc
���eZdZdZdZedde��eddded	d
��edd
e��edddd��edddd��gZejejejd�Z				dd�Z
y)�cmd_domain_demotez4Demote ourselves from the role of Domain Controller.z%prog [options]z--serverz(writable DC to write demotion changes on)�help�typez-Hz--URLz%LDB URL for database or target server�URL�H)rr�metavar�destz--remove-other-dead-serverzMDead DC (name or NTDS GUID) to remove ALL references to (rather than this DC)z-qz--quietzBe quiet�
store_true)r�actionz-vz	--verbosez
Be verbose)�	sambaopts�credopts�versionoptsNc	��|j�}	|j|	�}
|j||��}|�M|�td|zt	�|
|	��}nt|t	�|
|	��}	tj
|||�y|	jd�}t|t	�|
|	��}|s�|jdddg�	�}t|�d
k(rtd��t|�dk(rtd
��d}|D]6}t|d�j�|j�k7s�1|d}n|j�}|jt|j��tj d|zdg��}t|�d
k(sd|d
vrtd|z��|d
j"}t%t|d
d��}|jdt|�zdg��}t|�d
k7rtdt|�z��|j&j)d|z�t+||	|
�\}}}|j&j)d�tj,�}|d
j"|_|t.z�s0|j1��s|t2z}tj4t|�tj6d�|d<|j9|�|j&j)d|z�|j;�|j�|j=�fD]�}t?j@�}t|�|_t?jB�}||_"t>jF|_$tKjL|�|_'	|jQ|d|���	td|zt	�|
|	��}|j&j)d�|jt|j[��d|j]�zdg��}|d
j"} t%t|d
d��}!t|�dk7r�|t.zsv|j1�sf|j&j)d!�|t2z}tj4t|�tj6d�|d<|j9|�td"|j]�z��|!t`tbztdzz}!|!tfz}!tj,�}| |_tj4d#|!ztj6d�|d<	|j9|�|d
j"ji�}"d$|"z}#d
}$t|#�}%|jk|jm�tnjp�}&|j|&|#tjr�%�}t|�d
k7�rz|j|&d&|#|$fztjr�%�}t|�d
k7rE|$d'kr@|$dz}$|j|&d&|#|$fztjr�%�}t|�d
k7r|$d'kr�@|$d'k(r�|t.zsv|j1�sf|j&j)d�|t2z}tj4t|�tj6d�|d<|j9|�tj,�}| |_tj4d#|!ztj6d�|d<|j9|�td(t| �|#|#|$d)z
fz��d&|#|$fz}%	tjt||%�d*t|&����}'|jw| |'�|jy�}(|j=�})	t?jz�}t|(�|_>t|)�|_-d|_?|j�|d|�tj�|||"�d1d2|	jd3�zd4d5fD]6}+	|j�tjt||+�d*t|'������8tj�|||j��d6�7�|j&j)d8�y#t
j$r}
td|
z��d}
~
wwxYw#tR$r�}|jT\}}|tVjXk(rn�|j&j)d|z�|t2z}tj4t|�tj6d�|d<|j9|�tdt|�z|��Yd}~��zd}~wwxYw#t^$r�}|t.zsv|j1�sf|j&j)d�|t2z}tj4t|�tj6d�|d<|j9|�td |��d}~wwxYw#t^$r�}|t.zsv|j1�sf|j&j)d!�|t2z}tj4t|�tj6d�|d<|j9|�td |��d}~wwxYw#t^$r�}|t.zsv|j1�sf|j&j)d�|t2z}tj4t|�tj6d�|d<|j9|�tj,�}| |_tj4d#|!ztj6d�|d<|j9|�td+t| ��d,t'���|��d}~wwxYw#tR$�r1}*|*jT\}}|t.zsv|j1�sf|j&j)d�|t2z}tj4t|�tj6d�|d<|j9|�tj,�}|'|_tj4d#|!ztj6d�|d<|j9|�|jw|'| �|tVjXk(rtd-|(�d.|*����td/|(�d0|*����d}*~*wwxYw#tj�$rY���wxYw)9N)�verbose�quietz	ldap://%s)�url�session_info�credentials�lpzDemote failed: %sznetbios namez.(&(objectClass=computer)(serverReferenceBL=*))�dnsHostName�name)�
expression�attrsrzUnable to search for servers�z%You are the last server in the domainz(objectGUID=%s)�options)�base�scoper+r,zFailed to find options on %sz(fSMORoleOwner=%s)zsearch_options:1:2)r+�controlszaCurrent DC is still the owner of %d role(s), use the role command to transfer roles to another DCz,Using %s as partner server for the demotion
z!Deactivating inbound replication
z0Asking partner server %s to synchronize from us
zgError while replicating out last local changes from '%s' for demotion, re-enabling inbound replication
z6Error while sending a DsReplicaSync for partition '%s'z#Changing userControl and container
z)(&(objectClass=user)(sAMAccountName=%s$))�userAccountControl)r/r+r,z6Error while demoting, re-enabling inbound replication
z$Error while changing account controlz5Error while demoting, re-enabling inbound replicationz@Unable to find object with samaccountName = %s$ in the remote dcz%dzCN=%s)r/r+r0z%s-%d�dzOUnable to find a slot for renaming %s, all names from %s-1 to %s-%d seemed used�	�,zError while renaming z to zThe DC z= is not present on (already removed from) the remote server: z(Error while sending a removeDsServer of z: z$CN=Enterprise,CN=NTFRS SubscriptionszCN=%s, CN=NTFRS Subscriptions�realmz?CN=Domain system Volumes (SYSVOL Share), CN=NTFRS SubscriptionszCN=NTFRS SubscriptionsT)�ignore_no_namezDemote successful
)F�get_loadparm�get_credentials�
get_loggerrrr�DemoteExceptionr�get�search�len�str�lower�
get_ntds_GUID�get_config_basedn�ldb�
SCOPE_SUBTREE�dn�int�errf�writer	�Messager�am_rodcr
�MessageElement�FLAG_MOD_REPLACE�modify�get_schema_basedn�get_root_basednr�DsReplicaObjectIdentifier�DsReplicaSyncRequest1�naming_context�DRSUAPI_DRS_WRIT_REPr.r�GUID�source_dsa_guid�
DsReplicaSync�RuntimeError�argsr�WERR_DS_DRA_NO_REPLICA�	domain_dn�upper�	Exceptionr
rrr�
get_rdn_value�get_wellknown_dn�get_default_basednr�DS_GUID_COMPUTERS_CONTAINER�SCOPE_ONELEVEL�Dn�rename�get_serverName�DsRemoveDSServerRequest1�	server_dn�commit�DsRemoveDSServer�remove_sysvol_references�delete�LdbError�remove_dns_references�
host_dns_name),�selfrr r!�server�remove_other_dead_serverrr#r$r(�creds�logger�samdb�err�netbios_name�res�e�	ntds_guid�msg�ntds_dn�dsa_options�drsuapiBind�drsuapi_handle�supportedExtensions�nmsg�part�nc�req1�e1�werr�string�remote_samdb�dc_dn�uac�dc_name�rdn�i�newrdn�computer_dn�newdn�
server_dsa_dn�domain�e3�ss,                                            �</usr/lib/python3/dist-packages/samba/netcmd/domain/demote.py�runzcmd_domain_demote.runAsn���
#�
#�
%���(�(��,��������>��#�/��!��+��"6�+9�+;�*/�B�8���!�.�2B�PU�Z\�]��
>��#�#�E�6�3K�L�
��v�v�n�-���!�.�*:��RT�U����,�,�*Z�cp�rx�by�,�z�C��C��A�
�"�#A�B�B��C��A�
�"�#J�K�K��F��
���q��y�>�'�'�)�\�-?�-?�-A�A��}�-�F��
�
�'�'�)�	��l�l��E�$;�$;�$=� >�!$�!2�!2�?P�S\�?\�"+���.���s�8�q�=�I�S��V�3��=�	�I�J�J��a�&�)�)���#�c�!�f�Y�/�0�1���l�l�&:�S��\�&I�%9�$:��<���s�8�q�=�� ,� #�3�x� (�)�
)�
	
�	�	���G���	 �=L�V�UW�Y^�=_�:��n�&9��	�	���<�=��{�{�}���a�&�)�)����B�B�E�M�M�O��>�>�K�!�0�0��[�1A�3�CW�CW�Yb�c�D��O��L�L����I�I�O�O�O�$�%�
&��0�0�2��0�0�2��.�.�0�2�
y���6�6�8���D�	����4�4�6��&(��#�&�;�;���'+�y�y��';��$�
y��-�-�n�a��F�
y�2	J� �[�6�%9�.<�.>�-2�r�;�L�
�I�I�O�O�B�C��%�%�3�|�/E�/E�/G�+H�1\�&2�&8�&8�&:�2;�-A�,B�&�D�C���F�I�I�E��c�#�a�&�!5�6�7�8�C�
��H��M��"F�F�PU�P]�P]�P_��	�	���K�M��B�B��"%�"4�"4�S��5E�s�G[�G[�]f�"g��Y�����T�"�� 3�5A�5G�5G�5I� J�K�
K�	�(�*�+�+�,�-�	-��	�+�+���k�k�m�����$'�$6�$6�t�c�z�7:�7K�7K�7K�%M�� �!�
	J�����$��a�&�)�)�)�)�+������
���S���"�3�3��+�+�-��,�,�.���!�!�{�s�#�J\�J\�!�]����H��M��%�%�;�7�c�ST�X�CU�,/�,>�,>�&�@�C��c�(�a�-�A��G���E��"�)�)�{�w�RU�WX�QY�GY�03�0B�0B�*�D���c�(�a�-�A��G�
�C�x�#�&J�J�TY�Ta�Ta�Tc��I�I�O�O�Q�S��#F�F�K�&)�&8�&8��[�9I�3�K_�K_�aj�&k�D��O��L�L��&��k�k�m�����,/�,>�,>�t�c�z�?B�?S�?S�?S�-U��(�)��#�#�C�(�"�$O�$'��J��S�!�a�%�#@�$A�B�B���Q�x�'�F�	^��F�F�<�F�C��<L�)M�N�E�����u�-�&�,�,�.�
��-�-�/��	8��3�3�5�D� ��/�D�N� ��[�D�N��D�K��(�(���D�A�6	�*�*�<���I�9�1�B�F�F�7�O�C�S�*�,�	�A�
��#�#�C�F�F�<�67��U��+D�%F�G�	�	�'�'��f�e�>Q�>Q�>S�7;�	=�	
�	�	���-�.��y�,�,�
>�"�#6��#<�=�=��
>��H$�y�%'�W�W�N�T�6��v�<�<�<���	�	���@�BF�G�H�$�'J�J��*-�*<�*<�S��=M�s�Oc�Oc�en�*o��Y�����T�*�*�+c�fi�jn�fo�+o�qw�x�x���y��2�	J��"F�F�PU�P]�P]�P_��	�	���M�O��B�B��"%�"4�"4�S��5E�s�G[�G[�]f�"g��Y�����T�"��E�q�I�I��	J��@�	J��"F�F�PU�P]�P]�P_��	�	���K�M��B�B��"%�"4�"4�S��5E�s�G[�G[�]f�"g��Y�����T�"��E�q�I�I��	J��p�	^��"F�F�PU�P]�P]�P_��	�	���M�O��B�B��"%�"4�"4�S��5E�s�G[�G[�]f�"g��Y�����T�"��+�+�-�C��C�F�(+�(:�(:�4�#�:�;>�;O�;O�;O�)Q�C�$�%�
����$��#�e�*�c�RW�j�Y�[\�]�]��!	^��8�	8��W�W�N�T�6��"F�F�PU�P]�P]�P_��	�	���M�O��B�B��"%�"4�"4�S��5E�s�G[�G[�]f�"g��Y�����T�"��+�+�-�C��C�F�(+�(:�(:�4�#�:�;>�;O�;O�;O�)Q�C�$�%�
����$�����u�-��v�4�4�4�"�$1�2�$7�8�8�#�$1�2�$7�8�8��-	8��H�<�<�
��
�s��,c�(c=�>Bf8�*i�6k0�Ao;�3t9�c:�'c5�5c:�=	f5�B$f0�0f5�8	i�Bi�i�	k-�Bk(�(k-�0	o8�9C:o3�3o8�;
t6�D,t1�1t6�9u�u)NNNNNNFF)�__name__�
__module__�__qualname__�__doc__�synopsisrr?�
takes_optionsr.�SambaOptions�CredentialsOptions�VersionOptions�takes_optiongroupsr���r�rr,s���>� �H�	�z� J�QT�U��t�W�#J�QT��3�	(��+�3C�IL�	N��t�Y�Z��E��t�[�|�L�I��M��)�)��.�.��-�-���,0�%)�-1�!&�N/r�r)rC�samba.getopt�getoptr.�sambarrr�
samba.authr�samba.dcerpcrr�samba.drs_utilsr	�
samba.dsdbr
rrr
rr�	samba.netr�samba.netcmdrrr�samba.samdbrrr�r�r��<module>r�sB��2��)�)�%�&�+����6�6��c/��c/r�

Zerion Mini Shell 1.0