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

�

�I�d����ddlmZddlZddlmZddlmZddlm	Z	ddl
mZmZm
Z
mZGd�de�ZGd�d	e�ZGd
�de�ZGd�d
e
�Zy)�N)�SamDB)�system_session)�_get_user_realm_domain)�Command�CommandError�SuperCommand�Optionc��eZdZdZdZejejejd�Z	e
dddedd�	�gZd
gZ
				d
d�Zy)�cmd_spn_listzList spns of a given user.z%prog <user> [options]��	sambaopts�credopts�versionopts�-H�--URL�%LDB URL for database or target server�URL�H��help�type�metavar�dest�userNc��|j�}|j|�}t|t�||��}t	||�\}	}
}|j
j
|	dz�|jdtj|	�ztjdg��}t|�dkDr�|djd�}
|
�Q|j
j
d|djz�|
D] }|j
j
d|z��"y|j
j
d	|djz�ytd
|z��)N��session_info�credentials�lp�
�samaccountname=%s�servicePrincipalName��
expression�scope�attrsrz1User %s has the following servicePrincipalName: 
z	 %s
z$User %s has no servicePrincipalName
�User %s not found)�get_loadparm�get_credentialsrrr�outf�write�search�ldb�
binary_encode�
SCOPE_SUBTREE�len�get�dnr)�selfrrrr
rr�creds�sam�cleaneduser�realm�domain�res�spns�es               �2/usr/lib/python3/dist-packages/samba/netcmd/spn.py�runzcmd_spn_list.run1s>���
#�
#�
%���(�(��,���A�N�$4� %�"�.��(>�d�C�'H�$��e�V��	�	����d�*�+��j�j�*�S�->�->�{�-K�K��#�#�,B�+C��E���s�8�a�<��q�6�:�:�4�5�D����	�	���H���F�I�I����3�A��I�I�O�O�I��M�2�3��	�	��� G� #�A��	�	�!*�+��2�T�9�:�:��NNNN��__name__�
__module__�__qualname__�__doc__�synopsis�options�SambaOptions�CredentialsOptions�VersionOptions�takes_optiongroupsr	�str�
takes_options�
takes_argsr=�r>r<rr sh��$�'�H��)�)��.�.��-�-���	�t�W�#J���S�	2��M�
��J�����;r>rc��eZdZdZdZejejejd�Z	e
dddedd�	�gZd
dgZ
				dd
�Zy)�cmd_spn_addzCreate a new spn.z%prog <name> <user> [options]rrrrrrr�namerNc���|j�}|j|�}t|t�||��}	|	j	dtj|�zt
j��}
t|
�dk7rtd|z��t||	�\}}}
|	j	dtj|�zt
jdg��}
t|
�dkDr�|
djtj�}|
djd�}g}d	}t
j}|�A|D],}t|�|k(rd
}|j!t|���.t
j"}|j!|�|
dj|_tj$||d�|d<|s|	j'|�ytd|�d|����td
|z��)Nr�servicePrincipalName=%s)r$r%rz5Service principal %s already affected to another userr!r"r#FTzService principal z already affected to r')r(r)rrr,r-r.r/r0rrr2�Messager1�FLAG_MOD_ADDrK�append�FLAG_MOD_REPLACE�MessageElement�modify)r3rQrrrr
rrr4r5r9r6r7r8�msgr:�tab�found�flagr;s                    r<r=zcmd_spn_add.run_s����
#�
#�
%���(�(��,���A�N�$4� %�"�.���j�j�0�3�3D�3D�T�3J�J��#�#��%���s�8�q�=�� ;�=A� B�C�
C�(>�d�C�'H�$��e�V��j�j�*�S�->�->�{�-K�K��#�#�,B�+C��E���s�8�a�<���F�I�I��+�+�-�C��q�6�:�:�4�5�D��C��E��#�#�D����'�A��1�v��~� $���J�J�s�1�v�&�'��+�+���J�J�t����V�Y�Y�C�F�*-�*<�*<�S�$�=S�+U�C�&�'���
�
�3��"�8<�d�$D�E�E��2�T�9�:�:r>r?r@rNr>r<rPrPOsk���.�H��)�)��.�.��-�-���	�t�W�#J���S�	2��M��&�!�J� $����*;r>rPc��eZdZdZdZejejejd�Z	e
dddedd�	�gZd
dgZ
		dd
�Zy)�cmd_spn_deletez
Delete a spn.z%prog <name> [user] [options]rrrrrrrrQzuser?Nc��|j�}|j|�}t|t�||��}	|	j	dtj|�zt
jddg��}
t|
�dkD�r<d}|�Kt|�\}}
}|
D]$}t|d�j�|k(s�#|}�&|�Xtd|�d|����t|
�d	k7r4d
}|
D]}|�dt|j���}�td|�d
|����|
d}tj�}|jd�}g}|�@|D]+}t|�|k7s�|j!t|���-t
j"}|j|_
tj$|d�|d<|	j'|�ytd|z��)NrrSr"�samAccountNamer#rzUnable to find user z
 with spn ��r zMore than one user has the spn zA and no specific user was specified, list of users with this spn:z!Service principal %s not affected)r(r)rrr,r-r.r/r0rrK�lowerrr2rTr1rVrWrXrY)r3rQrrrr
rrr4r5r9�resultr6r7r8�elem�listUser�rrZr:r[r;r]s                       r<r=zcmd_spn_delete.run�s���
�
#�
#�
%���(�(��,���A�N�$4� %�"�.���j�j�0�3�3D�3D�T�3J�J��#�#�)�+;�<��>���s�8�a�<��F���/E�d�/K�,��e�V��&�D��4� 0�1�2�8�8�:�k�I�!%��&��>�&�48�$�(@�A�A��s�8�q�=�!�H� �D��/7��Q�T�T��#C��D�&�>B�H�(N�O�O�!��V�F��+�+�-�C��:�:�4�5�D��C����+�A��1�v��~��
�
�3�q�6�*�+��+�+���Y�Y�C�F�*-�*<�*<�S�$�=S�+U�C�&�'��J�J�s�O��B�T�I�J�Jr>)NNNNNr@rNr>r<r_r_�sf���.�H��)�)��.�.��-�-���	�t�W�#J���S�	2��M�
�'�"�J�DH��,Kr>r_c�P�eZdZdZiZe�ed<e�ed<e�ed<y)�cmd_spnz(Service Principal Name (SPN) management.�add�list�deleteN)rArBrCrD�subcommandsrPrr_rNr>r<rjrj�s/��2��K�$��K���&�.�K���*�,�K��r>rj)�samba.getopt�getoptrFr-�samba.samdbr�
samba.authr�samba.netcmd.commonr�samba.netcmdrrrr	rrPr_rjrNr>r<�<module>rusU��&�
��%�6���,;�7�,;�^:;�'�:;�z=K�W�=K�@-�l�-r>

Zerion Mini Shell 1.0