
    bÈ                     `   d dl Z d dlZd dlZd dlZd dlmZ d dlmZ d dlZd dl	m
Z
 d dlmZmZ d dlmZ d dlmZmZ d dlmZmZ d d	lmZ d dlmZ d dlZd d
lmZmZmZ d dlm Z m!Z! dZ"h dZ#dZ$dZ%dZ&ej'        Z(ej)        Z*ej+        Z,ej-        Z.ej/        Z0ej1        Z2ej3        Z4	 e5 n# e6$ r d Z5Y nw xY wd Z7 e7             d dZ8d dZ9	 	 d!dZ: G d de          Z;e G d de;                      Z<e G d de;                      Z=e G d de;                      Z>d Z? e?             dS )"    N)SamDB)system_session)SDUtils)DONT_USE_KERBEROSCredentials)FEATURE_SEAL)SubunitOptionsTestProgram)TestCaseldb_err)DynamicTestCase)c_REDc_GREENc_DARK_YELLOW)UF_SERVER_TRUST_ACCOUNTUF_TRUSTED_FOR_DELEGATIONz$f3a64788-5306-11d1-a9c5-0000f80367c1>   dndNSHostNamesAMAccountNameservicePrincipalNameTFreportc                  6    dd l } |                                  d S )Nr   )pdb	set_trace)r   s    6/usr/lib/python3/dist-packages/samba/tests/ldap_spn.py
breakpointr   A   s    


    c                     t          j        d          } t          j        |           }|                     |           t          j        |           }|                     |           t          |           a|                     t                     |                     dddt          j
                                                   |                     dd           |                                 \  }}t          |          d	k    r(|                                  t          j        d	           |                                a|                    t"                    a|d
         at&                                          a|j        a|j        ad S )Nz&python3 ldap_spn.py <server> [options]z--colour
store_truezuse colour text)actionhelpdefaultz--filterz"only run tests matching this regex)r!      r   )optparseOptionParseroptionsSambaOptionsadd_option_groupCredentialsOptionsr	   subunitopts
add_optionsysstdoutisatty
parse_argslenprint_usageexitget_loadparmLPget_credentialsCREDSSERVER	get_realmREALMcolourCOLOUR_TEXTfilterFILTER)parser	sambaoptscredoptsoptsargss        r   initrC   F   sf   
 "02 2F$V,,I
I&&& )&11H
H%%% ((K
K(((
j,!j//11  3 3 3 j'KLLL""$$JD$
4yyA~~				!	!B$$R((E!WFOOE+K[FFFr   c                     t           s| S |dk    rt          |           S |dk    rt          |           S t          |           S )Nerrorpass)r;   r   r   r   )xstates     r   colour_textrI   l   sH     Qxxqzzr   c                 v    | t           } t                      }nd }t          dt           t          ||           S )Nzldap://)urllpsession_infocredentials)r6   r   r   r7   r4   )credssessions     r   	get_samdbrQ   w   sI    } ""'v''%"$ $ $ $r   	samba123@c                 P   t                      }|                    |           |                    |           |                    t                                                     |                    t                                                     |                    t          	                                           |
                    t                                          t          z             |                    t                     d| d| }|                    dd          d         }|                     |||           |rMt#          |           }|                    |          }	|D ]&}
dt&           d|	 d}|                    |
|           't+          |	          }|S )
NCN=,r#   r   )userouz
(OA;CI;WP;z;;))rO   )r   set_usernameset_password
set_domainr6   
get_domain	set_realmr8   set_workstationget_workstationset_gensec_featuresget_gensec_featuresr   set_kerberos_stater   splitnewuserr   get_object_sidSPN_GUIDdacl_add_acerQ   )samdbouusernamewriteable_objectspasswordrO   dnstrshort_ousd_utilssidobjmodunpriv_samdbs                r   add_unpriv_userrs      s    MME	x   	x   	U%%''(((	OOEOO%%&&&	%//11222	e7799LHIII	.///!(!!R!!E xxQ"H	MM(HXM666 ,5>>%%e,,$ 	, 	,C555c555C!!#s++++5)))Lr   c                   L    e Zd ZdZed             Zd Zd Zd Zd Z	d Z
d Zd	S )
LdapSpnTestBaseFc                     t          | dd          rd S | j        D ]T^}}t          rt          j        t          |          s&t          j        dd|          }|                     d|||           Ud S )N	_disabledFz\W+_test_spn)getattrcasesr=   researchsubgenerate_dynamic_test)clsdocrowsnames       r   setUpDynamicTestCasesz%LdapSpnTestBase.setUpDynamicTestCases   s    3U++ 	F) 	C 	CJC$ y-- 6&#s++D%%j$cBBBB	C 	Cr   c                     t          d |D                       }|D ]>}d|v r|                    dd          \  }}nd} t          | d|           |           ?d S )Nc              3   &   K   | ]}|d          V  dS )r   N .0rs     r   	<genexpr>z0LdapSpnTestBase.setup_objects.<locals>.<genexpr>   s&      ))qad))))))r   :r#   dcadd_)setrb   rz   )selfr   objectsr   objtypes        r   setup_objectszLdapSpnTestBase.setup_objects   s    ))D))))) 	2 	2Dd{{ $

3 2 2+GD***++D1111	2 	2r   c                 @    d j         i _        t          d |D                       }|D ]r}|dk    r	|dk    rd}d }n:d|                    dd          z   } fd|                    d          D             }t           j          j        ||           j        |<   sd S )	N*c              3   &   K   | ]}|d          V  dS )   Nr   r   s     r   r   z.LdapSpnTestBase.setup_users.<locals>.<genexpr>   s&      --1!A$------r    nobodywrites_rU   rx   c                 6    g | ]}j         |         d          S )r   )r   )r   rG   r   s     r   
<listcomp>z/LdapSpnTestBase.setup_users.<locals>.<listcomp>   s$    $N$N$NAT\!_Q%7$N$N$Nr   )rg   userdbsr   replacerb   rs   rh   )r   r   permissionspuserrj   s   `     r   setup_userszLdapSpnTestBase.setup_users   s      
 ------- 	A 	AACxxBww$(!! 199S##6#66$N$N$N$N$N$N$N!-dj$'4.?A ADLOO	A 	Ar   c                 x   t          |          }t          |d          }t          |d          }t          r^t          j                                         t          dt          d          d| d           t          j                                         t                      | _	        | j	        
                                | _        |                                                     dd          d         d d	         | _        i | _        d
| j         d| j         | _        |                     | j	        j        | j        dg           | j	                            | j                   |                     |           |                     |           t-          |          D ]\  }}t/          |          dk    r	|\  }}	}
}}n|\  }}	}
}t0          j        }| j        |
         }d|v r|                    dd          \  }}nd}| j        |         \  }}d|i}t9          |	t:                    r|                    |	           n|	|d<   t?          |                                           }|!                    tD                    stG          d|tD          z
   d          dD ]}t9          |$                    |          tJ                    r(||         &                    dtN                     ||<   Rt9          |$                    |          tP                    rd ||         D             ||<   t0          j)        *                    |||          }|tV          u r	 |,                    |           nF# t0          j-        $ r4}t          d|dz    d| dt]          |           d           Y d }~d }~ww xY w| /                    d|dz    d|
 dta          j1        |           d| d| d| d           T|td          u r	 |,                    |           u# t0          j-        $ rW}| /                    d|dz    d | d!t]          |           d"|
 dta          j1        |           d| d|            Y d }~d }~ww xY w|tf          u r	 | j	        ,                    |           t          d|dz    d| d#t          d$d           d"ta          j1        |           d| 
           E# t0          j-        $ r\}t          d|dz    d| d#t          d%d           d&t]          |           d"ta          j1        |           d|            Y d }~d }~ww xY w|th          u rl	 ti                       |,                    |           # t0          j-        $ r4}t          d|dz    d| d't]          |           d           Y d }~ d }~ww xY w	 |,                    |           n# t0          j-        $ r}}|j5        d(         |k    rY d }~e| /                    d|dz    d| d)t]          |           d*t]          |           d"|
 dta          j1        |           d| d|            Y d }~nd }~ww xY w| /                    d|dz    d| d)t]          |           d"|
 dta          j1        |           d| d|            d S )+NrE   rF   
z
##########u   starting «u   »
.r#   ?   zOU=rU   ztree_delete:1   r   r   r   r   zunexpected attr z. Casefold typo?)r   r   x.dnsnamec                 J    g | ] }|                     d t                     !S )r   r   )formatr9   )r   rG   s     r   r   z7LdapSpnTestBase._test_spn_with_args.<locals>.<listcomp>  s,    IIIqAHH\%\\H::IIIr   zrow z of 'z' failed as expected with z:  z on z should fail (rW   z of z failed with z:
z' 	SUCCEEDEDFAILEDz with z' FAILED with r   z' should have failed with z:
not )6rI   r;   r,   stderrflushprintr   r-   rQ   rg   get_default_basednbase_dnidrsplitshort_idr   rh   
addCleanupdelete	create_our   r   	enumerater0   ldbFLAG_MOD_REPLACEr   rb   
isinstancedictupdater   keysissubsetRELEVANT_ATTRS
ValueErrorgetstrr   r9   listMessage	from_dictbadmodifyLdbErrorr   failpprintpformatokr   r   rB   )r   r   r   cdocedocpdocirowrp   datarightsexpectedoprg   r   r   r   mr   kmsges                         r   _test_spn_with_argsz#LdapSpnTestBase._test_spn_with_args   s2	   33((3'' 	J$h//1It1I1I1IJJJJ[[
z4466		((a003CRC8:::4<::
)47_4EFFF
TW%%%4   oo V	N V	NFAs3xx1}}25/T68RR.1+T68) L(Eczz"yya00,s+KBr
A$%% 1,0() qvvxx==D==00 3  "2D>4I "2 "2 "2 3 3 3 = J JaeeAhh,, JQ4;;|E||;<<AaDDa$// JIIAaDIIIAaD+''q"55C3LL%%%%|    ,1 , ,4 , ,$QZZ, , , - - -HHHH 		 21 2 2#2 2&,nQ&7&72 2=D2 2GJ2 2*.2 2 2 3 3 3 3 RRLL%%%%| R R RII QQqS Q Qd Q Q Q Q!'Q Q*0.*;*;Q QAHQ QKNQ Q R R R R R R R RR V##OJ%%c*** :1 : :!%: :)4[&)I)I: :#^A..: :47: : ; ; ; ; | O O O N1 N N!%N N)4Xw)G)GN N")!**N N171B1BN NHKN N O O O O O O O OO
 Z''OLLLLL%%%%| O O OM1MM4MMwqzzMMMNNNNNNNNORLL%%%%| R R RvayH,, II QQqS Q Qt Q Q9@9J9JQ Q%,QZZQ Q "(Q Q +1.*;*;Q Q BIQ Q LOQ Q R R R R R R R RR 		 M1 M M4 M M5<X5F5FM M#M M&,nQ&7&7M M=DM MGJM M N N N NiV	N V	Ns   M--N0<)N++N0<PQ9"AQ44Q9AS##U2AU		U#V  W)V>>WWY),Y$AY$$Y)c                 B   d| d| j          }| dt                                           }| j                            |dt          t          t          z            ||                                 d           | 	                    | j
        |           ||f| j        |<   d S )NrT   z,OU=Domain Controllers,r   computer)r   objectclassuserAccountControldnsHostName
carLicense)r   r9   lowerrg   addr   r   r   r   r   remove_objectr   r   r   r   r   s       r   add_dczLdapSpnTestBase.add_dcF  s    >4>>>>##E##))++
%"%&=&?'@ #A #A"''))
 
 	 	 	 	*D111 ']Tr   c                     d| d| j          }| j                            |||d|                                 d           |                     | j        |           |d f| j        |<   d S )NrT   rU   r   )r   r   samAccountNamer   r   )rh   rg   r   r   r   r   r   )r   r   r   s      r   add_userzLdapSpnTestBase.add_userT  s    #4##$'##
"!''))
 
 	 	 	 	*D111 $ZTr   c                 t    | j                             |          \  }}| j                            |           d S N)r   poprg   r   r   s       r   r   zLdapSpnTestBase.remove_object`  s7    l&&t,,G
"r   N)__name__
__module____qualname__rw   classmethodr   r   r   r   r   r   r   r   r   r   ru   ru      s        IC C [C2 2 2A A ABkN kN kNZ+ + +
( 
( 
(    r   ru   c                   V	   e Zd ZdZg ddddeffddddeffddddeffd	dddefdd
deffddddefdd
deffddddefdd
deffddddefdd
deeffddddefdd
deeffddddefdd
deeffddddefdddeeffddddefdddeeffddddefdddeeffddddefdddeffddddefdddeffddddefdddefdddeffddddefdddefdddeffddddefdddefdddeffd dddefdddefddd!effd"dddefddd#efddd#effd$dddefdddefdddeffd%dddefdd&defdddeffd'dddefdd&defddd#effd(dddefdd&defdddeffd)dddefdddeffd*dddefdddeffd+dddefdddeeffd,dddefdddeeffd-dddefdddeeffd.dddefdddeeffd/d0ddefdddeffd1d0ddefdddeffd2d0ddefddd3effd4d0ddefd5d&deffd6d0ddefd5d&deffd7d0ddefd5d&d8effd9d0ddefd5d&deffd:dddefddd#effd;dddefd5ddeffd<dddefd5dd=effd>dd?defdd@deffdAdd?defdd@deffdBdd?defdd@deffdCddDdefddEdeffdFd0dEdefd5dDdeffdGddHdIidefddJdefddJdefddHdKidefddJdefddLdeffdMddHdNidefddOdefddOdefddHdPidefddOdefddQdefddRdeffdSddIdefddTdefddUdefddVdefd0dWdeffg dXddYdefddZdefdd[defdd\defdd]defdd^deefdd_deefdd`defddadefddbdefddcdefddddeefddedeefddfdefddgdefddhdefddidefddjdefddkdefddldefddmdefd0dndefd0dodefddodefddpdefddqdefddrdefddsdefddtdefddudefddvdefddwdeefddxdefddydefddydefddzdefdd{defdd|deefdd}deefdd~defdddefdddefdddefdddefdddefdddefdddefdddefdddefR ddddefdddefdddefdddeffddddefddHdKidefdddefdddefdddeffddddefdddeffddddefdddeffddddefdddeffddddefddHdKidefdddefdddefdddeffdddHdIidefdddefddHdKidefdddefdddefdddeffZ	dS )LdapSpnTestu   Make sure we can't add clashing servicePrincipalNames.

    This would be possible using sPNMappings aliases — for example, if
    the mapping maps host/ to cifs/, we should not be able to add
    different addresses for each.
    zadd one as adminAhost/{dnsname}r   zadd one as rightful userzattempt to add one as nobodyr   zadd and replace as adminzhost/x.{dnsname}zreplace as rightful userz attempt to replace one as nobodyzadd second as adminzadd second as rightful userzattempt to add second as nobodyz.add the same one twice, simple duplicate errorz)simple duplicate attributes, as non-adminz+add the same one twice, identical duplicatez%add a conflict, host first, as nobodyhost/z.{dnsname}Bcifs/z.{dnsname}z(add a conflict, service first, as nobodycifs/{dnsname}z(three way conflict, host first, as adminCwww/z.{dnsname}z6three way conflict, host first, with sufficient rightszB,AC,Az0three way conflict, host first, adding duplicatez=three way conflict, host first, adding duplicate, full rightszC,B,Az7three way conflict, host first, with other write rightsA,Bz)three way conflict, host first, as nobodyz,three way conflict, services first, as adminwww/{dnsname}z=three way conflict, services first, with service write rightsz,three way conflict, service first, as nobodyzreplace host before specificz&replace host after specific, as nobodyz!non-conflict host before specificz non-conflict host after specificz,non-conflict host before specific, non-adminz+non-conflict host after specific, as nobodyz,add a conflict, host first on user, as adminuser:Cz/add a conflict, host first on user, host rightsz/add a conflict, host first on user, both rightsB,Cz'add a conflict, host first both on useruser:Dz4add a conflict, host first both on user, host rightsz4add a conflict, host first both on user, both rightszC,Dz2add a conflict, host first both on user, as nobodyz2add a conflict, host first, with both write rightsz4add a conflict, host first, second on user, as adminz7add a conflict, host first, second on user, with rightszA,Dznonsense SPNs, part 1, as adminza-b-c/{dnsname}zrrrrrrrrrrrrr /{dnsname}znonsense SPNs, part 1, as userz nonsense SPNs, part 1, as nobodyzadd a conflict, using portzdns/{dnsname}zdns/{dnsname}:53z&add a conflict, using port, port firstzthree part spnsr   	{dnsname}'cifs/{dnsname}/DomainDNSZones.{dnsname}y.{dnsname})cifs/y.{dnsname}/DomainDNSZones.{dnsname}zthree part nonsense spnsbeanzcifs/bean/DomainDNSZones.beanzy.beanzcifs/y.bean/DomainDNSZones.beanzhost/bean/beanzone part spns (no slashes)cifszcifs/r   hostz
dodgy spnsz\/{dnsname}zcifs/\\{dnsname}zcifs/\\\{dnsname}zcifs/\\\{dnsname}/u   cīfs/\\\{dnsname}/u   cifs／sficu   cifs／\\\{dnsname}r   z
/
z
/
/
z
/
/
/
z /* and so on */ u   ¯\_(ツ)_/¯u   ¯\_(つ)_/¯u   ¯\_(㋡)_/¯z//z //z/host/{dnsname}z/host/x.y.zz/ /x.y.zz / / s   host/z /hostu    /HōSTu	    /ħØştz /H0STu    /НoSTz  /hostu    /hostu    2/HōST/⌷[ ][]¨(z (//)z ///z /\//z\//z\\/\\/z|//|z\/\/\\r   z:/:z:/:80u   :/:( ツz:/:/:s   cifs/\example.coms   :/s
   :/b /b/b/bs   a@b/a@b/a@bs	   a/a@b/a@bz%empty part spns (consecutive slashes)zcifs//{dnsname}zcifs/zzzy.{dnsname}/z/host/zzzy.{dnsname}ztoo many spn partsz"cifs/{dnsname}/{dnsname}/{dnsname}zcifs/{dnsname}/{dnsname}/zcifs/y.{dnsname}/{dnsname}/toopzhost/{dnsname}/a/b/cz$add a conflict, host first, as adminz2add a conflict, host first, with host write rightsz8add a conflict, service first, with service write rightsz5adding dNSHostName after cifs with no old dNSHostNamecifs/y.{dnsname}host/y.{dnsname}zchanging dNSHostName after cifsN)
r   r   r   __doc__r   deniedr   r   
constraintr{   r   r   r   r   r   e  s        $F	
b	)	
F 
$
b	)	
	F 
(
V	,	
F 
$
b	)
!3	+	
F 
$
b	)
!3	+	
F& 
,
b	)
!2v	.	
'F0 

b	)
!3C	0	
1F8 
'
b	)
!3C	0	
9F@ 
+
b	)
!2vs	3	
AFJ 
:
b	)
c3	/	
KFR 
5
b	)
c3	/	
SF\ 
7
b	)
c3	/	
]Ff 
1
!3	+
!2v	.	
gFp 
4
b	)
V	,	
qF| 
4
!3	+
!3	+
 #r	*	
}FF 
B
!3	+
!5"	-
 %	,	
GFP 
<
!3	+
!5"	-
!5#	.	
QFZ 
I
!3	+
!5"	-
!7C	0	
[Ff 
C
!3	+
!5"	-
!5#	.	
gFr 
5
!3	+
!3	+
 "f	-	
sF~ 
8
b	)
R	(
j	1	
FH 
I
b	)
R	(
	,	
IFT 
8
b	)
R	(
V	,	
UF^ 
(
b	)
b	)	
_Ff 
2
b	)
V	,	
gFp 
-
b	)
b#	.	
qFx 
,
b	)
b#	.	
yF@ 
8
b	)
b#	.	
AFH 
7
b	)
VS	1	
IFR 
8
$c2	.
b	)	
SFZ 
;
$c2	.
f	-	
[Fb 
;
$c2	.
	+	
cFj 
3
$c2	.
OS"	-	
kFr 
@
$c2	.
OS&	1	sFz 
@
$c2	.
OUB	/	
{FB 
>
$c2	.
OR	0	
CFJ 
>
!3	+
!5"	-	
KFT 
@
b	)
$c2	.	
UF\ 
C
b	)
$eR	0	
]Ff 
+
 #r	*
)3	3	
gFn 
*
 #r	*
)3	3	
oFv 
,
 "f	-
)2v	6	
wF@ 
&
R	(
!3	+	
AFH 
2
&R	0
OS"	-	
IFP 

{+S"	5
8#r	B
8#z	J
}-sB	7
8#r	B
:C	L	
QF` 
$
v&R	0
.R	8
.Z	@
x(#r	2
.R	8
0#z	B
b	)	
aFt 
&
{C	,
vsJ	'
wR	 
sC	$
FC	,	
uFD;	
 ;	

 ~sB	';	
 #S"	-;	
 #S"	-;	
 $c2	.;	
 %sJ	7;	
 }c:s	3;	
 %sJ	<;	
 tS*	%;	
 wR	 ;	
  z3	#!;	
" }c:	.#;	
$ "CS	1%;	
& b#	.';	
, j	1-;	
. j	1/;	
0 tS*	%1;	
2 uc2	3;	
4  #r	*5;	
6 }c2	&7;	
8 z3	#9;	
: wR	 ;;	
< Hc2	&=;	
> Hc2	&?;	
@ xj	)A;	
B y#z	*C;	
D {C	,E;	
F xb	!G;	
H y#r	"I;	
J y#r	"K;	
L }c2	&M;	
N %sB	/O;	
P wR	%Q;	
R vsJ	'S;	
T xj	)U;	
V xj	)W;	
X vsB	Y;	
Z y#r	"[;	
\ vsB	$];	
^ y#r3	'_;	
b sC	$c;	
d uc2	e;	
f wR	 g;	
h z3	#i;	
j wR	 k;	
l 4c2	>m;	
n $c2	.o;	
p b	)q;	
r ~sB	's;	
t |S"	%u;	
 ;	
EF| 
1
 #r	*
 #s	+
%sB	/
%sB	/		
}FH	 

3S#	>
}-sB	7
*C	5
0#s	;
%sC	0	
I	FV	 
0
!3	+
!3	+	
W	F^	 
>
!3	+
!3	/	
_	Ff	 
D
b	)
f	-	
g	Fn	 
A
b	)
}-sB	7
j	1
!3	+
!3	+	
o	F|	 
+
{+S"	5
b	)
}-sB	7
b	)
!3	,
!3	,	
}	FEEEr   r   c            '          e Zd Zdej        vZddddefdddeffddd	defdd
deffddd	defdd
deffddd	defdd
deffddd
defdddeffddd	defdddefddd
gdeffddddidefdd
defdddidefdd	defddde	fddde	ffddddefdddeffddddefdddeffddd	defdd
defdd	deffd dd	defdd
defdd	deffd!dd	defdd
defdd
dee
fdd	deeffd"dd#defdd	defdd
defdd	deffd$dd#defdd	defdd
d%efdd	d%effd&dd	defdd
deefdddeefdd'deefdd(deefdddee
fdd
dee
fdd
deefdddeefdd(dee
ffd)dd	defdd
deefdddeefdd'deefdd(deefdddee
fdd
dee
fdd
deefdddeefdd(dee
ffd*dddefdddefd+d,d+effd-dddefddde	fd+d,d.effd/dd
defdd	defdd	defdd
defd+dd0efd+dd1efdd
defdd2defd+dd+efdd	defdd
de	fdd
d0e	fd+dd+ee
fdd	dee
fdd
defd+dd1eefdd	deffd3dd	defddd0efd+d
d0e	ffd4dd	defdddefd+d
d0e	ffd5dd	defdddefd+d
d+e	ffd6dd	defdd	dee
fddd0efdd
de	fdddee
fdd
defd+d	d+e	fd+d	d1eff	d7dd	d8efdddefd+d
d8e	ffgZd9S ):LdapSpnSambaOnlyTestSAMBA_SELFTESTz5add a conflict, host first, with service write rightsr   r   r   r   r   z5add a conflict, service first, with host write rightsr   r   z'add a conflict, service first, as adminz5add a conflict, service first, with both write rightsr   z7add a conflict, host first both on user, service rightsr  r  r   Dz)add a conflict, along with a re-added SPNzcifs/heeble.example.netzchanging dNSHostName after hostr   r  r  r  r  z!mystery dnsname clash, host firstzhost/heeble.example.netzwww/heeble.example.netz mystery dnsname clash, www firstzreplace as adminz replace as non-admin with rightsz,replace vial delete as non-admin with rightsz#replace as non-admin without rightszcifs/bzreplace as nobodyr   zaccumulate and delete as adminzwww/...zhost/...z&accumulate and delete with user rightsz9three way conflict, host first, with partial write rightsr   r   z;three way conflict, host first, with partial write rights 2r   z.three way conflict sandwich, sufficient rightszA,B,Cr  zldap/{dnsname}z8three way conflict, service first, with all write rightsz9three way conflict, service first, just sufficient rightsz9three way conflict, service first, with host write rightsz9three way conflict, service first, with both write rightsz7three way conflict, services first, with partial rightszA,CN)r   r   r   osenvironrw   r   r  r  r   r   r   r{   r   r   r   r  r    s        !
2I	@
!3	+
!3	/	
 
A
b	)
j	1	
 
3
b	)
j	1	
 
A
b	)

	3	
 
C
$c2	.
OS&	1	
 
5
b	)
(#r	2
)+;<c:	N	
 
+
{+S"	5
b	)
}-sB	7
b	)
!3	,
!3	,	
 
-
-sB	7
,c2	6	
 
,
,c2	6
-sJ	?	
 

b	)
b	)
b	)	

 
,
b	)
b	)
b	)	

 
8
b	)
b	)
b&	1
b#	.		
 
/
xb	!
b	)
f	-
f	-		
 

xb	!
b	)
V	,
V	,		
 
*
b	)
b#	.
R	-
y#r3	'
z3C	(
R	0
b&	1
b#	.
R	-
z3F	+	
 
2
b	)
b#	.
R	-
y#r3	'
z3C	(
R	0
b&	1
b#	.
R	-
z3F	+	
 
E
!3	+
!3	/
 #v	.	

 
G
!3	+
!3	,
 %	,	
 
:
b	)
	+ b	)
b	)
	,
r	*
	+
b	)
R	(
b	) c	*
#	.
R	0
b&	1
b	)
r3	/
	+5	
8 
D
b	)
	,
#	.	

 
E
b	)
R	(
#	.	
 
E
b	)
R	(
c	*	

 
E
b	)
b&	1
	,
	,
R	0
	+
c	*
	+		
 
C
	+
R	(
	,	
CfEEEr   r  c                       e Zd ZdZddddefdddeffdd	ddefd	d
deeffdd	ddeffddd	d	ddej	        fdddidefdddidefdddidefdddideffdd	ddidefd	ddefd	ddidefdddefdddefdddefd	ddeffgZ
dS )LdapSpnAmbitiousTestTz1add a conflict with port, host first both on userr  r   r   r  zwww/{dnsname}:80z2add the same one twice, case-insensitive duplicater   zHost/{dnsname}zspecial SPNzSE3514235-4B06-11D1-AB04-00C04FC2DCD2/75b84f00-a81b-4a19-8ef2-8e483cccff11/{dnsname}z(single part SPNs matching sAMAccountNamezuser:A)r   r   zuser:Br   r   r   r   z three part spns with dnsHostNamer   r  r  r  r  zhost/{y.dnsname}/{y.dnsname}zhost/y.{dnsname}/{dnsname}N)r   r   r   rw   r   r   r   r  r   ERR_NO_SUCH_OBJECTr{   r   r   r   r  r  p  s_       I	<
$c2	.
&S	1	

 
>
b	)
c3	/	
 

 !:
/	 
4 s-02 2368N
P
%s+S"	5
+S13
	C
+S13
	C
%s+S"	5		
 
,
{+S"	5
8#r	B
}-sB	7
8#r	B
:C	L
-sJ	?
+S*	=	
5#EEEr   r  c                  <    t          t          t                     d S )N)modulerA   )r
   r   r*   r   r   r   mainr    s    xk222222r   r   )NrR   )@r,   r  r   r|   samba.samdbr   
samba.authr   r   samba.sd_utilsr   samba.credentialsr   r   samba.gensecr   samba.tests.subunitrunr	   r
   samba.testsr   r   r   samba.getoptgetoptr&   r$   samba.colourr   r   r   
samba.dsdbr   r   re   r   r   r   r   ERR_OPERATIONS_ERRORoperrERR_INSUFFICIENT_ACCESS_RIGHTSr  ERR_CONSTRAINT_VIOLATIONr  ERR_ENTRY_ALREADY_EXISTSexistsFLAG_MOD_ADDr   r   r   FLAG_MOD_DELETEr   r   	NameErrorrC   rI   rQ   rs   ru   r   r  r  r  r   r   r   <module>r0     sA  & 


 				  				       % % % % % % 



 " " " " " " < < < < < < < < % % % % % % > > > > > > > > ) ) ) ) ) ) ) ) ' ' ' ' ' '        6 6 6 6 6 6 6 6 6 6        2  
 
	 		+)
		%	

		JJ            F    
$ 
$ 
$ 
$ '+(   :A A A A Ah A A AH Y Y Y Y Y/ Y Y Yx
 j j j j j? j j jZ % % % % %? % % %P3 3 3 s   %B( (B32B3