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

�

S��d?.��v�ddlZddlmZddlmZddlmZmZddl	m
Z
mZmZddl
mZddlmZGd�de
�Zy)	�N)�system_session)�check_and_update_fl�DS_DOMAIN_FUNCTION_2000)�Command�CommandError�Option)�SamDB)�functional_levelc	���eZdZdZdZejejejd�Z	e
dddedd�	�e
d
ddd
��e
ddgd�d��e
ddgd�d��gZdgZ
		dd�Zy)�cmd_domain_levelz(Raise domain and forest function levels.z&%prog (show|raise <options>) [options])�	sambaopts�credopts�versionoptsz-Hz--URLz%LDB URL for database or target server�URL�H)�help�type�metavar�destz-qz--quietzBe quiet�
store_true)r�actionz--forest-level�choice)�2003�2008�2008_R2�2012�2012_R2�2016zIThe forest function level (2003 | 2008 | 2008_R2 | 2012 | 2012_R2 | 2016))r�choicesrz--domain-levelzIThe domain function level (2003 | 2008 | 2008_R2 | 2012 | 2012_R2 | 2016)�
subcommandNc	
������������|dvrtd|z��|j�}	|j|	d��}
t|t	�|
|	����j��d}|dk(r2|�|j
d�s�j�d}	t�|	�	�jd	�j�ztjd
g��}
t|
�dk(sJ��j�tjd
d
g��}t|�dk(sJ��jd	�j�ztj d�zd
g���t��dk(sJ��jd�j�ztj dd
g��}t|�dk\sJ�t"�t"�d
|
dvrt%|
dd
d��d
|dvrt%|dd
d��t%|dd
d��d�|D]6}d
|vr)��t%|d
d��ks�t%|d
d���0t"�n�t"ks	�t"krtd���t"krtd����kDrtd����kDrtd��	������fd�}����������f
d�}|dk(r|rJ�|�y|dk(r	|�|r�j'�yt)d|z��#t$r}�j�|�d}~wwxYw#t$r}|r�j�|�d}~wwxYw#t$r}|r�j�|�d}~wwxYw)N)�show�raisez4invalid argument: '%s' (choose from 'show', 'raise')T)�fallback_machine)�url�session_info�credentials�lpFr#�ldap�CN=Partitions,%s�msDS-Behavior-Version)�scope�attrs��
nTMixedDomainz$(&(objectClass=crossRef)(nCName=%s)))r,�
expressionr-zCN=Sites,%sz(objectClass=nTDSDSA)rzSDomain and/or forest function level(s) is/are invalid. Correct them or reprovision!zFLowest function level of a DC is invalid. Correct this or reprovision!zVForest function level is higher than the domain level(s). Correct this or reprovision!zdDomain function level is higher than the lowest function level of a DC. Correct this or reprovision!c����jd�z��tk(r�dk7r�jd��tk(r�dk7r�jd��tk(r�dk7r�jd��jd�tj��}�jd|z��tk(r�rd}ntj��}�jd	|z�tj��}�jd
|z�y)Nz0Domain and forest function level for domain '%s'rz|
ATTENTION: You run SAMBA 4 on a forest function level lower than Windows 2000 (Native). This isn't supported! Please raise!z|
ATTENTION: You run SAMBA 4 on a domain function level lower than Windows 2000 (Native). This isn't supported! Please raise!z�
ATTENTION: You run SAMBA 4 on a lowest function level of a DC lower than Windows 2003. This isn't supported! Please step-up or upgrade the concerning DC(s)!�z!Forest function level: (Windows) z2000 mixed (NT4 DC support)z!Domain function level: (Windows) z)Lowest function level of a DC: (Windows) )�messagerr
�level_to_string)�outstr�	domain_dn�level_domain�level_domain_mixed�level_forest�min_level_dc�selfs �������;/usr/lib/python3/dist-packages/samba/netcmd/domain/level.py�do_showz%cmd_domain_level.run.<locals>.do_show�s
����L�L�K�i�W�X��6�6�;M�QR�;R����]�^��6�6�;M�QR�;R����]�^��6�6�;M�QR�;R����~���L�L���%�5�5�l�C�F��L�L�<�v�E�F��6�6�;M�6��)�9�9�,�G���L�L�<�v�E�F�%�5�5�l�C�F��L�L�D�v�M�N��c�D�
�g}�}�
���	tj�
�}|�kr�
dk(rtd��|�kDrtd���
dk7r�t	j
�}t	j��	�|_t	jdtjd�|d<�j|�t	j
�}�dj|_t	jdtjd�|d<	�j|�t	j
�}t	j��	�|_t	jt|�tjd�|d<�j|�t	j
�}�dj|_t	jt|�tjd�|d<	�j|�|}|jd	����tj��}|�krtd
��||kDrtd��t	j
�}t	j�d�j!�z�|_t	jt|�tjd�|d<�j|�|jd
�|jd��j#dj%|��y#t$rtd�
�d���wxYw#tj$r.}|j\}}|tjk7r�Yd}~��Cd}~wwxYw#tj$r.}|j\}}|tjk7r�Yd}~���d}~wwxYw)NzNew functional level 'z1' is not known to Samba as an AD functional levelrzGDomain function level can't be smaller than or equal to the actual one!zMDomain function level can't be higher than the lowest function level of a DC!�0r/r+zDomain function level changed!zGForest function level can't be smaller than or equal to the actual one!zdForest function level can't be higher than the domain function level(s). Please raise it/them first!r*zForest function level changed!z!All changes applied successfully!�
)r
�string_to_level�KeyErrorr�ldb�Message�Dn�dn�MessageElement�FLAG_MOD_REPLACE�modify�LdbError�args�ERR_UNWILLING_TO_PERFORM�str�append�get_config_basednr3�join)�msgs�current_level_domain�new_level_domain�m�e�enum�emsg�e2�new_level_forestr6�domain_level�forest_levelr7r8r9r:�res_domain_cross�samdbr;s         ����������r<�do_raisez&cmd_domain_level.run.<locals>.do_raise�sD����D�#/� ��'�A�'7�'G�'G��'U�$�$�|�3�8J�a�8O�&�'p�q�q�#�l�2�&�'v�w�w�&��*����
�A��6�6�%��3�A�D�),�);�);�C�<?�<P�<P�Ra�*c�A�o�&��L�L��O����
�A�+�A�.�1�1�A�D�),�);�);�C�<?�<P�<P�Ra�*c�A�o�&�"����Q���K�K�M���v�v�e�Y�/���-0�-?�-?��(�)�3�+?�+?�+�.-��)�*����Q���K�K�M��'��*�-�-���-0�-?�-?��(�)�3�+?�+?�+�.-��)�*���L�L��O�(8�$����<�=��'�#3�#C�#C�L�#Q� �#�|�3�&�'p�q�q�#�&:�:�&�(N�O�O��K�K�M���v�v�e�%7�%�:Q�:Q�:S�%S�T���-0�-?�-?��(�)�3�+?�+?�+�.-��)�*����Q�����<�=��K�K�;�<��L�L����4��)���I �A�&�)?��~�M~�'�A�A�A��.�<�<�"�'(�v�v���t��3�#?�#?�?�!�@��"��(�|�|��#%�7�7�L�T�4��s�;�;�;��<���s;�K>�L�M�>L�M�-#M�M�N�1#N�Nr"z)Internal Error subcommand[%s] not handled)r�get_loadparm�get_credentialsr	rr6�
startswith�transaction_startr�	Exception�transaction_cancel�searchrPrD�
SCOPE_BASE�len�
SCOPE_SUBTREEr�int�transaction_commit�AssertionError)r;r rr\r[�quietrr
rr(�creds�in_transactionrV�
res_forest�
res_domain�res_dc_s�msgr=r_r6r7r8r9r:r]r^s`  ``              @@@@@@@r<�runzcmd_domain_level.run:s������.�.��U�Xb�b�c�c�
�
#�
#�
%���(�(��d�(�C���!�.�*:�"'�B�0���O�O�%�	����� �a�i�q�|�|�F�7K��#�#�%�!�N�
�#�E�2�.�
3	����&8�5�;R�;R�;T�&T�,/�N�N�CZ�B[�&�]�J��z�?�a�'�'�'����i�s�~�~�-D�o�,V�&�X�J��z�?�a�'�'�'�$�|�|�,>��AX�AX�AZ�,Z�25�2C�2C�7]�`i�7i�3J�2K� ,� M���'�(�A�-�-�-��|�|�M�E�4K�4K�4M�$M�*-�*;�*;�H_�+B�*C�$�E�H��x�=�A�%�%�%�3�L�2�L�&�*�Q�-�7�"�:�a�=�1H�#I�!�#L�M��&�*�Q�-�7�"�:�a�=�1H�#I�!�#L�M��!$�Z��]�?�%C�A�%F�!G���L��
��*�c�1�#�+�s�3�7N�3O�PQ�3R�/S�Vb�/b�'*�3�/F�+G��+J�'K��#:�L��
��5�5��H_�9_�"�#x�y�y��5�5�"�#k�l�l��l�*�"�#{�|�|��l�*�"�$J�K�K�+�	�	�0L	�L	�\���%�%�%��I��
�7�
"�
��
�
��(�(�*���H�:�U�V�V��]�
��(�(�*����
��h�	���(�(�*��G��	��d�
�!��,�,�.����
�sP�K"�!E<L�A,L�:L*�"	L�+K=�=L�	L'�L"�"L'�*	M�3M�M)NNNFNNN)�__name__�
__module__�__qualname__�__doc__�synopsis�options�SambaOptions�CredentialsOptions�VersionOptions�takes_optiongroupsrrN�
takes_options�
takes_argsrt�r>r<rr#s���2�7�H��)�)��.�.��-�-���	�t�W�#J�QT��3�	(��t�Y�Z��E���h�8n�_�	a���h�8n�_�	a�
�M���J�FJ�DH�AWr>r)rD�samba.getopt�getoptrz�
samba.authr�
samba.dsdbrr�samba.netcmdrrr�samba.samdbr	�sambar
rr�r>r<�<module>r�s/��2��%�C�6�6��"�XW�w�XWr>

Zerion Mini Shell 1.0