
    FcK                     *   d dl Z d dlZe j                            d d           dej        d<   d dlZd dlmZ d dlmZ d dl	m
Z
 d dlmZ d d	lmZ d d
lmZ d dlmZ d dlmZ dZdZ G d de          Zedk    rdZdZd dlZ ej                     dS dS )    Nz
bin/python1PYTHONUNBUFFERED)SCOPE_SUBTREE)NTSTATUSError)security)
ndr_unpack) NT_STATUS_NO_IMPERSONATION_TOKEN)libsmb_samba_internal)param)KDCBaseTestFc                   0    e Zd ZdZd Zd Zd Z	 	 d	dZdS )
SmbTestszfTest for SMB authentication using Kerberos credentials stored in a
       credentials cache file.
    c                 .    |                                   d S )N_run_smb_testselfs    ;/usr/lib/python3/dist-packages/samba/tests/krb5/test_smb.pytest_smbzSmbTests.test_smb/   s        c                 2    |                      d           d S )NT)renamer   r   s    r   test_smb_renamezSmbTests.test_smb_rename2   s    $'''''r   c                 4    |                      dd           d S )NFT)include_pacexpect_errorr   r   s    r   test_smb_no_paczSmbTests.test_smb_no_pac5   s.    u(, 	 	. 	. 	. 	. 	.r   FTc                 (   |                                  }|                                }d}d}|                     | j        j        d          }|                                }	|                                 }
|                                 }
|                     ||
|||          \  }}|                     t          j
        |j                   |                    t          d|	z  dg          }|                     d	t          |                     t!          t"          j        |d
         d         d
                   }|rr|                                 }t)          j        |                                          }t)          j        |t(          j        d          |d<   |                    |           t          j                            dd          }|                     t          j        j        d|           d|j        z   t          j        d<   t;          j                    }|                    |                                  j!                   |                    d          }|                     |j"        d|           |"                    dd           |                    d          }|                     |j"        d|           |"                    dd           	 tG          j$        ||||          }| %                    |           nS# tL          $ rF}|s| '                                 |j(        \  }}|                     tR          |           Y d }~d S d }~ww xY w|*                                \  }}}}}|                     ||d
                    d S )NcifstmpF)account_type	use_cache)pacz(sAMAccountName=%s)	objectSid)scope
expressionattrs   r   sAMAccountName
KRB5CCNAME zFILE:zclient min protocolNT1zclient max protocol)lpcreds)+	get_samdbhost_dns_nameget_cached_credsAccountTypeUSERget_usernameget_dc_credscreate_ccache_with_user
addCleanuposremovenamesearchr   assertEquallenr   r   dom_sidget_new_usernameldbMessageget_dnMessageElementFLAG_MOD_REPLACEmodifyenvironget__setitem__s3paramget_contextloadget_lp
configfilesetlibsmbConnassertFalser   failargsr	   posix_whoami)r   r   r   r   samdb	mach_nameserviceshareuser_credentials	user_namemach_credentialsr.   	cachefileldb_ressidnew_namemsgkrb5_ccnames3_lpmin_protocolmax_protocolconneenum_uidgidgidssidsguests                                 r   r   zSmbTests._run_smb_test9   s~      ''))	  00). 1   %1133	,,..,,.. "99:J:J:A:C>I	 : K K	 		9>222 ,,]*?)*K&1]  4 4 	CLL))))71:k+B1+EFF 		 ,,..H+.557788C$'$6x7:7K7G%I %IC ! LL
 jnn\266
.kJJJ#*Y^#;
<  #%%

4;;==+,,,yy!677	#8,GGG		'///yy!677	#8,GGG		'///
	+;y%EGGGD \****  	 	 	 		fGD!=tDDDFFFFF	 )-(9(9(;(;%c4u 	d1g&&&&&s   L	 	
M;MMN)FTF)__name__
__module____qualname____doc__r   r   r   r    r   r   r   r   *   sm           ( ( (. . . 7;#(Y' Y' Y' Y' Y' Y'r   r   __main__)sysr8   pathinsertrF   r@   r   sambar   samba.dcerpcr   	samba.ndrr   samba.ntstatusr	   samba.samba3r
   rO   r   rI   samba.tests.krb5.kdc_base_testr   global_asn1_printglobal_hexdumpr   rn   unittestmainrr   r   r   <module>r      sM  ( 


 				 <      !$
  



             ! ! ! ! ! !             ; ; ; ; ; ; 8 8 8 8 8 8 ) ) ) ) ) ) 6 6 6 6 6 6 h' h' h' h' h'{ h' h' h'V zNOOOHMOOOOO	 r   