%PDF- %PDF-
Mini Shell

Mini Shell

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

�

��d�=��R�dZdZddlZddlmZddlZddlmZmZmZm	Z	ddl
Z
ddlmZejZGd�dej�ZGd	�d
e�ZGd�dej�Zd
�Zd�ZGd�dej�ZGd�de�Zd�ZGd�dej0�Zy)z7Support for parsing Samba-related command-line options.�restructuredText�N)�copy)�Credentials�AUTO_USE_KERBEROS�DONT_USE_KERBEROS�MUST_USE_KERBEROS)�get_burnt_commandlinec�:�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
y	)
�SambaOptionsz+General Samba-related command line options.c	���ddlm}|�ttj�}|�	ddl}|j|�ddl
m}tjj||d�|jdddt d	d
|j"��|jdd
dt dd|j$��|jddt dd|j&��|jddt dd|j(��d|_|�|_d|_y#t$rCd}tjj|�tjj�Y��#wxYw)Nr)�fault_setupz�WARNING: Using passwords on command line is insecure. Installing the setproctitle python module will hide these from shortly after program start.
)�LoadParmzSamba Common Optionsz-sz--configfile�callback�FILEzConfiguration file)�action�type�metavar�helprz-dz--debuglevel�
DEBUGLEVEL�debug levelz--option�OPTIONz%set smb.conf option from command linez--realm�REALMzset the realm name)�sambar
r	�sys�argv�setproctitle�ModuleNotFoundError�stderr�write�flush�samba.paramr�optparse�OptionGroup�__init__�
add_option�str�_load_configfile�_set_debuglevel�_set_option�
_set_realm�_configfile�_lp�realm)�self�parserr
�
new_proctitler�msgrs       �./usr/lib/python3/dist-packages/samba/getopt.pyr$zSambaOptions.__init__(sJ��%��
�.�c�h�h�7�
��$�	
#�#��)�)�-�8�	)����%�%�d�F�4J�K�����n�Z� �&�7K�!%�!6�!6�	�	8�	
����n�Z� �,�]�!%�!5�!5�	�	7�	
���
�:� �(�D�!%�!1�!1�	�	3�	
���	�*� �'�8L�!%���	�	2� ����:�����
��1'�
#�C���
�
� � ��%��
�
� � �"�
#�s�D�AE#�"E#c��|jS)z?Return path to the smb.conf file specified on the command line.�r+�r.s r2�get_loadparm_pathzSambaOptions.get_loadparm_pathQs������c��||_y�Nr4�r.�option�opt_str�argr/s     r2r'zSambaOptions._load_configfileUs
����r7c��	|jjd|�||j_y#t$rtd|�d���wxYw)Nrzinvalid -d/--debug value: '�')r,�set�RuntimeError�OptionError�values�
debuglevelr:s     r2r(zSambaOptions._set_debuglevelXsP��	D��H�H�L�L���,�$'��
�
� ���	D�� ;�C�5��B�C�C�	D�s	�0�A	c��	|jjd|�||_y#t$rtd|�d���wxYw)Nr-zinvalid --realm value: 'r?)r,r@rArBr-r:s     r2r*zSambaOptions._set_realm_sK��	A��H�H�L�L��#�&���
���	A�� 8���Q�?�@�@�	A�s�&�?c��|jd�dk(rtjd��|jdd�}	|jj|d|d�y#t$r }tjd|�d|����d}~wwxYw)N�=���z&--option option takes a 'a=b' argument�rzinvalid --option option value z: )�findr"�OptionValueError�splitr,r@�	Exception)r.r;r<r=r/�a�es       r2r)zSambaOptions._set_optionfs����8�8�C�=�B���+�+�8�:�
:��I�I�c�1���	C��H�H�L�L��1��q��t�$���	C��+�+�:=�q�A�C�
C��	C�s�"A � 	B	�)B�B	c�f�|j�1|jj|j�|jStjd��:|jjtjd��|jS|jj�|jS)z?Return loadparm object with data specified on the command line.�
SMB_CONF_PATH)r+r,�load�os�getenv�load_defaultr5s r2�get_loadparmzSambaOptions.get_loadparmqs�����'��H�H�M�M�$�*�*�+�
�x�x��	�Y�Y��
'�
3��H�H�M�M�"�)�)�O�4�5��x�x��
�H�H�!�!�#��x�x�r7N)�__name__�
__module__�__qualname__�__doc__r$r6r'r(r*r)rV�r7r2rr%s*��5�'�R ��'��	C�r7rc��eZdZdZd�Zy)�
Samba3Optionsz<General Samba-related command line options with an s3 param.c�f�tj||�ddlm}|j	�|_y)Nr)�param)rr$�samba.samba3r_�get_contextr,)r.r/�s3params   r2r$zSamba3Options.__init__s%�����d�F�+�1��&�&�(��r7N)rWrXrYrZr$r[r7r2r]r]|s
��F�)r7r]c��eZdZdZd�Zd�Zy)�VersionOptionsz/Command line option for printing Samba version.c��tjj||d�|jddd|jd��y)NzVersion Optionsz-Vz	--versionrzDisplay version number)rrr)r"r#r$r%�_display_version�r.r/s  r2r$zVersionOptions.__init__�s>�����%�%�d�F�4E�F�����k�*�!%�!6�!6�5�	�	7r7c�`�ddl}t|j�tjd�y)Nr)r�print�versionr�exit)r.r;r<r=r/rs      r2rfzVersionOptions._display_version�s���
�e�m�m������r7N)rWrXrYrZr$rfr[r7r2rdrd�s��9�7�r7rdc���|j�dvrtS|j�dvrtS|j�dvrtSt	j
d|�d|����)N)�yes�true�1)�no�false�0)�auto�invalid � option value: )�lowerrrrr"rK�r=r<s  r2�parse_kerberos_arg_legacyrx�s]��
�y�y�{�*�*� � �	����,�	,� � �	�����	 � � ��'�'�)0�#�)7�8�	8r7c���|j�dk(rtS|j�dk(rtS|j�dk(rtSt	j
d|�d|����)N�required�desired�offrtru)rvrrrr"rKrws  r2�parse_kerberos_argr}�s[��
�y�y�{�j� � � �	����	�	!� � �	�����	� � ��'�'�)0�#�)7�8�	8r7c�h�eZdZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�Zdd�Zy)�CredentialsOptionsz0Command line options for specifying credentials.Nc	��||_|�d|z|_nd|_d|_d|_d|_t
jj|||j�|jddd|jtd�	�|jd
dddt|j�
�|jddddtd|j��|jddddtd|j��|jdddd|j��|jddddtd|j��|jdd dd!|j ��|jd"d#dtd$|j"��|jd%d&dtd'|j$��|jd(d)d*dtd+|j&��|jd,d-d.dtd/|j(��t+�|_y)0NzCredentials Options (%s)zCredentials OptionsTFz--simple-bind-dn�DNr�DN to use for a simple bind�rrrrrz
--password�PASSWORD�Password�rrrrrz-Uz
--username�USERNAME�Username�rrrrrz-Wz--workgroup�	WORKGROUP�	Workgroupz-Nz	--no-passzDon't ask for a password)rrr�z--ipaddress�	IPADDRESSzIP address of serverz-Pz--machine-passz#Use stored machine account passwordz--use-kerberos�desired|required|off�Use Kerberos authenticationz--use-krb5-ccache�
KRB5CCNAMEzKerberos Credentials cachez-Az--authentication-file�AUTHFILEzAuthentication filez-kz
--kerberos�KERBEROSz%DEPRECATED: Migrate to --use-kerberos)�special_name�section�ask_for_password�	ipaddress�machine_passr"r#r$�_add_option�_set_simple_bind_dnr&�
_set_password�_parse_username�_parse_workgroup�_set_no_password�_set_ipaddress�_set_machine_pass�
_set_kerberos�_set_krb5_ccache�_set_auth_file�_set_kerberos_legacyr�creds)r.r/r�s   r2r$zCredentialsOptions.__init__�s5��(����#�5��D�D�L�0�D�L� $������!������%�%�d�F�D�L�L�A����+�T�*�"&�":�":��;�	�	=�	
����z�*�(�s�T�=O�=O�	�	Q�����|�Z� *��(�4�3G�3G�	�	I�	
����}�k� *��)�D�4I�4I�	�	K�	
����{�:�8�"&�"7�"7�	�	9�	
����]�K� *��4�"&�"5�"5�	�	7�	
����/� *�C�"&�"8�"8�	�	:�	
���)�3I� *��;�d�FX�FX�	�	Z�	
���,�l� *��:�"&�"7�"7�	�	9�	
����6�
� *��3�"&�"5�"5�	�	7�	
����|�Z� *��E�PT�Pi�Pi�	�	k�!�]��
r7c���|j�|j|i|��Sd}|D]7}|jd�s�||jdd|jz�fz
}�9|j|i|��y)Nr[z--z--%s-)r�r%�
startswith�replace)r.�args1�kwargs�args2rNs     r2r�zCredentialsOptions._add_option�s������$�"�4�?�?�E�4�V�4�4����	E�A��<�<��%���a�i�i��g��0A�0A�&A�B�D�D�E�	E�	�����)�&�)r7c�H�|jj|�d|_y�NF)r��parse_stringr�r:s     r2r�z"CredentialsOptions._parse_username�s���
�
����$�!��r7c�:�|jj|�yr9)r��
set_domainr:s     r2r�z#CredentialsOptions._parse_workgroup�s���
�
���c�"r7c�V�|jj|�d|_d|_yr�)r��set_passwordr�r�r:s     r2r�z CredentialsOptions._set_password�s$���
�
����$� %���!��r7c��d|_yr�)r�r:s     r2r�z#CredentialsOptions._set_no_password�s
�� %��r7c��d|_y)NT)r�r:s     r2r�z$CredentialsOptions._set_machine_pass�s
�� ��r7c��||_yr9)r�r:s     r2r�z!CredentialsOptions._set_ipaddress�s	����r7c�d�td�|jjt||��y)Nz0WARNING: The option -k|--kerberos is deprecated!)rir��set_kerberos_staterxr:s     r2r�z'CredentialsOptions._set_kerberos_legacys%��
�@�A��
�
�%�%�&?��W�&M�Nr7c�N�|jjt||��yr9)r�r�r}r:s     r2r�z CredentialsOptions._set_kerbeross���
�
�%�%�&8��g�&F�Gr7c�:�|jj|�yr9)r��set_bind_dnr:s     r2r�z&CredentialsOptions._set_simple_bind_dns���
�
���s�#r7c�x�|jjt�|jj|�yr9)r�r�r�set_named_ccacher:s     r2r�z#CredentialsOptions._set_krb5_ccaches'���
�
�%�%�&7�8��
�
�#�#�C�(r7c��tjj|�r*|jj	|�d|_d|_yyr�)rS�path�existsr��
parse_filer�r�r:s     r2r�z!CredentialsOptions._set_auth_files9��
�7�7�>�>�#���J�J�!�!�#�&�$)�D�!� %�D��r7c��|jj|�|jr|jj|�n&|jr|jj�|rB|jj
�s(	|jj|�|jS|jS#t$rY|jSwxYw)z�Obtain the credentials set on the command-line.

        :param lp: Loadparm object to use.
        :return: Credentials object
        )r��guessr��set_machine_accountr��set_cmdline_callbacks�authentication_requestedrM)r.�lp�fallback_machines   r2�get_credentialsz"CredentialsOptions.get_credentialss���	
�
�
���������J�J�*�*�2�.�
�
"�
"��J�J�,�,�.��D�J�J�$G�$G�$I�
��
�
�.�.�r�2��z�z��t�z�z����
���z�z��
�s�B:�:	C�Cr9)F)rWrXrYrZr$r�r�r�r�r�r�r�r�r�r�r�r�r�r[r7r2rr�sN��:�1#�f	*�"�#�"�
&�!��O�H�$�)�&�r7rc�B�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
dd	�Zy
)�CredentialsOptionsDoublez?Command line options for specifying credentials of two servers.c�@�tj||�d|_|jddd|jt
d��|jdddd	t
|j�
�|jdddt
d
|j��|jdddt
d|j��|jddd��|jdddt
d|j��|jdddt
d|j��t�|_y)NTz--simple-bind-dn2�DN2rr�r�z--password2�	PASSWORD2r�r�z--username2�	USERNAME2zUsername for second serverr�z--workgroup2�
WORKGROUP2zWorkgroup for second serverz
--no-pass2�
store_truez.Don't ask for a password for the second server)rrz--use-kerberos2r�r�z--kerberos2�	KERBEROS2zUse Kerberos)
rr$�no_pass2r%�_set_simple_bind_dn2r&�_set_password2�_parse_username2�_parse_workgroup2�_set_kerberos2�_set_kerberos2_legacyr�creds2rgs  r2r$z!CredentialsOptionsDouble.__init__/s,���#�#�D�&�1���
����+�U�:�!%�!:�!:��:�	�	<�	
���
�{�:�'�c�!%�!4�!4�	�	6�	
���
�{�)��9�!%�!6�!6�	�	8�	
�����)��:�!%�!7�!7�	�	9�	
����\�M�	�	O����)�3I�)��:�T�EX�EX�	�	Z�
	
���
�{�)��+�d�6P�6P�	�	R�"�m��r7c�:�|jj|�yr9)r�r�r:s     r2r�z)CredentialsOptionsDouble._parse_username2Ls����� � ��%r7c�:�|jj|�yr9)r�r�r:s     r2r�z*CredentialsOptionsDouble._parse_workgroup2Os�������s�#r7c�H�|jj|�d|_yr�)r�r�r�r:s     r2r�z'CredentialsOptionsDouble._set_password2Rs����� � ��%���
r7c�N�|jjt||��yr9�r�r�r}r:s     r2r�z.CredentialsOptionsDouble._set_kerberos2_legacyV������&�&�'9�#�w�'G�Hr7c�N�|jjt||��yr9r�r:s     r2r�z'CredentialsOptionsDouble._set_kerberos2Yr�r7c�:�|jj|�yr9)r�r�r:s     r2r�z-CredentialsOptionsDouble._set_simple_bind_dn2\s��������$r7c�
�|r|jj|�n4|jj�s|jj�|jr|jj�|jS)z�Obtain the credentials set on the command-line.

        :param lp: Loadparm object to use.
        :param guess: Try guess Credentials from environment
        :return: Credentials object
        )r�r��get_username�
set_anonymousr�r�)r.r�r�s   r2�get_credentials2z)CredentialsOptionsDouble.get_credentials2_sZ����K�K���b�!����)�)�+��K�K�%�%�'��=�=��K�K�-�-�/��{�{�r7N)T)rWrXrYrZr$r�r�r�r�r�r�r�r[r7r2r�r�,s/��I�$�:&�$��I�I�%�r7r�c�
�ddddd�}|jdd�}d}|r|ddj�s|ddd	k(r,||dz
}|dd}|r|ddj�r�#|ddd	k(r�,	t|�}|j�jdd�}	|||zS#t$r'd
j	|�}tj|��wxYw#t$r,}	dj	||�}tj|��d}	~	wwxYw)
NrIiii@)�B�KB�MB�GB� r�r�.zA{0} option requires a numeric value, with an optional unit suffix�Iz3{0} invalid suffix '{1}', should be B, Kb, Mb or Gb)	r��isdigit�float�
ValueError�formatr"rK�upper�KeyError)
r;�opt�value�multipliers�v�digits�mr1�suffix�ks
          r2�check_bytesr�ss/�����%�	'�K�	�
�
�c�2��A��F�
��!�A���� �A�a��F�c�M��!�A�$���
�a�b�E����!�A���� �A�a��F�c�M�-��&�M���W�W�Y�
�
�s�B�
'�F�-��;�v�&�&�&���-�.�/5�v�c�{�	��'�'��,�,�-���-�+�,2�F�3��N�	��'�'��,�,��-�s$�&B�C
�0C
�
	D�'C=�=Dc��eZdZejj
dzZeejj�Zeed<y)�SambaOption)�bytesr�N)	rWrXrYr"�Option�TYPESr�TYPE_CHECKERr�r[r7r2r�r��s4���O�O�!�!�J�.�E�����4�4�5�L�'�L��r7r�)rZ�
__docformat__r"rrS�samba.credentialsrrrrr�samba._gluer	rKrBr#rr]rdrxr}rr�r�r�r�r[r7r2�<module>rs���$>�"�
���	����-��'�'��T�8�'�'�T�n)�L�)��X�)�)��	8�	8�~��-�-�~�BA�1�A�N!-�F(�(�/�/�(r7

Zerion Mini Shell 1.0