%PDF- %PDF-
Mini Shell

Mini Shell

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

�

�I�d���>�dZdZddlZddlZddlZddlmZmZddlm	Z	ddl
mZmZm
Z
ddlmZddlmZdd	lmZdd
lmZmZmZddlmZddlmZdd
lmZddlmZddlmZddlm Z d�Z!		dd�Z"d�Z#d�Z$d�Z%d�Z&d�Z'd�Z(dejRiZ*d�Z+d�Z,		dd�Z-y)z3Support code for upgrading from Samba 3 to Samba 4.�restructuredText�N)�Ldb�registry)�LoadParm)�	provision�ProvisioningError�setsysvolacl)�	FILL_FULL)�passdb)�param)�lsa�samr�security)�dom_sid)�Credentials)�dsdb)�ndr_pack)�unix2nttime)�generate_random_passwordc��tj�}|j�|_d|vr4tjt|d�tjd�|d<d|vr4tjt|d�tjd�|d<d|vrE|d}t|dz�}tjt|�tjd	�|d
<d|vrW|d}|dk(s
|d
k(s|dk(rd}nt|dz�}tjt|�tjd�|d<d|vrD|d}t|dz�}	tjt|	�tjd�|d<	|j|�y#tj$r%}
|jdt|
��Yd}
~
yd}
~
wwxYw)z�Import a Samba 3 policy.

    :param samdb: Samba4 SAM database
    :param policy: Samba3 account policy
    :param logger: Logger object
    zmin password length�minPwdLength�a01zpassword history�pwdHistoryLength�a02zminimum password ageg�cA�	minPwdAge�a03zmaximum password age���rl��l�����	maxPwdAge�a04zlockout duration�<�lockoutDuration�a05z"Could not set account policy, (%s)N)�ldb�Message�get_default_basedn�dn�MessageElement�str�FLAG_MOD_REPLACE�intr�modify�LdbError�warn)�samdb�policy�logger�m�min_pw_age_unix�
min_pw_age_nt�max_pw_age_unix�
max_pw_age_nt�lockout_duration_mins�lockout_duration_nt�es           �//usr/lib/python3/dist-packages/samba/upgrade.py�import_sam_policyr:*s��� 	���
�A��#�#�%�A�D���&��%�%�c�&�1F�*G�&H�&)�&:�&:�N�L��%���V�#��%�%�c�&�1C�*D�&E�&)�&:�&:�<N�P��%����'� �!7�8���_�,��4�5�
��%�%�c�-�&8�#�:N�:N�&1�3��%����'� �!7�8���b� �O�q�$8�O�z�<Y�/�M��� 0�C� 8�9�M��%�%�c�-�&8�#�:N�:N�&1�3��%���V�#� &�'9� :��)�*?�"�*D�E���%�%�c�*=�&>�&)�&:�&:�<M�O��%��B�
���Q����<�<�B����8�#�a�&�A�A��B�s�F�G�,G�Gc	��	tj�}	tj|dt|�z�|	_|dk(r�tj
t|�tjd�|	d<tj
t|�tjd�|	d<tj
t|�tjd�|	d<tj
t|�tjd�|	d<|j|	�y#tj$r/}
|jdt|�t|
��Yd}
~
yd}
~
wwxYw)	awAdd posix attributes for the user/group

    :param samdb: Samba4 sam.ldb database
    :param sid: user/group sid
    :param sid: user/group name
    :param nisdomain: name of the (fake) NIS domain
    :param xid_type: type of id (ID_TYPE_UID/ID_TYPE_GID)
    :param home: user homedir (Unix homepath)
    :param shell: user shell
    :param pgid: users primary group id
    �<SID=%s>�ID_TYPE_UID�unixHomeDirectory�
loginShell�	gidNumber�msSFU30NisDomainz7Could not add posix attrs for AD entry for sid=%s, (%s)N)
r#r$�Dnr(r&r'r)r+r,r-)r0r.�sid�name�	nisdomain�xid_type�home�shell�pgidr1r8s           r9�add_posix_attrsrJbs����K�K�M���v�v�e�Z�#�c�(�2�3����}�$�%(�%7�%7��D�	�3�/�/�1D�&F�A�!�"�!�0�0��E�
�C�0�0�,�@�A�l�O� �/�/��D�	�3�/�/��>�A�k�N�!$� 2� 2��	�N�C�0�0�2D�!F��
��	���Q����<�<�����E���H�c�!�f�	�	���s�DD�E�+%E�Ec
��	tj�}tj|dt|�z�|_|dk(rZtj
t|�tjd�|d<tj
dtjd�|d<n^|dk(rYtj
t|�tjd�|d<tj
dtjd�|d<|j|�y
#tj$r:}|jd	t|�t|�|t|��Yd
}~y
d
}~wwxYw)z�Create idmap entry

    :param samdb: Samba4 sam.ldb database
    :param sid: user/group sid
    :param xid: user/group id
    :param xid_type: type of id (ID_TYPE_UID/ID_TYPE_GID)
    :param logger: Logger object
    r<r=�	uidNumber�posixAccount�objectClass�ID_TYPE_GIDr@�
posixGroupz?Could not modify AD idmap entry for sid=%s, id=%s, type=%s (%s)N)r#r$rBr(r&r'r)�FLAG_MOD_ADDr+r,r-)r.rC�xidrFr0r1r8s       r9�add_ad_posix_idmap_entryrS�s��2��K�K�M���v�v�e�Z�#�c�(�2�3����}�$� �/�/��C��#�.�.��=�A�k�N�"�1�1��� 0� 0�-� A�A�m��
��
&� �/�/��C��#�.�.��=�A�k�N�"�1�1��c�.�.�
� ?�A�m��	���Q����<�<�2����M���H�c�#�h��#�a�&�	2�	2��2�s�D	D�E�0E�Ec
�D�d}|jdt|�z��}|jdk(rd}|r�	tj�}|dd|_tjt|�tjd�|d<tj|tjd	�|d	<|j|�y	|jdt|�zt|�d
t|�|t|�d��y#tj$r:}|jd
t|�t|�|t|��Yd}~yd}~wwxYw#tj$r:}|jdt|�t|�|t|��Yd}~yd}~wwxYw)z�Create idmap entry

    :param idmapdb: Samba4 IDMAP database
    :param sid: user/group sid
    :param xid: user/group id
    :param xid_type: type of id (ID_TYPE_UID/ID_TYPE_GID)
    :param logger: Logger object
    FzobjectSid=%s)�
expression�Trr&�	xidNumber�typez<Could not modify idmap entry for sid=%s, id=%s, type=%s (%s)NzCN=%s�sidMap)r&�cnrN�	objectSidrXrWz9Could not add idmap entry for sid=%s, id=%s, type=%s (%s))
�searchr(�countr#r$r&r'r)r+r,r-�addr)	�idmapdbrCrRrFr0�found�msgr1r8s	         r9�add_idmap_entryrb�s_��
�E�
�.�.�N�S��X�$=�.�
>�C�
�y�y�A�~����	6����
�A��q�6�$�<�A�D� �/�/��C��#�.�.��=�A�k�N��*�*��#�.�.��8�A�f�I��N�N�1��
	6��K�K�w��S��1�"�3�x�(0�&.�s�m�!)�&)�#�h�0�
1��
�|�|�	6��K�K�N��C��#�c�(�H�c�!�f�
6�
6��	6���|�|�	6��K�K�K��C��#�c�(�H�c�!�f�
6�
6��	6�s0�BD�?E�E�0E
�
E�F�%0F�Fc���	|j�}t	|j�|j
��}|}tj�}tj|d�|_
tjt|�tjd�|d<tjt|�tjd�|d<|j|�|j�D]R\}}	|dk(rd}
n|d	k(rd
}
n|jd|��)|j|	|�}t!|t#|�|	|
|��Ty#t$r%}|jdt|��Yd}~yd}~wwxYw)z�Import idmap data.

    :param idmapdb: Samba4 IDMAP database
    :param samba3_idmap: Samba3 IDMAP database to import from
    :param logger: Logger object
    z(Cannot open idmap database, Ignoring: %sNz	CN=CONFIG�
lowerBound�
lowerboundrW�UIDr=�GIDrOz+Wrong type of entry in idmap (%s), Ignoring)�get_idmap_db�IOErrorr-r(�max�get_user_hwm�
get_group_hwmr#r$rBr&r'r)r+�ids�get_sidrbr)r_�samba3r0�samba3_idmapr8�
currentxidrer1�id_typerRrFrCs            r9�import_idmaprs�sG����*�*�,��
�\�.�.�0�,�2L�2L�2N�O�J��J�	���
�A��6�6�'�;�'�A�D��(�(��J���-�-�|�=�A�l�O��'�'��J���-�-�{�<�A�k�N��N�N�1��$�(�(�*�
F�����e��$�H�
��
�$�H��K�K�E�w�O���"�"�3��0�������s�H�f�E�
F��!�����>��A��G����s�E�	E2�
E-�-E2c��	|jdt|j�ztj��}d}|r;|jdt|j�|jddd�y|jtjk(rD|jj�\}}	|tjtj �k7rytj"�}
tj$|d	�|
_|
j&j)dd
|j�|
j&j+|j-��tj.dtj0d�|
d<tj.t3|j�tj0d
�|
d
<tj.|jtj0d�|
d<|j4r2tj.|j4tj0d�|
d<|jtj6k(s|jtjk(r?tj.tt8j:�tj0d�|
d<	|j=|
dg��y#tj
$rF}|j\}}|tjk(rd}ntj
||��Yd}~���d}~wwxYw#tj
$r0}|jd|jt|��Yd}~yd}~wwxYw)z�Add or modify group from group mapping entry

    param samdb: Samba4 SAM database
    param groupmap: Groupmap entry
    param logger: Logger object
    r<)�base�scopeTFNzJGroup already exists sid=%s, groupname=%s existing_groupname=%s, Ignoring.r�sAMAccountNamez
CN=X,CN=Users�CN�grouprNr[�description�	groupTypezrelax:0)�controlsz Could not add group name=%s (%s))r\r(rCr#�
SCOPE_BASEr,�args�ERR_NO_SUCH_OBJECTr-�nt_name�sid_name_user
�SID_NAME_WKN_GRP�splitrr�SID_BUILTINr$rBr&�
set_component�add_baser%r'rQr�comment�SID_NAME_ALIASr�!GTYPE_SECURITY_DOMAIN_LOCAL_GROUPr^)r.�groupmapr0rar`�e1�ecode�emsg�
group_dom_sid�ridr1r8s            r9�add_group_from_mapping_entryr��s���	,��l�l��c�(�,�,�/�/�s�~�~��G����
����`�����%�x�'7�'7��Q��@P�9Q�RS�9T�	V�� � �C�$8�$8�8�#+�<�<�#5�#5�#7� �]�C���!1�!1�(�2F�2F�!G�G���K�K�M���v�v�e�_�-���	�����1�d�H�$4�$4�5�	���
�
�e�.�.�0�1��-�-�g�s�7G�7G��W��-���+�+�H�X�\�\�,B�C�DT�DT�,7�9��+��!�0�0��1A�1A�3�CS�CS�1A�C��
�����"�1�1�(�2B�2B�C�DT�DT�2?� A�A�m��� � �C�$6�$6�6�(�:O�:O�SV�Sg�Sg�:g� �/�/��D�4Z�4Z�0[�03�0@�0@�+�O�A�k�N�	V��I�I�a�9�+�I�.��M�<�<�,����
����C�*�*�*��E��,�,�u�d�+�+�
��,��N�|�|�	V��K�K�:�H�<L�<L�c�RS�f�U�U��	V�s/�9J:�%L�:L�
;L�L�M�)&M�Mc
��|D]�}tj�}tj|dt|j�z�|_tjdt|�ztjd�|d<	|j|���y	#tj$r�}|j\}}|tjk(r|jd||j|�nO|tjk(rtd|�d|j�d|����td|�d|j�d|����Yd	}~��:d	}~wwxYw)
z�Add user/member to group/alias

    param samdb: Samba4 SAM database
    param group: Groupmap object
    param members: List of member SIDs
    param logger: Logger object
    r<�memberrz/skipped re-adding member '%s' to group '%s': %szCould not add member 'z' to group 'z0' as either group or user record doesn't exist: z': N)r#r$rBr(rCr&r'rQr+r,r~�ERR_ENTRY_ALREADY_EXISTS�debugrr)	r.ry�membersr0�
member_sidr1r8r�r�s	         r9�add_users_to_groupr�.s.���w�
��K�K�M���v�v�e�Z�#�e�i�i�.�8�9����%�%�j�3�z�?�&B�C�DT�DT�V^�_��%��		w��L�L��O�
w���|�|�	w��F�F�M�U�D���4�4�4����N�PZ�\a�\e�\e�gk�l��#�0�0�0�'�GQ�SX�S\�S\�^b�)c�d�d�'�Yc�ej�en�en�pt�(u�v�v�	m��	w�s�B�E�'BD=�=Ec��d}|j�D�]\}\}}}|dz
}t|jdd�dd�}|dk(rd}n,|dzrt|�dkDrd}nd}nt|�dkDrd}nd}|t	j�kDrd}	nd}	|d	zd
z	}
|jdt
|jd��z|jd�d|jd�ddt|�t|	�t|
�tj|�d
t|�|d����|jdddt|�d��y)z�Import settings from a Samba3 WINS database.

    :param samba4_winsdb: WINS database to import to
    :param samba3_winsdb: WINS database to import from
    rrV�#������`�zname=%s,type=0x%s�
winsRecord�0)r&rXrDrN�
recordType�recordState�nodeType�
expireTime�isStatic�	versionID�addressz
cn=VERSION�VERSION�winsMaxVersion)r&rZrN�
maxVersionN)
�itemsr*r��len�timer^�tupler(r#�
timestring)�
samba4_winsdb�
samba3_winsdb�
version_idrD�ttl�ips�nb_flagsrX�rType�rState�nTypes           r9�import_winsr�GsS���J�(5�(;�(;�(=�#,�$��#��S�(��a��
��4�:�:�c�1�%�a�(�"�-���4�<��E�
�D�[��3�x�!�|������3�x�!�|������������F��F��T�/�a�'�����!4�u�T�Z�Z��_�7M�!M�#'�:�:�c�?�1�#5�#'�:�:�c�?�1�#5�*6�),�U��*-�f�+�'*�5�z�),����)<�'*�(+�J��&)�
+�
	,�3#,�J���\�&�&6�%(��_�6�7��HKLMc����fd�}|j�D]e}||�}|j|�D]
}||��|j|�j�D]\}\}}|j	|||���gy)z�Import a Samba 3 registry database into the Samba 4 registry.

    :param samba4_registry: Samba 4 registry handle.
    :param samba3_regdb: Samba 3 registry database handle.
    c���|jdd�\}}t|}|jdd�}�j||�S)N�/rV�\)r��SAMBA3_PREDEF_NAMES�replace�
create_key)�keypath�predef_name�	predef_id�samba4_registrys   �r9�ensure_key_existsz*import_registry.<locals>.ensure_key_exists�sE���!(���s�A�!6���g�'��4�	��/�/�#�t�,���)�)�)�W�=�=r�N)�keys�subkeys�valuesr��	set_value)	r��samba3_regdbr��key�
key_handle�subkey�
value_name�
value_type�
value_datas	`        r9�import_registryr��s����>�� � �"�E��&�s�+�
�"�*�*�3�/�	&�F��f�%�	&�6B�6I�6I�#�6N�6T�6T�6V�	E�2�Z�1�*�j�� � ��Z��D�	E�	Er�c	��	|j|tjd|z|g��}|jdkr|d|dS|j	d||�t
�#tj$r}td|�d|�d|����d	}~wwxYw)
z�Get posix attributes from a samba3 ldap backend
    :param ldbs: a list of ldb connection objects
    :param base_dn: the base_dn of the connection
    :param user: the user to get the attribute for
    :param attr: the attribute to be retrieved
    z%(&(objectClass=posixAccount)(uid=%s)))rvrU�attrsrVrz0LDAP entry for user %s contains more than one %szFailed to retrieve attribute z
 for user z, the error is: N)r\r#�
SCOPE_SUBTREEr]�warning�KeyErrorr,r)r0�
ldb_object�base_dn�user�attrrar8s       r9� get_posix_attr_from_ldap_backendr��s��������s�/@�/@�,S�/3�-5�>B�V� �E���9�9��>��q�6�$�<��?�"��N�N�M�t�UY�Z��N���<�<�s��cg�im�op� q�r�r��s�s�'A�B�/B�Bc�*�|jj�}|jjd�}|jjd�}	|jjd�}
|jjd��|jjdd�	|j	�}|s%|j�d}|jd|�|	s7|d
k(s|dk(rt
d��|j�}	|jd|	�d}
	|j|
�}|jjd�jd�dj�dk(rw|jjd�}|jjd�}|j!|�}|�t
d��|j#d�jd�}d}nd}d}d}|j%�t'j(|jjd��|j+�}	t'j,�}	|j3d|
z�}|j4j�\}}|j7d�|j9�}|j7d �|j;�}i}|D�]�}|j<j�\}}||k(r
||
k\r|d!z}
|j>t@jBk(r5	|jE|j<�}||t|j<�<��|j>t@jJk(r5	|jM|j<�}||t|j<�<��|j>t@jNk(r�|j<j�\}}|tQjRtPjT�k7r|jGd#|jH���R	|jE|j<�}||t|j<�<���|jGd$|jH|j<|j>����|j7d%�|jWd�} i}!i}"d}#| D�]�}$|r	||$d&k(r�|$d'}%|$d&dkr|j7d(|$d&|%��3|$d&|
k\r|$d&d!z}
|j3|%�}&|&jXtZj\tZj^ztZj`ztZjbzz}'|'tZj`k(rM|jGd)|%dd*z�|&jXtZj`ztZj^z|&_,�n�|'tZjbk(r|jGd+|%dd*z���0|'tZj^k(r|%d*d,k7r|jGd-|%z���a|'tZj\tZj^zk(rA|%d*d,k(r9|jGd.|%z�|&jXtZj\z|&_,�n|'tZj\tZj`zk(r@|%d*d,k(r8|jGd/|%z�|&jXtZj\z|&_,n�|'dk(r+|%d*d,k7r#|&jXtZj\z|&_,n}|'tZj\k(s|'tZj^k(rnVt
d0|%|&jXtZj\tZj^tZj`tZjbfz��|&|!|%<	|je|&j4�d|"|%<|#s|%jm�d1k(r|%}#|%jm�d2k(r|%}#	|jo|&�}(|(D]k}t|�|vrC|&j4|t|�vs�+|t|�jq|&j4��S|&j4g|t|�<�m���|j7d4|
�t|D�)cgc]})|)jH��c})�}*t| D�+cgc]}+|+d'��	c}+�},|*js|,�}-|-r7|j/d5�|-D]}.|j/d6|.z��t
d7��t|D�)cgc]})t|)j<���c})�}/tu|�tu|/�k7rt
d8��t| D�+cgc]}+d9||+d&fz��c}+�}0tu| �tu|0�k7rt
d:��|/js|0�}1|1r@|j/d;�|1D]}|j/d6t|�z��!t
d<��i}2i}3i}4|r�tw�}5|5jy|j�|5j{|�|5j}|�|jjd�jdd!�d!jd=�}6|6j�D]}7	t|7|5�>�}8n|j7dA�|jWd�} | D]�}$|$d'}%|%|"j��vs�	|rt�|8|%dB�|2|%<n"tgjh|%�j�|2|%<	|rt�|8|%dC�|3|%<n"tgjh|%�j�|3|%<	|rt�|8|%dD�|4|%<n"tgjh|%�j�|4|%<��|j7dE�d}9	|j��}9|d
k(s|dk(sdG}|#r
t�dHdI�}:nd}:t�||fidJ|�d|	�dK|�dL|�dM|
�dN|�dO|:�dPt�j��dQ|
jm��dR|�dS|�dTt��dU|�dV|�dWd�dX|�dYd��};|;j�|�|j7dZ�|9r)t�t|;j�j��|9�|j7d[�t�|;j�||�|j7d\�t�|;j�||�t�j��}<|<j�|;jj��|<jd|;jjd��|<jd]|;jjd]��|<jd^|;jjd^��t'j�|<jd��}=|;j�j��|j7d_�	|j7d`�|D]�})|)j�d*k7s�t�|;j�|)|�t�|;j�|)j<|)j�da|�t�|;j�|)j<|)jH|jm�da|�b���	|j7dc�|;j�j��|j7dd�|j7de�|!D�]�}%|%jm�d2k(rk|!|%j4tSt|�dfz�k7rD|j/dg|!|%j4�dhtSt|�dfz����t
di��|%jm�d1k(rJ|!|%j4tSt|�dfz�k(r|jGdj�n|jGdk�|=j�|!|%�|%|"vs��t�|;j�|!|%j4|"|%dl|�|%|2vs��'|2|%���.|%|3vs��4|3|%���;|%|4vs��A|4|%���Ht�|;j�|!|%j4|%|jm�dl|2|%|3|%|4|%|�m�	���|j7dn�|;j�j��	|D]H})t|)j<�|vs�t�|;j�|)|t|)j<�|��J	|j7do�|;j�j��|#r�|j7dp�|=j3d2�}>|!|#j�|>_d|!|#j�r|!|#j�|>_e|!|#j�|>_f|!|#j�r|!|#j�|>_g|=j�|>�|j7dq|#�|;jdrk(r�t�|;j�|;j�j�|;j�j�|;j�j�|;j�j�tQjR|;j��|;j�j�|;j�j�|;j|�
yy#t
$r/}t
d|jd��d	t|��d
���d}~wwxYw#t$rd}Y���wxYw#t&j.$rt1d|z��wxYw#t&j.$rd}d}Y��twxYw#t&j.$r3}|jGd"|jH|j<|�Yd}~��sd}~wwxYw#t&j.$r3}|jGd"|jH|j<|�Yd}~���d}~wwxYw#t&j.$r3}|jGd"|jH|j<|�Yd}~��d}~wwxYw#t&j.$r7	tgjh|%�jj|"|%<n#t$rYnwxYwY��qwxYw#t&j.$r)}|jGd3|%|&j4|�Yd}~���d}~wwxYwcc})wcc}+wcc})wcc}+w#t�j�$r}t
d?|7�d@|����d}~wwxYw#t$rY�	��t�$rY�	��wxYw#t$rY�	��t�$rY�	��wxYw#t$rY�
�2t�$rY�
�=wxYw#t
$r&}|jGdFt|��Yd}~�	��d}~wwxYw#|;j�j���xYw#|;j�j���xYw)sz�Upgrade from samba3 database to samba4 AD database

    :param samba3: samba3 object
    :param logger: Logger object
    :param targetdir: samba4 database directory
    :param session_info: Session information
    �	workgroup�realmznetbios namezldapsam:trustedN�yeszCould not open 'zsecrets.tdbz ', the Samba3 secrets database: zN.  Perhaps you specified the incorrect smb.conf, --testparm or --dbdir option?rz6No workgroup specified in smb.conf file, assuming '%s'�ROLE_DOMAIN_BDC�ROLE_DOMAIN_PDCz�No realm specified in smb.conf file and being a DC. That upgrade path doesn't work! Please add a 'realm' directive to your old smb.conf to let us know which one you want to use (it is the DNS name of the AD domain you wish to create.z2No realm specified in smb.conf file, assuming '%s'i�zpassdb backend�:�ldapsamzldap suffixz
ldap admin dnz�ldapsam passdb backend detected but no LDAP Bind PW found in secrets.tdb for user %s.  Please point this tool at the secrets.tdb that was used by the previous installation.zutf-8�TFzprivate dirz(Can't find domain sid for '%s', Exiting.z%s$zExporting account policyzExporting groupsrVz4Ignoring group '%s' %s listed but then not found: %szOIgnoring 'well known' group '%s' (should already be in AD, and have no members)z+Ignoring group '%s' %s with sid_name_use=%dzExporting usersr��account_namez-  Skipping wellknown rid=%d (for username=%s)zk  Demoting BDC account trust for %s, this DC must be elevated to an AD DC using 'samba-tool domain dcpromo'rzZ  Skipping inter-domain trust from domain %s, this trust must be re-created as an AD trust�$z�  Skipping account %s that has ACB_WSTRUST (W) set but does not end in $.  This account can not have worked, and is probably left over from a misconfiguration.z�  Fixing account %s which had both ACB_NORMAL (U) and ACB_WSTRUST (W) set.  Account will be marked as ACB_WSTRUST (W), i.e. as a domain memberz�  Fixing account %s which had both ACB_NORMAL (U) and ACB_SVRTRUST (S) set.  Account will be marked as ACB_WSTRUST (S), i.e. as a domain memberaFailed to upgrade due to invalid account %s, account control flags 0x%08X must have exactly one of
ACB_NORMAL (N, 0x%08X), ACB_WSTRUST (W 0x%08X), ACB_SVRTRUST (S 0x%08X) or ACB_DOMTRUST (D 0x%08X).

Please fix this account before attempting to upgrade again
�root�
administratorz)Ignoring group memberships of '%s' %s: %sz
Next rid = %dz4Following names are both user names and group names:z   %sz5Please remove common user/group names before upgrade.z9Please remove duplicate group sid entries before upgrade.z%s-%uz8Please remove duplicate user sid entries before upgrade.z,Following sids are both user and group sids:z3Please remove duplicate sid entries before upgrade.�")�credentialsz!Could not open ldb connection to z, the error message is: zExporting posix attributes�
homeDirectoryr?r@zReading WINS databasez'Cannot open wins database, Ignoring: %s�NONE�� �	targetdir�domain�	domainsid�next_rid�dc_rid�	adminpass�dom_for_fun_level�hostname�machinepass�
serverrole�
samdb_fill�useeadb�dns_backend�use_rfc2307�	use_ntvfs�skip_sysvolaclzImporting WINS databasezImporting Account policyzImporting idmap databasezstate directoryzlock directoryz
Adding groupszImporting groupsrO)r.rCrDrErFr0z+Committing 'add groups' transaction to diskzAdding userszImporting usersz-500z8User 'Administrator' in your existing directory has SID z, expected it to be zPUser 'Administrator' in your existing directory does not have SID ending in -500z,User root has been replaced by AdministratorzbUser root has been kept in the directory, it should be removed in favour of the Administrator userr=)	r.rCrDrErFrGrHrIr0zAdding users to groupsz4Committing 'add users to groups' transaction to diskz"Setting password for administratorz<Administrator password has been set to password of user '%s'z"active directory domain controller)r�lp�server_role�get�set�get_secrets_dbrir�privatedir_pathr(�domainsr��upper�get_machine_passwordr�r��strip�get_ldap_bind_pw�decode�closer�set_secrets_dir�
get_sam_db�get_global_sam_sid�error�	Exception�getsampwnam�user_sid�info�get_account_policy�enum_group_mappingrCr�r
r��
enum_aliasmemr-r��SID_NAME_DOM_GRP�enum_group_membersr�rrr��search_users�	acct_ctrlr�
ACB_NORMAL�ACB_WSTRUST�ACB_SVRTRUST�ACB_DOMTRUST�	sid_to_id�pwd�getpwnam�pw_uid�lower�enum_group_memberships�append�intersectionr�r�guess�set_bind_dn�set_passwordrr#r,r�r��pw_dir�
IndexError�pw_shell�pw_gid�get_wins_dbrrr�DS_DOMAIN_FUNCTION_2003r
�
report_loggerr��paths�winsdbr:r.rs�idmap�s3param�get_context�load�
configfile�PDB�transaction_start�gidr�rSrJ�transaction_cancel�transaction_commit�add_sam_accountr��	nt_passwd�
lanman_passwd�pass_last_set_time�
pw_history�update_sam_accountr	�netlogon�sysvol�root_uid�root_gidr��names�	dnsdomain�domaindn)?ror0r��session_infor�r�rr��
domainnamer��netbiosname�
secrets_dbr8r�r�r��ldapuser�ldappass�ldap�s3dbr��machineacct�
machinesid�
machineridr/�	grouplist�groupmembersryrCr�r�r��userlist�userdata�uids�
admin_user�entry�usernamer��	acct_type�group_memberships�g�group_names�u�
user_names�common_namesrD�
group_sids�	user_sids�common_sids�homes�shells�pgids�creds�urls�urlr�r�r��result�
new_lp_ctx�	s4_passdb�admin_userdatas?                                                               r9�upgrade_from_samba3ru�s]�����&�&�(�J������{�+�J��I�I�M�M�'�"�E��)�)�-�-��/�K�
�y�y�}�}�&�'�/��	�	�
�
�'��/�X��*�*�,�
���'�'�)�!�,�
����O�!�	#���*�*�j�<M�.M�#�%P�Q�
Q��$�$�&�E��N�N�O� �
"��H�� �5�5�k�B���y�y�}�}�%�&�,�,�S�1�!�4�:�:�<�	�I��)�)�-�-�
�.���9�9�=�=��1���.�.�x�8����#�%S�T�
T��?�?�7�+�1�1�&�9�����������������6�9�9�=�=��7�8�����D�Q��-�-�/�	�
>��&�&�u�{�':�;��
"-�!5�!5�!;�!;�!=��
�J��K�K�*�+�
�
$�
$�
&�F��K�K�"�#��'�'�)�I��L��(���9�9�?�?�$���S��)���h����7������!3�!3�3�
��,�,�U�Y�Y�7��/6��S����^�,�
�
�
�3�#7�#7�
7�
��1�1�%�)�)�<��/6��S����^�,�
�
�
�3�#7�#7�
7�#(�9�9�?�?�#4� �]�C���!1�!1�(�2F�2F�!G�G����m�!�M�M�+��
��,�,�U�Y�Y�7��/6��S����^�,�
�K�K�E��
�
�u�y�y�%�2D�2D�
F��Q(�V�K�K�!�"�� � ��#�H��H�
�D��J��J4���*��e��4����(����<�$���K�K�G��u��W_�`����<�8�#��U�|�a�'�H�����)���^�^�t���'+�'7�'7�(8�'+�'8�'8�(9�(,�'8�'8�(9�:�	���)�)�)��K�K�F�IQ�RU�SU�IV�V�
W�"�n�n��0A�0A�/A�A�T�EU�EU�U�D�N�
�$�+�+�
+��K�K�t�w�AD�BD�xE�E�
F��
�4�+�+�
,��"���1D��K�K�z�}E�E�
F��
�4�?�?�T�-=�-=�=�
>�8�B�<�SV�CV��K�K�i�lt�t�
u�"�n�n����/?�?�D�N�
�4�?�?�T�->�->�>�
?�H�R�L�TW�DW��K�K�j�mu�u�
v�"�n�n����/?�?�D�N�
�!�^����� 3�"�n�n�t���>�D�N��4�?�?�*�i�4�;K�;K�.K��$�%�
(0����'+����8H�8H�$�J[�J[�]a�]n�]n�'p�%p�q�
q�"����	�!�^�^�D�M�M�:�1�=�D��N��h�n�n�.�&�8�!�J��>�>���.�!�J�
	4� $� ;� ;�D� A��*�
?���u�:��-��}�}�L��U��,D�D�$�S��Z�0�7�7��
�
�F�04�
�
��L��U��,�
?�EJ4�X�K�K���*��)�4�Q�q�y�y�4�5�K���:�A�a��'�:�;�J��+�+�J�7�L�����K�L� �	)�D��L�L��4��(�	)�� W�X�X��)�4�Q�c�!�%�%�j�4�5�J�
�9�~��Z��(�� [�\�\��h�G��W�	�1�U�8�4�4�G�H�I�
�8�}��I��&�� Z�[�[��)�)�)�4�K�����C�D��	-�C��L�L��3�s�8�+�,�	-�� U�V�V�
�E�
�F��E���
��
���F�I�I��
���(�#�
���8�$��y�y�}�}�-�.�4�4�S�!�<�Q�?�E�E�c�J���:�:�<�	�C�
� ��%�8�
��
	��K�K�,�-�� � ��#�H������(���t�y�y�{�"�
��&F�v�z�[b�dl�n}�&~�E�(�O�&)�l�l�8�&<�&C�&C�E�(�O�
��'G��PZ�\c�em�o{�'|�F�8�$�'*�|�|�H�'=�'F�'F�F�8�$�
��&F�v�z�[b�dl�ny�&z�E�(�O�&)�l�l�8�&<�&C�&C�E�(�O��7�B�K�K�'�(��M�G��*�*�,�
�
�+�+�z�=N�/N���
�,�R��4�	��	��v�|�A�!*�A�27�A�@J�A�!*�A�5=�A�)�A�5>�A�*.�)E�)E�	A�
!,� 1� 1� 3�A�
BM�A�#-�
A�:C�
A� '�A�5@�A�NR�A�"+�A�<@�A�F����� ��K�K�)�*���C����+�+�,�m�<��K�K�*�+��f�l�l�F�F�3��K�K�*�+�����v�v�.��$�$�&�J��O�O�F�I�I�(�(�)��N�N�=�&�)�)�-�-�
�">�?��N�N�$�f�i�i�m�m�4E�&F�G��N�N�#�V�Y�Y�]�]�3C�%D�E��
�
�:�>�>�*:�;�<�I��L�L�"�"�$�
�K�K�� �
����&�'��	T�A��u�u��{�,�V�\�\�1�f�E�(����q�u�u�a�e�e�]�TZ�[��f�l�l����A�I�I�Yc�Yi�Yi�Yk�wD�MS�T�	T��K�K�=�>�
�L�L�#�#�%�
�K�K����K�K�!�"��m���>�>���.���!�*�*�g�c�)�n�v�6M�.N�N����s{�}E�tF�tO�tO�QX�Y\�]f�Yg�jp�Yp�Qq�r�s�'�(z�{�{��>�>��v�%���!�*�*�g�c�)�n�v�6M�.N�N����J�K����A�B��!�!�(�8�"4�5��t��$�V�\�\�8�H�3E�3N�3N�PT�U]�P^�`m�ou�v��E�!��h��(C��F�"���)9�)E��E�!��h��(C��f�l�l���8J�8S�8S�Zb�nx�n~�n~�oA�LY�`e�fn�`o�w}�~F�wG�NS�T\�N]�fl�m�#m�&�K�K�(�)�
�L�L�"�"�$���	V�A��1�5�5�z�\�)�"�6�<�<��L��Q�U�U��4L�f�U�	V��K�K�F�G�
�L�L�#�#�%�����8�9�"�.�.��?��#+�J�#7�#A�#A�� ��J��-�-�+3�J�+?�+M�+M�N�(�,4�Z�,@�,S�,S��)��J��*�*�(0��(<�(G�(G�N�%��$�$�^�4����R�T^�_�
���A�A��V�\�\�6�<�<�#8�#8�&�,�,�:M�:M��\�\�*�*�F�L�L�,A�,A��%�%�f�&6�&6�7����9O�9O��\�\�*�*�F�I�I�y�	B�B��]�X��io�i�i�@M�iN�PS�TU�PV�!W�X�	X��X��*������4�<�<�Q��B�Z�O�P�P�Q���<�<���
��
���2�<�<�
����R�!�M�M�5�9�9�a�9���
���<�<�
����R�!�M�M�5�9�9�a�9���
���<�<�
����R�!�M�M�5�9�9�a�9���
��H�|�|�	�
�!$���h�!7�!>�!>��X����
��
��	��&�|�|�	4��K�K�C� �$�-�-��
4�
4��	4��5��:��5��H��.�<�<�
t�'�kn�pq�(r�s�s��
t���
���
��
���
���
��
���
���
��
���G����=�s�1�v�F�F��G��@����'�'�)�
��J����'�'�)�
�s
�$AI �AJ�2AJ-�AK�3AK0�3AL9�3AN�!AO�=AP�AAP�/AQ�AQ�8AQ!�AQ&�3
AQ+�7AR�;7AR2�37AS
�AS(�2%AT�BAT�A$AT:�B0AT:�I 	AJ�I)*AJ�JAJ�JAJ*�J)AJ*�J-"AK�KAK-�K,AK-�K0AL6�L(AL1�L1AL6�L9AM?�M(AM:�M:AM?�NAO�N(AO�OAO�OAP�O"AP�PAP�P	AP�PAP�P
AP�PAP�PAP�PAQ�P+AQ�QAQ�Q+AR�Q>AR�RAR�R	AR/�R#AR/�R.AR/�R2	AS
�R>AS
�S	AS
�S
	AS%�SAS%�S$AS%�S(	AT�S1AT�TAT�TAT7�T:AU)NNN)NFNF).�__doc__�
__docformat__r#r�r$�sambarr�samba.paramr�samba.provisionrrr	�samba.provision.commonr
�samba.samba3rrr8�samba.dcerpcr
rr�samba.dcerpc.securityr�samba.credentialsrr�	samba.ndrrrrr:rJrSrbrsr�r�r��HKEY_LOCAL_MACHINEr�r�r�ru�r�r9�<module>r�s���&:�"�
�
��
�� �F�F�,��)�,�,�)�)����*�5B�pIM�%)� �F2�>(6�V$F�N5V�pw�217�j	��+�+���
E�(�,AE�CH�gBr�

Zerion Mini Shell 1.0