%PDF- %PDF-
Mini Shell

Mini Shell

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

�

�I�d�>����ddlmZddlmZmZmZmZddlm	Z	ddl
mZmZm
Z
ddlmZddlmZGd�de�ZGd	�d
e�ZGd�de�ZGd
�de�ZGd�de�ZGd�de�Zy)�N)�Command�CommandError�Option�SuperCommand)�AuthenticationPolicy)�MIN_TGT_LIFETIME�MAX_TGT_LIFETIME�StrongNTLMPolicy)�
ModelError)�Rangec��eZdZdZdZejejd�Ze	ddde
dd�	�e	d
ddd
d��gZ		dd�Zy)�cmd_domain_auth_policy_listz+List authentication policies on the domain.�%prog -H <URL> [options]��	sambaopts�credopts�-H�--URL�&LDB URL for database or target server.�URL�ldap_url��help�type�metavar�destz--jsonzOutput results in JSON format.�
output_format�store_const�json)rr�action�constNc�x�|j|||�}	tj|�D�cic]}|j|j	���}}|dk(r|j|�y|j�D] }|jj|�d���"ycc}w#t
$r}t
|��d}~wwxYw)Nr�
)�ldb_connectr�query�cn�as_dictrr�
print_json�keys�outf�write)	�selfrrrr�ldb�policy�policies�es	         �A/usr/lib/python3/dist-packages/samba/netcmd/domain/auth/policy.py�runzcmd_domain_auth_policy_list.run1s������x��H�=��	"�&:�&@�&@��&E�G�"��	�	�6�>�>�#3�3�G�H�G��F�"��O�O�H�%�"�-�-�/�
/���	�	���6�(�"�
�.�
/��G���	"��q�/�!��	"�s(�B �"B�B �B � 	B9�)B4�4B9�NNNN�
�__name__�
__module__�__qualname__�__doc__�synopsis�options�SambaOptions�CredentialsOptions�takes_optiongroupsr�str�
takes_optionsr2��r1rr sg��5�)�H��)�)��.�.���	�t�W�#K���Z�	9��x�>�#�M��	I��M�;?��/rArc��eZdZdZdZejejd�Ze	ddde
dd�	�e	d
ddd
e
��gZdd�Zy)�cmd_domain_auth_policy_viewz,View an authentication policy on the domain.rrrrrrrr�--namez1Name of authentication policy to view (required).�name�store�rrr rNc��|std��|j|||�}	tj||��}|�td|�d���|j|j
��y#t$r}t|��d}~wwxYw)N�Argument --name is required.�r&�Authentication policy � not found.)rr$r�getrr(r')r,rrrrEr-r.r0s        r1r2zcmd_domain_auth_policy_view.runWs�����=�>�>����x��H�=��	"�)�-�-�c�d�;�F�
�>��!7��v�[�I�J�J�	
������(�)���	"��q�/�!��	"�s�A*�*	B�3A>�>Br3r4r@rAr1rCrCEs^��6�)�H��)�)��.�.���	�t�W�#K���Z�	9��x�G��7��	6��M�*rArCc��eZdZdZdZejejd�Ze	ddde
dd�	�e	d
ddd
e
��e	dddd
e
��e	dddd��e	dddd��e	dddd��e	dddd��e	d d!ej��d"�d#d$d
ej�d%�&�e	d'd(d)ed
eee�*�g�+�e	d,d-d.dd/�0�e	d1d2d3ed
eee�*�g�+�e	d4d5d6dd/�0�e	d7d8d9ed
eee�*�g�+�g
Z					d<d;�Zy:)=�cmd_domain_auth_policy_createz.Create an authentication policy on the domain.rrrrrrrrrD�)Name of authentication policy (required).rErFrG�
--description�/Optional description for authentication policy.�description�	--protect�5Protect authentication silo from accidental deletion.�protect�
store_true�rrr �--unprotect�7Unprotect authentication silo from accidental deletion.�	unprotect�--audit�!Only audit authentication policy.�audit�	--enforce�Enforce authentication policy.�enforce�--strong-ntlm-policy�Strong NTLM Policy (�).�strong_ntlm_policy�choice�Disabled)rrrr �choices�default�--user-tgt-lifetime�2Ticket-Granting-Ticket lifetime for user accounts.�user_tgt_lifetime��min�max�rrrr �
validators�--user-allow-ntlm-auth�NAllow NTLM network authentication when user is restricted to selected devices.�user_allow_ntlm_authF�rrr ri�--service-tgt-lifetime�5Ticket-Granting-Ticket lifetime for service accounts.�service_tgt_lifetime�--service-allow-ntlm-auth�QAllow NTLM network authentication when service is restricted to selected devices.�service_allow_ntlm_auth�--computer-tgt-lifetime�6Ticket-Granting-Ticket lifetime for computer accounts.�computer_tgt_lifetimeNc
�>�|std��|r
|rtd��|r
|	rtd��|j|||�}	tj||��}|�td|�d���t||t
|
j
�||||
|��}|	�|	|_n||_	|j|�|r|j|�|jjd|�d	��y#t$r}t|��d}~wwxYw#t$r}t|��d}~wwxYw)
NrI�2--protect and --unprotect cannot be used together.�.--audit and --enforce cannot be used together.rJrKz already exists.)r&rSrertrlr{rxr~zCreated authentication policy: r#)rr$rrMrr
�upper�enforced�saverVr*r+�r,rrrrErSrVr[r^rarerlrtrxr{r~r-r.r0s                   r1r2z!cmd_domain_auth_policy_create.run�s>����=�>�>��y��S�T�T��W��O�P�P����x��H�=��	"�)�-�-�c�d�;�F�
���!7��v�=M�N�O�O�&��#�/�0B�0H�0H�0J�K�!5�/�$;�!5�"7�	
����%�F�O�"'�i�F�O�	"��K�K�������s�#�
	
�	�	���9�$��r�B�C��I�	"��q�/�!��	"��@�	"��q�/�!��	"�s0�C'�#$D�'	D�0C;�;D�	D�D�D�NNNNNNNNNNNNNNN�r5r6r7r8r9r:r;r<r=rr>r
�choices_str�get_choices�intrrr	r?r2r@rAr1rOrOks���8�)�H��)�)��.�.���	�t�W�#K���Z�	9��x�I��7��	6���E�!�'��	=�	�{�K��l�	4�	�}�M���	6�	�y�7��L�	2�	�{�4��l�	4�	�%�*�+G�+;�+G�+G�+I�*J�"�M�(�x��3�'�3�3�5�!�		#�
	�$�H�'�c�'� �%5�;K�L�M�	O�	�'�9�*�<��		�
	�'�K�*��W� �%5�;K�L�M�	O�	�*�9�-�l��		�
	�(�L�+�#�g� �%5�;K�L�M�	O�W/�M�bFJ�BF�EI�<@�@D�	5DrArOc��eZdZdZdZejejd�Ze	ddde
dd�	�e	d
ddd
e
��e	dddd
e
��e	dddd��e	dddd��e	dddd��e	dddd��e	d d!ej��d"�d#d$d
ej��%�e	d&d'd(ed
eee�)�g�*�e	d+d,d-dd.�/�e	d0d1d2ed
eee�)�g�*�e	d3d4d5dd.�/�e	d6d7d8ed
eee�)�g�*�g
Z					d;d:�Zy9)<�cmd_domain_auth_policy_modifyz-Modify authentication policies on the domain.rrrrrrrrrDrPrErFrGrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerf)rrrr rhrjrkrlrmrprrrsrtFrurvrwrxryrzr{r|r}r~Nc��|std��|r
|rtd��|r
|	rtd��|j|||�}	tj||��}|�td|�d���|	rd|_n	|rd|_|�||_|
�t|
j�|_	|�||_
|
�|
|_|�||_	|j|�|r|j|�n|r|j|�|j j#d	|�d
��y#t$r}t|��d}~wwxYw#t$r}t|��d}~wwxYw)NrIr�r�rJrKrLTFzUpdated authentication policy: r#)rr$rrMrr�rSr
r�rerlrxr~r�rVr[r*r+r�s                   r1r2z!cmd_domain_auth_policy_modify.runsz����=�>�>��y��S�T�T��W��O�P�P����x��H�=��	"�)�-�-�c�d�;�F�
�>��!7��v�[�I�J�J��"�F�O�
�#�F�O��"�!,�F��
�)� �!3�!9�!9�!;�<�
�%��(�'8�F�$�
 �+�*>�F�'�
!�,�+@�F�(�	"��K�K�������s�#��� � ��%�
	
�	�	���9�$��r�B�C��g�	"��q�/�!��	"��^�	"��q�/�!��	"�s0�D�>8D2�	D/�D*�*D/�2	E�;E�Er�r�r@rAr1r�r��s���7�)�H��)�)��.�.���	�t�W�#K���Z�	9��x�I��7��	6���E�!�'��	=�	�{�K��l�	4�	�}�M���	6�	�y�7��L�	2�	�{�4��l�	4�	�%�*�+G�+;�+G�+G�+I�*J�"�M�(�x��3�'�3�3�5�	7�	�$�H�'�c�'� �%5�;K�L�M�	O�	�'�9�*�<��		�
	�'�K�*��W� �%5�;K�L�M�	O�	�*�9�-�l��		�
	�(�L�+�#�g� �%5�;K�L�M�	O�U.�M�`FJ�BF�EI�<@�@D�	DDrAr�c��eZdZdZdZejejd�Ze	ddde
dd�	�e	d
ddd
e
��e	dddd��gZ		dd�Zy)�cmd_domain_auth_policy_deletez-Delete authentication policies on the domain.rrrrrrrrrDrPrErFrGz--forcez-Force delete protected authentication policy.�forcerWrXNc��|std��|j|||�}	tj||��}|�td|�d���	|r|j|�|j
|�|jjd|�d��y#t$r}t|��d}~wwxYw#t$r }|st|�d���t|��d}~wwxYw)NrIrJrKrLz9
Try --force to delete protected authentication policies.zDeleted authentication policy: r#)	rr$rrMrr[�deleter*r+)	r,rrrrEr�r-r.r0s	         r1r2z!cmd_domain_auth_policy_delete.runrs�����=�>�>����x��H�=��	"�)�-�-�c�d�;�F�
�>��!7��v�[�I�J�J�
	&��� � ��%��M�M�#��	
�	�	���9�$��r�B�C��+�	"��q�/�!��	"���	&��"��c�S�T�V�V�#�1�o�%��	&�s/�B�$B+�	B(�B#�#B(�+	C�4C�C)NNNNNr4r@rAr1r�r�_s{��7�)�H��)�)��.�.���	�t�W�#K���Z�	9��x�I��7��	6��y�N��L�	2��M�FJ��DrAr�c�R�eZdZdZe�e�e�e�e�d�Z	y)�cmd_domain_auth_policyz-Manage authentication policies on the domain.)�list�view�create�modifyr�N)
r5r6r7r8rrCrOr�r��subcommandsr@rAr1r�r��s,��7�,�-�+�-�/�1�/�1�/�1��KrAr�)�samba.getopt�getoptr:�samba.netcmdrrrr�samba.netcmd.domain.modelsr�&samba.netcmd.domain.models.auth_policyrr	r
�%samba.netcmd.domain.models.exceptionsr�samba.netcmd.validatorsrrrCrOr�r�r�r@rAr1�<module>r�sz��.�D�D�;�'�'�<�)�"/�'�"/�J#*�'�#*�LpD�G�pD�f~D�G�~D�B2D�G�2D�j	�\�	rA

Zerion Mini Shell 1.0