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

�

�I�d)���dZddlmZddlmZmZmZddlmZddl	m
Z
ddlmZddl
mZddlmZdd	lmZdd
lmZmZdd�ZGd
�de�Zd�Zd�Z			dd�Zy)z(Functions for setting up a Samba Schema.�)�	b64encode)�read_and_sub_file�substitute_var�check_all_substituted)�security)�read_ms_schema)�ndr_pack)�SamDB��
get_string)�dsdb)�
SCOPE_SUBTREE�SCOPE_ONELEVELNc�d�|�i}d}tjj||�}t|�S)Na�O:SAG:SAD:AI(OA;;CR;e12b56b6-0a95-11d1-adbb-00c04fd8d5cd;;SA)(OA;;CR;1131f6aa-9c07-11d1-f79f-00c04fc2dcd2;;ED)(OA;;CR;1131f6ab-9c07-11d1-f79f-00c04fc2dcd2;;ED)(OA;;CR;1131f6ac-9c07-11d1-f79f-00c04fc2dcd2;;ED)(OA;;CR;1131f6aa-9c07-11d1-f79f-00c04fc2dcd2;;BA)(OA;;CR;1131f6ab-9c07-11d1-f79f-00c04fc2dcd2;;BA)(OA;;CR;1131f6ac-9c07-11d1-f79f-00c04fc2dcd2;;BA)(A;CI;RPLCLORC;;;AU)(A;CI;RPWPCRCCLCLORCWOWDSW;;;SA)(A;CI;RPWPCRCCDCLCLORCWOWDSDDTSW;;;SY)(OA;;CR;1131f6ad-9c07-11d1-f79f-00c04fc2dcd2;;ED)(OA;;CR;89e95b76-444d-4c62-991a-0facbeda640c;;ED)(OA;;CR;1131f6ad-9c07-11d1-f79f-00c04fc2dcd2;;BA)(OA;;CR;89e95b76-444d-4c62-991a-0facbeda640c;;BA)(OA;;CR;1131f6aa-9c07-11d1-f79f-00c04fc2dcd2;;RO)(OA;;CR;1131f6ad-9c07-11d1-f79f-00c04fc2dcd2;;RO)(OA;;CR;89e95b76-444d-4c62-991a-0facbeda640c;;RO)S:(AU;SA;WPCCDCWOWDSDDTSW;;;WD)(AU;CISA;WP;;;WD)(AU;SA;CR;;;BA)(AU;SA;CR;;;DU)(OU;SA;CR;e12b56b6-0a95-11d1-adbb-00c04fd8d5cd;;WD)(OU;SA;CR;45ec5156-db7e-47bb-b53f-dbeb2d03c40f;;WD))r�
descriptor�	from_sddlr	)�
domain_sid�name_map�sddl�secs    �./usr/lib/python3/dist-packages/samba/schema.py�get_schema_descriptorr$s9������A�D�.�
�
�
'�
'��j�
9�C��C�=��c�j�eZdZddddddd�Z			dd	�Zed
��Zed��Zd�Zd
�Z	d�Z
d�Zd�Zy)�Schema)z"MS-AD_Schema_2K8_R2_Attributes.txtzMS-AD_Schema_2K8_R2_Classes.txt�/)z0Attributes_for_AD_DS__Windows_Server_2008_R2.ldfz-Classes_for_AD_DS__Windows_Server_2008_R2.ldfr)z-Attributes_for_AD_DS__Windows_Server_2012.ldfz*Classes_for_AD_DS__Windows_Server_2012.ldf�8)z,AD_DS_Attributes__Windows_Server_2012_R2.ldfz)AD_DS_Classes__Windows_Server_2012_R2.ldf�E)z*AD_DS_Attributes__Windows_Server_v1803.ldfz'AD_DS_Classes__Windows_Server_v1803.ldf�W)z)AD_DS_Attributes_Windows_Server_v1903.ldfz&AD_DS_Classes_Windows_Server_v1903.ldf�X)�2008_R2_old�2008_R2�2012�2012_R2�2016�2019Nc�T��ddlm}	|�tj�}||_||_t
dd��|_|�|jj|�t|dtj|dz�|dtj|dz��|_d��|�dj�fd	�|D��|_t|jd
|i�|_t|j�ttj!|��}	t#|d�||	d��|_t't)|��j+d
�}
t#|d�||
d��|_|�||_n�|d��|_|�+|xj.djd�|D��z
c_t'|j.�j+d
�|_d|j
�d|j.�d�}|j1||j|j
�y)Nr)�
setup_pathF)�
global_schema�am_rodczad-schema/%s�c�f�t|d�5}|j�cddd�S#1swYyxYw)N�rb)�open�read)�file�	data_files  r�	read_filez"Schema.__init__.<locals>.read_filezs-���d�D�!�
(�Y� �~�~�'�
(�
(�
(�s�'�0�c3�@�K�|]}t�|�����y�w�Nr)�.0r0r2s  �r�	<genexpr>z"Schema.__init__.<locals>.<genexpr>s"�����':�+/�(2�)�D�/�'B�':�s��SCHEMADNz#provision_schema_basedn_modify.ldif)r8�
OBJVERSION�utf8zprovision_schema_basedn.ldif)r8�
DESCRIPTORz
prefixMap.txtc3�&K�|]	}d|z���y�w)z%s
N�)r6�maps  rr7z"Schema.__init__.<locals>.<genexpr>�s����*X�C�6�C�<�*X�s�zdn: z
prefixMap:: z

)�samba.provisionr(r�default_base_schema�base_schema�schemadnr
�ldb�set_invocation_idr�base_schemas�schema_data�joinrr�str�get_versionr�schema_dn_modifyrr�decode�
schema_dn_add�prefixmap_data�
set_from_ldif)
�selfr�invocationidrB�files�override_prefixmap�additional_prefixmaprAr(�schema_version�descr�prefixmap_ldifr2s
            @r�__init__zSchema.__init__[s���	/�	��� �4�4�6�K�&��� ��
��u�e�<����#��H�H�&�&�|�4�)��~��(;�(;�K�(H��(K�K�L��~��(;�(;�K�(H��(K�K�L�N���	(���!�w�w�':�38�':� :�D��*�$�*:�*:�+5�x�*@�B����d�.�.�/��V�/�/��<�=�� 1��<�=�!��@�!B����/�
�;�<�C�C�F�K��.��5�6�!��7�9����)�"4�D��"+�J��,G�"H�D���+����2�7�7�*X�CW�*X�#X�X��'��(;�(;�<�C�C�F�K���:>����H[�H[�\�����>�4�+;�+;�T�]�]�Krc��y)z&Returns the default base schema to user$r=r=rrr@zSchema.default_base_schema�s��rc�.�tj|dS)z=Returns the base schema's object version, e.g. 47 for 2008_R2�)rrE)rAs rrIzSchema.get_version�s���"�"�;�/��2�2rc�H�tj|j|||�yr5)r
�_dsdb_set_schema_from_ldifrC)rO�pf�df�dns    rrNzSchema.set_from_ldif�s���'�'����"�b�"�=rc��|jj|��|jj�	|jjd�|jdz}|jj|�|jj|j�|jj|j�|jj�y#|jj��xYw)N)�urlzpdn: @ATTRIBUTES
linkID: INTEGER

dn: @INDEXLIST
@IDXATTR: linkID
@IDXATTR: attributeSyntax
@IDXGUID: objectGUID
z1objectGUID: 24e2ca70-b093-4ae8-84c0-2d7ac652a1b8
)
rC�connect�transaction_start�add_ldifrL�modify_ldifrJrF�transaction_commit�transaction_cancel)rO�
schemadb_pathrLs   r�write_to_tmp_ldbzSchema.write_to_tmp_ldb�s��������]��+����"�"�$�	*�
�H�H����
�!�.�.�F�G�M�
�H�H���m�,��H�H� � ��!6�!6�7��H�H���d�.�.�/�

�H�H�'�'�)��		��H�H�'�'�)��s�BC"�"C?c�B�t|j|j�Sr5)�get_linked_attributesrBrC�rOs r�linked_attributeszSchema.linked_attributes�s��$�T�]�]�D�H�H�=�=rc�B�t|j|j�Sr5)�get_dnsyntax_attributesrBrCrls r�dnsyntax_attributeszSchema.dnsyntax_attributes�s��&�t�}�}�d�h�h�?�?rc�D�tj|j||�Sr5)r
� _dsdb_convert_schema_to_openldaprC)rO�target�mappings   r�convert_to_openldapzSchema.convert_to_openldap�s���4�4�T�X�X�v�w�O�Or)NNNNNN)
�__name__�
__module__�__qualname__rErW�staticmethodr@rIrNrirmrprur=rrrrCs��������!�L�*@D�KO�!�AL�F�����3��3�>�*�<>�@�Prrc�*�ddg}|jd|t|��}i}tdt|��D][}dt	||dd�dzz}|j||dt��}|��9|jd	�|t||d�<�]|S)
N�linkID�lDAPDisplayNamezh(&(linkID=*)(!(linkID:1.2.840.113556.1.4.803:=1))(objectclass=attributeSchema)(attributeSyntax=2.5.5.1))��
expression�base�scope�attrsrzD(&(objectclass=attributeSchema)(linkID=%d)(attributeSyntax=2.5.5.1))r+)�basednr~�	attributer�zutf-8)	�searchr�range�len�int�	searchonerrKrH)rB�	schemaldbr��res�
attributes�ir~rss        rrkrk�s���
�(�)�E�
�
�
�0��^�5��:�C��J�
�1�c�#�h�
�	P��3��3�q�6�(�+�A�.�/�!�3�5�
��$�$�H�0:�/@�+8�%�:����9?���w�9O�J�s�3�q�6�"3�4�5�6�	P��rc��|jd|tddg��}g}tdt|��D]"}|j	t||d���$|S)NzF(&(!(linkID=*))(objectclass=attributeSchema)(attributeSyntax=2.5.5.1))r{r|r}r)r�rr�r��appendrH)rBr�r�r�r�s     rroro�sl��
�
�
�[�
�^��*�+��-�C��J�
�1�c�#�h�
�:�����#�c�!�f�%6�7�8�9�:��rc�v�|�tj�}ntj|�}t|||��S)aOLoad schema for the SamDB from the AD schema files and samba4_schema.ldif

    :param schemadn: DN of the schema
    :param serverdn: DN of the server

    Returns the schema data loaded as an object, with .ldb being a
    new ldb with the schema loaded.  This allows certain tests to
    operate without a remote or local schema.
    )rBrR)r�
random_sid�dom_sidr)rB�	domainsidrRs   r�ldb_with_schemar��s<�����'�'�)�	��$�$�Y�/�	��)�h�%7�9�9rr5)z,cn=schema,cn=configuration,dc=example,dc=comNN)�__doc__�base64r�sambarrr�samba.dcerpcr�samba.ms_schemar�	samba.ndrr	�samba.samdbr
�samba.commonrr
rCrrr�objectrrkror�r=rr�<module>r�sY��./��J�J�!�*���#��-��>MP�V�MP�b�.�L�"�'+�9r

Zerion Mini Shell 1.0