HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //proc/1233/cwd/usr/lib/python3/dist-packages/samba/netcmd/__pycache__/testparm.cpython-310.pyc
o

�/a$�@sLddlZddlZddlZddlmZddlmZmZm	Z	Gdd�de�Z
dS)�N)�Command�CommandError�Optionc
@s�eZdZdZdZejejd�Ze	de
dd�e	de
dd�e	d	e
d
d�e	de
dd�e	d
dddd�e	dddddd�e	de
dd�e	ddddd�gZgZ				d$dd�Z
dd�Zdd�Zd d!�Zd"d#�ZdS)%�cmd_testparmz$Syntax check the configuration file.z%prog [options])�	sambaopts�versionoptsz--section-namez!Limit testparm to a named section)�type�helpz--parameter-namez#Limit testparm to a named parameterz
--client-namezHClient DNS name for 'hosts allow' checking (should match reverse lookup)z--client-ipz,Client IP address for 'hosts allow' checkingz--suppress-prompt�
store_trueFzSuppress prompt for enter)�action�defaultr	z-vz	--verbosezShow default options tooz--serverzSet %L macro to servernamez--show-all-parametersz*Show the parameters, type, possible valuesNc
Cs~|
rtd��|	rtd��|dur|durtd��z|��}Wnty.}zt|��d}~wwt�d�|�d�}
|
�d|j�|
�d�|�	||
�}|oR|�
||
�}|durd|durd|�||
||�nS|dusl|dur�|dur�z||}Wn
ty�td|��w|�
|j|�n+z|�||�Wn"ty�}zt|��d}~ww|s�|j�d	�tj��|�
|�|r�dStd
��)Nz--server not yet implementedz)--show-all-parameters not yet implementedzHBoth a DNS name and an IP address are required for the host access check��testparmzLoaded smb config files from %szLoaded services file OK.zUnknown section %sz6Press enter to see a dump of your service definitions
zInvalid smb.conf)�NotImplementedErrorr�get_loadparm�RuntimeError�samba�set_debug_level�
get_logger�info�
configfile�do_global_checks�do_share_checks�check_client_access�KeyError�dump�default_service�dump_a_parameter�outf�write�sys�stdin�readline)�selfrr�section_name�parameter_name�	client_ip�client_name�verbose�suppress_prompt�show_all_parameters�server�lp�err�logger�valid�section�e�r2�7/usr/lib/python3/dist-packages/samba/netcmd/testparm.py�runJsR��


���

zcmd_testparm.runc
Cs:d}|�d�}t�|�s|�d|�d}|�d�}t�|�s&|�d|�d}|�d�}tj�|�s9|�d|�d}|�d	�}tj�|�sL|�d
|�d}|�d�}t|�dkr^|�d
�d}|dkri|�d�d}|�d�}	|	dvr�|�d���}
|
dvr�|�	d�|�d�}|r�dD]}||vr�|�	d|d�q�|S)NTznetbios namez+netbios name %s is not a valid netbios nameF�	workgroupz-workgroup name %s is not a valid netbios name�lockdirz lock directory %s does not existz
pid directoryzpid directory %s does not existzwinbind separator�z=the 'winbind separator' parameter must be a single character.�+zC'winbind separator = +' might cause problems with group membership.zserver role)z"active directory domain controllerzdomain controller�dczunix charset)zUTF-8�UTF8zXWhen acting as Active Directory domain controller, unix charset is expected to be UTF-8.zvfs objects)�
dfs_samba4�	acl_xattrz3When acting as Active Directory domain controller, z should be in vfs objects.)
�getr�valid_netbios_name�error�os�path�isdir�len�upper�warning)
r#r,r.r/�netbios_namer5r6�piddir�winbind_separator�role�charset�
vfsobjects�entryr2r2r3rsd

�

�



�
�
����zcmd_testparm.do_global_checkscCs
t|j��)N)r�allow_access)r#�	deny_list�
allow_list�cname�caddrr2r2r3rM�s
zcmd_testparm.allow_accesscCs�d}|��D]}t|�dkr|�d�nq|��D]>}|�d|�}|�d|�}|r@|D]}d|vs6d|vr?|�d||�d	}q,|rX|D]}d|vsNd|vrW|�d
||�d	}qDq|S)NT�z�You have some share names that are longer than 12 characters. These may not be accessible to some older clients. (Eg. Windows9x, WindowsMe, and not listed in smbclient in Samba 3.0.)�
hosts deny�hosts allow�*�?zBInvalid character (* or ?) in hosts deny list (%s) for service %s.FzCInvalid character (* or ?) in hosts allow list (%s) for service %s.)�servicesrCrEr=r?)r#r,r.r/�srNrOrLr2r2r3r�s8������zcmd_testparm.do_share_checkscCsp|��D]1}|�|�d�|�d�||�r-|�|�d|�|�d|�||�r-|�d|||�q|�d|||�qdS)NrSrTz#Allow connection from %s (%s) to %sz"Deny connection from %s (%s) to %s)rWrMr=r)r#r,r.rPrQrXr2r2r3r�s����z cmd_testparm.check_client_access)NNNNFNFN)�__name__�
__module__�__qualname__�__doc__�synopsis�options�SambaOptions�VersionOptions�takes_optiongroupsr�str�
takes_options�
takes_argsr4rrMrrr2r2r2r3r)sN���������
�5:r)r@r r�samba.getopt�getoptr^�samba.netcmdrrrrr2r2r2r3�<module>s