
    bg'                     R    S SK r S SKrS SKrS SKJr  S SKJrJrJ	r	   " S S\5      r
g)    N)CommandCommandErrorOptionc                       \ rS rSrSrSr\R                  \R                  S.r	\
" S\SS9\
" S\S	S9\
" S
\SS9\
" S\SS9\
" SSSSS9\
" SSSSSS9\
" S\SS9\
" SSSSS9/r/ r    S!S jrS rS rS rS rS rg)"cmd_testparm)   z$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_trueFzSuppress prompt for enter)actiondefaultr   z-vz	--verbosezShow default options tooz--serverzSet %L macro to servernamez--show-all-parametersz*Show the parameters, type, possible valuesNc                    U
(       a  [        S5      eU	(       a  [        S5      eUb  Uc  [        S5      e UR                  5       n[        R
                  " S5        U R                  S5      nUR                  SUR                  5        UR                  S5        U R                  X5      nU=(       a    U R                  X5      nUb  Ub  U R                  XXe5        OUc  Ub8  Uc"   X   nUR                  UR                  U5        Od UR!                  XC5        OQU(       d9  U R"                  R%                  S
5        [&        R(                  R+                  5         UR                  U5        U(       a  g [        S5      e! [         a  n[        U5      eS nAff = f! [         a'    US;   a  UR                  5          NR[        S	U 35      ef = f! [         a  n[        U5      eS nAff = f)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   testparmzLoaded smb config files from %szLoaded services file OK.)globalglobalszUnknown section z6Press enter to see a dump of your service definitions
zInvalid smb.conf)NotImplementedErrorr   get_loadparmRuntimeErrorsambaset_debug_level
get_loggerinfo
configfiledo_global_checksdo_share_checkscheck_client_accessdumpdefault_serviceKeyErrordump_globalsdump_a_parameteroutfwritesysstdinreadline)selfr	   r
   section_nameparameter_name	client_ipclient_nameverbosesuppress_promptshow_all_parametersserverlperrloggervalidsectiones                    7/usr/lib/python3/dist-packages/samba/netcmd/testparm.pyruncmd_testparm.runJ   s    %&DEE%&QRR"y'8  D E E	$'')B
 	a ,5r}}E./%%b1:$..r:"y'<$$RH'>+E!)B"$"2  R%7%7A.++NI 'IIOO$]^II&&( 122Q  	$s##	$( $ R'+@@OO-".1A,/P"QQ	R ( .*1o-.sA   F )F G 
FFF G G
G,G''G,c                    SnUR                  S5      n[        R                  " U5      (       d  UR                  SU5        SnUR                  S5      n[        R                  " U5      (       d  UR                  SU5        SnUR                  S5      n[        R
                  R                  U5      (       d  UR                  SU5        UR                  S	5      n[        R
                  R                  U5      (       d  UR                  S
U5        UR                  S5      n[        U5      S:w  a  UR                  S5        SnUS:X  a  UR                  S5        SnUR                  S5      n	U	S;   au  UR                  S5      R                  5       n
U
S;  a  UR                  S5        UR                  S5      nU(       a'  S H!  nX;  d  M
  UR                  SU-   S-   5        M#     UR                  S5      nUS:X  a  UR                  S5        UR                  S5      nUS;  a*  UR                  SU< S[        R                  < S 35        SnU$ )!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 directoryzpid directory %s does not existzwinbind separator   z=the 'winbind separator' parameter must be a single character.+zC'winbind separator = +' might cause problems with group membership.zserver role)z"active directory domain controllerzdomain controllerdczunix charset)zUTF-8UTF8zXWhen acting as Active Directory domain controller, unix charset is expected to be UTF-8.zvfs objects)
dfs_samba4	acl_xattrz3When acting as Active Directory domain controller, z should be in vfs objects.zldap server require strong authallow_sasl_over_tlszWARNING: You have not configured 'ldap server require strong auth = allow_sasl_over_tls'.
Please change to 'yes' (preferred) or 'allow_sasl_without_tls_channel_bindings' (if really needed).zclient use krb5 netlogon)nor   z0You have configured 'client use krb5 netlogon = z!'.
This is experimental in Samba z( and should not be used in production!

)getr   valid_netbios_nameerrorospathisdirwarninglenupperversion)r*   r3   r5   r6   netbios_namer=   r>   piddirwinbind_separatorrolecharset
vfsobjectsentrystrong_authcli_krb5_netlogons                  r9   r   cmd_testparm.do_global_checks   s!   vvn-''55LLF%'EFF;'	''	22LLH"$E&&#ww}}W%%NN=wG(ww}}V$$NN<fEFF#67 !Q&LL & 'E#LL Evvm$TTff^,224G//<= .J8E.Q!"$@AB 9 ff>?//NN&' FF#=>$55LL
 #EMM	34 E    c                 ,    [        U R                  5      e)N)r   allow_access)r*   	deny_list
allow_listcnamecaddrs        r9   r]   cmd_testparm.allow_access   s    !$"3"344r[   c                    SnUR                  5        H%  n[        U5      S:  d  M  UR                  S5          O   UR                  5        H  nUR                  SU5      nUR                  SU5      nU(       a+  U H%  nSU;   d  SU;   d  M  UR	                  SXt5        S	nM'     U(       d  Mb  U H%  nSU;   d  SU;   d  M  UR	                  S
Xt5        S	nM'     M     U$ )NT   zYou 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.)servicesrN   rM   rG   rI   )r*   r3   r5   r6   sr^   r_   rW   s           r9   r   cmd_testparm.do_share_checks   s    A1v{/0
   A|Q/Iq1J&Ee|se| &ABGL %	 ' z'Ee|se| &ABGL %	 (   r[   c                 `   UR                  5        H  nU R                  UR                  S5      UR                  S5      UU5      (       aM  U R                  UR                  SU5      UR                  SU5      X45      (       a  UR                  SX4U5        M  UR                  SX4U5        M     g )Nre   rf   z#Allow connection from %s (%s) to %sz"Deny connection from %s (%s) to %s)ri   r]   rG   r   )r*   r3   r5   r`   ra   rj   s         r9   r    cmd_testparm.check_client_access   s    A!!"&&"6}8Mu"') )!!"&&q"9266-QR;S"'0 0A5QRS@%PQR r[    )NNNNFNFN)__name__
__module____qualname____firstlineno____doc__synopsisoptionsSambaOptionsVersionOptionstakes_optiongroupsr   strtakes_options
takes_argsr:   r   r]   r   r   __static_attributes__rn   r[   r9   r   r   )   s    . H ))-- 	c7	9!9	;S4	5 	}3B	D"</	1t[#=	? 	z*FG&|U@	B#M* J7;=AEJ63pJX5:	Sr[   r   )rJ   r'   r   samba.getoptgetoptru   samba.netcmdr   r   r   r   rn   r[   r9   <module>r      s*   B 
 
   6 6NS7 NSr[   