%PDF- %PDF-
Mini Shell

Mini Shell

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

�

�I�d@/����ddlZddlmZddlmZddlmZddlm	Z	ddl
mZmZm
Z
mZGd�de�ZGd�d	e�ZGd
�de�ZGd�d
e�ZGd�de
�ZGd�de
�ZGd�de
�Zy)�N)�	bitFields)�system_session)�SamDB)�Command�CommandError�SuperCommand�Optionc	��eZdZdZdZejejejd�Z	e
dde��e
ddd	ed
d��gZd
gZ
		dd�Zy)�cmd_schema_attribute_modifya�Modify attribute settings in the schema partition.

    This commands allows minor modifications to attributes in the schema. Active
    Directory does not allow many changes to schema, but important modifications
    are related to indexing. This command overwrites the value of searchflags,
    so be sure to view the current content before making changes.

    Example1:
    samba-tool schema attribute modify uid \
        --searchflags="fATTINDEX,fPRESERVEONDELETE"

    This alters the uid attribute to be indexed and to be preserved when
    converted to a tombstone.

    Important search flag values are:

    fATTINDEX: create an equality index for this attribute.
    fPDNTATTINDEX: create a container index for this attribute (ie OU).
    fANR: specify that this attribute is a member of the ambiguous name
         resolution set.
    fPRESERVEONDELETE: indicate that the value of this attribute should be
         preserved when the object is converted to a tombstone (deleted).
    fCOPY: hint to clients that this attribute should be copied.
    fTUPLEINDEX: create a tuple index for this attribute. This is used in
          substring queries.
    fSUBTREEATTINDEX: create a browsing index for this attribute. VLV searches
          require this.
    fCONFIDENTIAL: indicate that the attribute is confidential and requires
          special access checks.
    fNEVERVALUEAUDIT: indicate that changes to this value should NOT be audited.
    fRODCFILTEREDATTRIBUTE: indicate that this value should not be replicated to
          RODCs.
    fEXTENDEDLINKTRACKING: indicate to the DC to perform extra link tracking.
    fBASEONLY: indicate that this attribute should only be displayed when the
           search scope of the query is SCOPE_BASE or a single object result.
    fPARTITIONSECRET: indicate that this attribute is a partition secret and
           requires special access checks.

    The authoritative source of this information is the MS-ADTS.
    �%prog attribute [options]��	sambaopts�versionopts�credoptsz
--searchflagszSearch Flags for the attribute)�help�type�-H�--URL�%LDB URL for database or target server�URL�H�rr�metavar�dest�	attributeNc��|�td��d}|��d}|jd�}|D�	cgc] }	|	j�j���"}}	|D]@}
|
tdj�vrtd|
z��dtd|
z
}|d|zz}�B|j
�}|j|�}
t|t�|
|��}|j�}d	|�d|��}tj�}tj||�|_|�1tjt!|�tj"d
�|d
<|j%|�|j'�|j(j+d|z�ycc}	w)Nz#A value to modify must be provided.r�,�searchflagsz$Unknown flag '%s', please see --help����url�session_info�credentials�lpzcn=�searchFlagszmodified %s)r�split�
capitalize�swapcaser�keys�get_loadparm�get_credentialsrr�	schema_dn�ldb�Message�Dn�dn�MessageElement�str�FLAG_MOD_REPLACE�modify�set_schema_update_now�outf�write)�selfrrrrrr�searchflags_int�flags�x�flag�bit_locr%�creds�samdbr-�attr_dn�ms                  �5/usr/lib/python3/dist-packages/samba/netcmd/schema.py�runzcmd_schema_attribute_modify.runYs������D�E�E����"��O��%�%�c�*�E�9>�>�1�Q�\�\�^�,�,�.�>�E�>��
C���y��7�<�<�>�>�&�'M�PT�'T�U�U��y��7��=�=��"1�Q�'�\�"B��
C��
#�
#�
%���(�(��,���!�.�*:�"'�B�0���O�O�%�	� )�9�5���K�K�M���v�v�e�W�%����&�"�1�1��O�$�c�&:�&:�M� K�A�m��	���Q��
�#�#�%��	�	���
��/�0��7?s�%F)NNNNN��__name__�
__module__�__qualname__�__doc__�synopsis�options�SambaOptions�VersionOptions�CredentialsOptions�takes_optiongroupsr	r3�
takes_options�
takes_argsrD��rCrr st��'�P+�H��)�)��-�-��.�.���	��%E�C�P��t�W�#J���S�	2��M���J�>B�*.�)1rSrc��eZdZdZdZejejejd�Z	e
dddedd�	�gZd
gZ
d
d�Zy)�cmd_schema_attribute_showz�Show details about an attribute from the schema.

    Schema attribute definitions define and control the behaviour of directory
    attributes on objects. This displays the details of a single attribute.
    rr
rrrrrrrNc��|j�}|j|�}t|t�||��}|j	�}	dj|�}
|j
|	tj|
��}t|�dk(rtd|z��t|�dkDrtd|z��d|dj�vr�d}	tt|dd��}g}
td
j�D],}|ddtd
|z
zzdk7s�|
j!|��.t|
�dkDr7|dj#tj$|
tj&d��|j)|dtj*�}|j,j/|�y#t$rtd	|ddz��wxYw)
Nr!zJ(&(objectClass=attributeSchema)(|(lDAPDisplayName={0})(cn={0})(name={0})))��base�scope�
expressionrzNo schema objects matched "%s"r zPMultiple schema objects matched "%s": this is a serious issue you should report!r&zJInvalid schemaFlags value "%s": this is a serious issue you should report!rr�searchFlagsDecoded)r+r,rrr-�format�searchr.�
SCOPE_SUBTREE�lenrr*�intr3�
ValueErrorr�append�addr2�FLAG_MOD_ADD�
write_ldif�CHANGETYPE_NONEr7r8)r9rrrrrr%r?r@r-�filt�res�flags_i�outr=�	user_ldifs                rCrDzcmd_schema_attribute_show.run�s���
�
#�
#�
%���(�(��,���!�.�*:�"'�B�0���O�O�%�	�[�b�b�cl�m���l�l�	��1B�1B�&*��,���s�8�q�=��?�)�K�L�L��s�8�a�<��q�t}�}�~�~�&�C��F�K�K�M�)��G�
I��c�#�a�&��"7�8�9���C�!�-�0�5�5�7�
%���a�B��=�)A�$�)G�$G�H�I�Q�N��J�J�t�$�
%��3�x�!�|��A��
�
�3�-�-�c�3�3C�3C�EY�Z�[��$�$�S��V�S�-@�-@�A�	��	�	���	�"���
I�"�#o�ru�vw�rx�zG�sH�$H�I�I�
I�s�F2�2G�NNNNrErRrSrCrUrU�s`���
+�H��)�)��-�-��.�.���	�t�W�#J���S�	2��M�
��J�4#rSrUc��eZdZdZdZejejejd�Z	e
dddedd�	�gZd
gZ
d
d�Zy)�cmd_schema_attribute_show_ocz�Show what objectclasses MAY or MUST contain an attribute.

    This is useful to determine "if I need uid, what objectclasses could be
    applied to achieve this."
    rr
rrrrrrrNc��|j�}|j|�}t|t�||��}|j	�}	dj|�}
dj|�}|j
|	tj|
dg��}|j
|	tj|dg��}
|jjd�|D]&}|jjd|ddz��(|jjd	�|
D]&}|jjd|ddz��(y)
Nr!zE(&(objectClass=classSchema)(|(mayContain={0})(systemMayContain={0})))zG(&(objectClass=classSchema)(|(mustContain={0})(systemMustContain={0})))�cn)rXrYrZ�attrsz--- MAY contain ---
z%s
rz--- MUST contain ---
)r+r,rrr-r\r]r.r^r7r8)r9rrrrrr%r?r@r-�may_filt�	must_filt�may_res�must_res�msgs               rCrDz cmd_schema_attribute_show_oc.run�s6��
�
#�
#�
%���(�(��,���!�.�*:�"'�B�0���O�O�%�	�9�9?��	�9J�	�;�;A�6�)�;L�	��,�,�I�S�5F�5F�*2�4�&��B���<�<�Y�c�6G�6G�+4�T�F� �D��	
�	�	���/�0��	3�C��I�I�O�O�F�S��Y�q�\�1�2�	3�	
�	�	���0�1��	3�C��I�I�O�O�F�S��Y�q�\�1�2�	3rSrlrErRrSrCrnrn�s`���
+�H��)�)��-�-��.�.���	�t�W�#J���S�	2��M�
��J�3rSrnc��eZdZdZdZejejejd�Z	e
dddedd�	�gZd
gZ
d
d�Zy)�cmd_schema_objectclass_showz�Show details about an objectClass from the schema.

    Schema objectClass definitions define and control the behaviour of directory
    objects including what attributes they may contain. This displays the
    details of an objectClass.
    z%prog objectclass [options]r
rrrrrr�objectclassNc�~�|j�}|j|�}t|t�||��}|j	�}	dj|�}
|j
|	tj|
��}|D]=}|j|tj�}
|jj|
��?y)Nr!zF(&(objectClass=classSchema)(|(lDAPDisplayName={0})(cn={0})(name={0})))rW)
r+r,rrr-r\r]r.r^rerfr7r8)r9ryrrrrr%r?r@r-rgrhrvrks              rCrDzcmd_schema_objectclass_show.runs���
�
#�
#�
%���(�(��,���!�.�*:�"'�B�0���O�O�%�	�=�=C�V�K�=P�	
��l�l�	��1B�1B�&*��,���	'�C��(�(��c�.A�.A�B�I��I�I�O�O�I�&�	'rSrlrErRrSrCrxrxs`���-�H��)�)��-�-��.�.���	�t�W�#J���S�	2��M�
 ��J�'rSrxc�P�eZdZdZiZe�ed<e�ed<e�ed<y)�cmd_schema_attributez4Query and manage attributes in the schema partition.r5�show�show_ocN)rFrGrHrI�subcommandsrrUrnrRrSrCr|r|,s1��>��K�7�9�K���3�5�K���9�;�K�	�rSr|c�(�eZdZdZiZe�ed<y)�cmd_schema_objectclassz7Query and manage objectclasses in the schema partition.r}N)rFrGrHrIrrxrRrSrCr�r�4s��A��K�5�7�K��rSr�c�<�eZdZdZiZe�ed<e�ed<y)�
cmd_schemazSchema querying and management.rryN)rFrGrHrIrr|r�rRrSrCr�r�:s$��)��K�3�5�K���!7�!9�K�
�rSr�)r.�samba.getopt�getoptrK�samba.ms_schemar�
samba.authr�samba.samdbr�samba.netcmdrrrr	rrUrnrxr|r�r�rRrSrC�<module>r�s|��&��%�%����b1�'�b1�JI#��I#�X.3�7�.3�b''�'�''�T<�<�<�8�\�8�:��:rS

Zerion Mini Shell 1.0