+
    4Ssi™W ã                   óä  € ^ RI t ^ RIt^ RIt^ RIHt ^ RIHtHtHt ^ RI	H
t
 ^ RIHtHt ^ RIHt  ! R R]4      t ! R	 R
]4      t]! R ]P*                  P-                  4        4       4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R R]4      t  ! R R]4      t! ! R  R!]4      t"R" t#R# t$R$ t%R# )%é    N)Údsdb)ÚdrsblobsÚdrsuapiÚmisc)Údsdb_Dn)Ú
ndr_unpackÚndr_pack)ÚCounterc                   ó   € ] tR t^%tRtR# )ÚKCCError© N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__static_attributes__r   ó    Ú5/usr/lib/python3/dist-packages/samba/kcc/kcc_utils.pyr   r   %   s   † Ûr   r   c                   ó4   € ] tR t^)t]! ^ ^4      w  ttttt	Rt
R# )ÚNCTyper   N)r   r   r   r   ÚrangeÚunknownÚschemaÚdomainÚconfigÚapplicationr   r   r   r   r   r   )   s   † Ù5:¸1¸a³[Ñ2€Wˆf�f˜f¤kr   r   c              #   óL   "  € T F  w  rVR ,          R8w  g   K  W!3x € K  	  R# 5i):Né   NÚ__Nr   )Ú.0ÚkÚvs   &  r   Ú	<genexpr>r#   .   s"   é € ÐNÑ%<™T˜QÀÀ"ÅÈÁ”&�1•&Ó%<ùs   ‚$™$c                   óH   a € ] tR t^1t o RtR tR tR tR tR t	R t
RtV tR	# )
ÚNamingContextz�Base class for a naming context.

Holds the DN, GUID, SID (if available) and type of the DN.
Subclasses may inherit from this and specialize
c                óX   € Wn         RV n        RV n        \        P                  V n        R# )z;Instantiate a NamingContext

:param nc_dnstr: NC dn string
N)Únc_dnstrÚnc_guidÚnc_sidr   r   Únc_type©Úselfr'   s   &&r   Ú__init__ÚNamingContext.__init__8   s"   € ð
 !ŒØˆŒØˆŒÜ—~‘~ˆŽr   c                óP  € V P                   P                  : R2RV P                  ,          ,           R\        V P                  4      ,          ,           pV P
                  f   VR,           pM	VR,           pVR\        V P                  ,          : RV P                  : R2,           pV# )	ú!Debug dump string output of classÚ:z
	nc_dnstr=%sz
	nc_guid=%sz
	nc_sid=<absent>z
	nc_sid=<present>z

	nc_type=ú (Ú))Ú	__class__r   r'   Ústrr(   r)   Ú
nctype_lutr*   ©r,   Útexts   & r   Ú__str__ÚNamingContext.__str__B   s†   € àŸ™×/Ô/Ð1Ø  4§=¡=Õ0õ1à¤# d§l¡lÓ"3Õ3õ4ˆð �;‰;ÒØÐ/Õ/‰DàÐ0Õ0ˆDá¬z¸$¿,¹,×/GÐ/GØ/3¯|¬|ð=õ =ˆàˆr   c                óä  € R R.p VP                  V P                  \        P                  VR7      pT^ ,          pR T9   d:   \        P                  ! TP                  R TR ,          ^ ,          4      4      T n
        RT9   d   TR,          ^ ,          T n        T P                  f   Q hR#   \        P                   d2   pTP
                  w  rV\        RT P                  : RT: R24      hRp?ii ; i)Ú
objectGUIDÚ	objectSid©ÚbaseÚscopeÚattrszUnable to find naming context (ú) - (r3   N)Úsearchr'   ÚldbÚ
SCOPE_BASEÚLdbErrorÚargsr   r   ÚGUIDÚschema_format_valuer(   r)   )r,   ÚsamdbrA   ÚresÚeÚenumÚestrÚmsgs   &&      r   Úload_ncÚNamingContext.load_ncQ   sÛ   € ØØðˆð	2Ø—,‘, D§M¡MÜ%(§^¡^¸5ð ó BˆCð �!�fˆØ˜3ÔÜŸ9š9 U×%>Ñ%>¸|Ø%(¨Õ%6°qÕ%9ó&;ó <ˆDŒLà˜#ÔØ˜kÕ*¨1Õ-ˆDŒKà�|‰|Ò'Ð'Ò'øô �|‰|ô 	2ØŸ6™6‰LˆTÝØ ŸMœM«4ð1ó 2ð 2ûð	2ús   †,B) Â)C/Â>,C*Ã*C/c                ó~   € V P                   \        P                  8w  g   Q hV P                   \        P                  8H  # )zReturn True if NC is config)r*   r   r   r   ©r,   s   &r   Ú	is_configÚNamingContext.is_confige   s+   € à�|‰|œvŸ~™~Ô-Ð-Ð-Ø�|‰|œvŸ}™}Ñ,Ð,r   c                ó´  € V P                   f   V P                  V4       V P                  \        VP	                  4       4      8X  d   \
        P                  V n        R# V P                  \        VP                  4       4      8X  d   \
        P                  V n        R# V P                  e   \
        P                  V n        R# \
        P                  V n        R# )z\Given an NC object, identify what type it is thru
the samdb basedn strings and NC sid value
N)r(   rP   r'   r5   Úget_schema_basednr   r   r*   Úget_config_basednr   r)   r   r   )r,   rJ   s   &&r   Úidentify_by_basednÚ NamingContext.identify_by_basednj   sˆ   € ð �<‰<ÒØ�L‰L˜Ôð �=‰=œC × 7Ñ 7Ó 9Ó:Ô:Ü!Ÿ=™=ˆDŽLØ�]‰]œc %×"9Ñ"9Ó";Ó<Ô<Ü!Ÿ=™=ˆDŽLØ�[‰[Ò$Ü!Ÿ=™=ˆDŽLä!×-Ñ-ˆDŽLr   c                ó  € VR8X  d   \         P                  V n        M5VR8X  d   \         P                  V n        MVR8X  d   V P                  V4       V P                  \         P                  8X  d   V P                  V4       R# R# )a  Given an NC which has been discovered thru the
nTDSDSA database object, determine what type of NC
it is (i.e. schema, config, domain, application) via
the use of the schema attribute under which the NC
was found.

:param attr: attr of nTDSDSA object where NC DN appears
úmsDS-HasDomainNCsÚhasPartialReplicaNCsÚhasMasterNCsN)r   r   r*   rY   r   ©r,   rJ   Úattrs   &&&r   Úidentify_by_dsa_attrÚ"NamingContext.identify_by_dsa_attr�   sk   € ð Ð&Ô&Ü!Ÿ=™=ˆD�Lð Ð+Ô+Ü!Ÿ=™=ˆD�Lð �^Ô#Ø×#Ñ# EÔ*ð �<‰<œ6Ÿ>™>Ô)Ø×#Ñ# EÖ*ñ *r   )r'   r(   r)   r*   N)r   r   r   r   Ú__doc__r-   r9   rP   rT   rY   ra   r   Ú__classdictcell__©Ú__classdict__s   @r   r%   r%   1   s-   ø‡ € ñò&òò(ò(-ò
.÷.+ð +r   r%   c                   ó–   a € ] tR t^¢t o RtR tR tRR ltR tR t	R t
R tR	 tR
 tRR ltR tR tR tR tR tR tRR ltRtV tR# )Ú	NCReplicazÐNaming context replica that is relative to a specific DSA.

This is a more specific form of NamingContext class (inheriting from that
class) and it identifies unique attributes of the DSA's replica for a NC.
c                óä   € VP                   V n        VP                  V n        RV n        RV n        RV n        ^ V n        RV n        . V n	        . V n
        RV n        \        P                  W4       R# )zwInstantiate a Naming Context Replica

:param dsa_guid: GUID of DSA where replica appears
:param nc_dnstr: NC dn string
FN)Ú	dsa_dnstrÚrep_dsa_dnstrÚdsa_guidÚrep_dsa_guidÚrep_defaultÚrep_partialÚrep_roÚrep_instantiated_flagsÚrep_fsmo_role_ownerÚrep_repsFromÚ
rep_repsToÚrep_present_criteria_oner%   r-   )r,   Údsar'   s   &&&r   r-   ÚNCReplica.__init__©   sp   € ð !Ÿ]™]ˆÔØŸL™LˆÔØ ˆÔØ ˆÔØˆŒØ&'ˆÔ#à#'ˆÔ ð ˆÔð ˆŒð ).ˆÔ%ô 	×Ñ˜tÖ.r   c                óh  € RV P                   P                  ,          RV P                  ,          ,           RV P                  ,          ,           RV P                  ,          ,           RV P
                  ,          ,           RV P                  ,          ,           RV P                  4       ,          ,           RV P                  ,          ,           R	P                  R
 V P                   4       4      ,           R	P                  R V P                   4       4      ,           p\        P                  V 4      : RV: 2# )r0   ú%s:ú
	dsa_dnstr=%sú
	dsa_guid=%sz
	default=%sú
	ro=%sz
	partial=%sz
	present=%sz
	fsmo_role_owner=%sÚ c              3   ó4   "  € T F  pR V,          x € K  	  R# 5i©ú
%sNr   ©r    Úreps   & r   r#   Ú$NCReplica.__str__.<locals>.<genexpr>Ò   s   é € ÐAÑ/@¨�v —|’|Ó/@ùó   ‚c              3   ó4   "  € T F  pR V,          x € K  	  R# 5ir   r   r�   s   & r   r#   rƒ   Ó   s   é € Ð?©¨�v —|’|«ùr„   Ú
)r4   r   rk   rm   rn   rp   ro   Ú
is_presentrr   Újoinrs   rt   r%   r9   r7   s   & r   r9   ÚNCReplica.__str__È   sû   € à�t—~‘~×.Ñ.Õ.Ø! D×$6Ñ$6Õ6õ7à  4×#4Ñ#4Õ4õ5ð   $×"2Ñ"2Õ2õ3ð ˜TŸ[™[Õ(õ	)ð
   $×"2Ñ"2Õ2õ3ð   $§/¡/Ó"3Õ3õ4ð (¨$×*BÑ*BÕBõCð �w‰wÑA¨t×/@Ò/@ÓAÓAõBð �w‰wÑ?¨t¯ªÓ?Ó?õ	@ˆô )×0Ñ0°Ö6ºÐ=Ð=r   c                ó   € Wn         R# )z*Set or clear NC replica instantiated flagsN)rq   )r,   Úflagss   &&r   Úset_instantiated_flagsÚ NCReplica.set_instantiated_flags×   s   € à&+Ö#r   c                óž  € VR8X  d   RV n         RV n        M VR8X  d	   RV n        M‘VR8X  d`   RV n        V P                  \	        VP                  4       4      8w  d0   V P                  \	        VP                  4       4      8w  d   RV n        M+VR8X  d   RV n        RV n        MVR8X  d   RV n        RV n        \        P                  WV4       R# )	zÌGiven an NC which has been discovered thru the
nTDSDSA database object, determine what type of NC
replica it is (i.e. partial, read only, default)

:param attr: attr of nTDSDSA object where NC DN appears
r]   Tr\   r^   úmsDS-hasFullReplicaNCsúmsDS-hasMasterNCsFN)
ro   ru   rn   r'   r5   rW   rX   rp   r%   ra   r_   s   &&&r   ra   ÚNCReplica.identify_by_dsa_attrÛ   sÅ   € ð Ð)Ô)Ø#ˆDÔØ,0ˆDÕ)ð
 Ð(Ô(Ø#ˆDÕð �^Ô#Ø,0ˆDÔ)à�}‰}¤ E×$;Ñ$;Ó$=Ó >Ô>Ø�}‰}¤ E×$;Ñ$;Ó$=Ó >Ô>Ø#'�Ô øð Ð-Ô-Ø,0ˆDÔ)ØˆD�Kð Ð(Ô(Ø,0ˆDÔ)ØˆDŒKô
 	×*Ñ*¨4¸Ö=r   c                ó   € V P                   # )zMWhether this is a default domain for the dsa that this NC appears on
        )rn   rS   s   &r   Ú
is_defaultÚNCReplica.is_default  s   € ð ×ÑÐr   c                ó   € V P                   # )z&Return True if NC replica is read only)rp   rS   s   &r   Úis_roÚNCReplica.is_ro  s   € à�{‰{Ðr   c                ó   € V P                   # )z$Return True if NC replica is partial)ro   rS   s   &r   Ú
is_partialÚNCReplica.is_partial  s   € à×ÑÐr   c                óz   € V P                   '       d)   V P                  \        P                  ,          ^ 8X  d   R# R# )a  Given an NC replica which has been discovered thru the
nTDSDSA database object and populated with replica flags
from the msDS-HasInstantiatedNCs; return whether the NC
replica is present (true) or if the IT_NC_GOING flag is
set then the NC replica is not present (false)
TF)ru   rq   r   ÚINSTANCE_TYPE_NC_GOINGrS   s   &r   r‡   ÚNCReplica.is_present  s/   € ð ×(×(Ð(Ø×&Ñ&¬×)DÑ)DÕDÈÔIÙÙr   c                óF  €  VP                  V P                  \        P                  R.R7      pT^ ,          pRT9   d_   TR,           FO  p \        \        P                  T4      p\        T P                  T4      p
T P                  P!                  T
4       KQ  	  R# R#   \        P                   d2   pTP
                  w  rE\        RT P                  : RT: R24      hRp?ii ; i  \         d.   p	\        RT,          \        P                  R7        Rp	?	KÓ  Rp	?	ii ; i)	a
  Given an NC replica which has been discovered thru the nTDSDSA
database object, load the repsFrom attribute for the local replica.
held by my dsa.  The repsFrom attribute is not replicated so this
attribute is relative only to the local DSA that the samdb exists on
ÚrepsFromr>   úUnable to find NC for (rB   r3   Nzbad repsFrom NDR: %r©Úfile)rC   r'   rD   rE   rF   rG   r   r   r   ÚrepsFromToBlobÚRuntimeErrorÚprintÚsysÚstderrÚ
RepsFromTors   Úappend)r,   rJ   rK   Úe1rM   rN   rO   ÚvalueÚunpackedrL   r‚   s   &&         r   Úload_repsFromÚNCReplica.load_repsFrom%  sù   € ð	2Ø—,‘, D§M¡M¼¿¹Ø&0 \ð ó 3ˆCð �!�fˆð ˜ÔØ˜ZŸ˜�ðÜ)¬(×*AÑ*AÀ5ÓI�Hô
 ! §¡°Ó9�Ø×!Ñ!×(Ñ(¨Ö-ó )ñ øô �|‰|ô 	2ØŸ7™7‰LˆTÝØ ŸMœM«4ð1ó 2ð 2ûð	2ûô $ô ÜÐ0°EÕ:Ü"Ÿz™zõ+åûðúó/   ‚-B ÁC(ÂC%Â4,C Ã C%Ã(D Ã3"DÄD c                óî  € Rp. p. pV P                    Fv  pVP                  '       d   VP                  V4       RpK*  VP                  4       '       d   VP	                  4        RpVP                  \        VP                  4      4       Kx  	  V F  pV P                   P                  V4       K   	  . pV'       d	   V'       d   R# \        P                  ! 4       p\        P                  ! WP                  4      Vn        \        P                  ! V\        P                  R4      VR&    VP                  V4       R#   \        P                    d$   p\#        RT P                  : RT: R24      hRp?ii ; i)zCommit repsFrom to the databaseFTNrŸ   zCould not set repsFrom for (rB   r3   )rs   Úto_be_deletedr©   Úis_modifiedÚset_unmodifiedr	   Úndr_blobÚremoverD   ÚMessageÚDnr'   ÚdnÚMessageElementÚFLAG_MOD_REPLACEÚmodifyrF   r   )	r,   rJ   Úror»   ÚnewrepsÚdelrepsrŸ   ÚmrN   s	   &&&      r   Úcommit_repsFromÚNCReplica.commit_repsFromB  s.  € ð ˆØˆØˆà×)Ô)ˆHð ×%×%Ð%Ø—‘˜xÔ(Ø�Ùà×#Ñ#×%Ò%Ø×'Ñ'Ô)Ø�ð �N‰Nœ8 H×$5Ñ$5Ó6Ö7ñ' *ó,  ˆHØ×Ñ×$Ñ$ XÖ.ñ  àˆ÷ ŸÙä�KŠK‹MˆÜ�vŠv�eŸ]™]Ó+ˆŒô ×Ò˜w¬×(<Ñ(<¸jÓIð 	
ˆ*‰ð	2Ø�L‰L˜ŽOøä�|‰|ô 	2ÝØ ŸMœM«4ð1ó 2ð 2ûð	2úó   Ä)D< Ä<E4ÅE/Å/E4c                ó
  €  VP                  V P                  \        P                  R.R7      pT^ ,          pRT9   du   TR,          ^ ,          p\        \        P                  T4      pTP                  ^8w  d   \        RTP                  ,          4      hTP                  P                  T n        R# . T n        R#   \        P                   d2   pTP
                  w  rE\        RT P                  : RT: R24      hRp?ii ; i)a  Given an NC replica which has been discovered thru the nTDSDSA
database object, load the replUpToDateVector attribute for the
local replica. held by my dsa. The replUpToDateVector
attribute is not replicated so this attribute is relative only
to the local DSA that the samdb exists on

ÚreplUpToDateVectorr>   r    rB   r3   Nz(Unexpected replUpToDateVector version %d)rC   r'   rD   rE   rF   rG   r   r   r   ÚreplUpToDateVectorBlobÚversionÚAttributeErrorÚctrÚcursorsÚrep_replUpToDateVector_cursors)	r,   rJ   rK   Úe2rM   rN   rO   r«   Úblobs	   &&       r   Úload_replUpToDateVectorÚ!NCReplica.load_replUpToDateVector�  sæ   € ð	2Ø—,‘, D§M¡M¼¿¹Ø&:Ð%;ð ó =ˆCð �!�fˆð   3Ô&ØÐ,Õ-¨aÕ0ˆEÜœh×=Ñ=Ø#ó%ˆDà�|‰|˜qÔ ä$Ð%OØ'+§|¡|õ&4ó 5ð 5ð 37·(±(×2BÑ2BˆDÖ/à24ˆDÖ/øô' �|‰|ô 	2ØŸ7™7‰LˆTÝØ ŸMœM«4ð1ó 2ð 2ûð	2ús   ‚-B< Â<DÃ,C=Ã=Dc                óF   € R P                  R V P                   4       4      # )r†   c              3   ó^   "  € T F#  qP                   '       g   K  \        V4      x € K%  	  R # 5i©N)r±   r5   ©r    Úxs   & r   r#   Ú2NCReplica.dumpstr_to_be_deleted.<locals>.<genexpr>£  s   é € ÐNÑ): A¿o½oœœ˜QŸ˜Ó):ùs   ‚-š-©rˆ   rs   rS   s   &r   Údumpstr_to_be_deletedÚNCReplica.dumpstr_to_be_deleted¢  ó   € Ø�y‰yÑN¨×):Ò):ÓNÓNÐNr   c                óF   € R P                  R V P                   4       4      # )r†   c              3   óf   "  € T F'  qP                  4       '       g   K  \        V4      x € K)  	  R # 5irÑ   )r²   r5   rÒ   s   & r   r#   Ú3NCReplica.dumpstr_to_be_modified.<locals>.<genexpr>¦  s    é € ÐNÑ): A¿m¹m¿oœœ˜QŸ˜Ó):ùs   ‚1ž1rÕ   rS   s   &r   Údumpstr_to_be_modifiedÚ NCReplica.dumpstr_to_be_modified¥  rØ   r   c                ó4  €  VP                  V P                  \        P                  R.R7      pT^ ,          pRT9   d   TR,          T n        R# R#   \        P                   d2   pTP
                  w  rE\        RT P                  : RT: R24      hRp?ii ; i)zrGiven an NC replica which has been discovered thru the nTDSDSA
database object, load the fSMORoleOwner attribute.
ÚfSMORoleOwnerr>   r    rB   r3   N)rC   r'   rD   rE   rF   rG   r   rr   )r,   rJ   rK   Úe3rM   rN   rO   s   &&     r   Úload_fsmo_rolesÚNCReplica.load_fsmo_roles¨  s�   € ð	2Ø—,‘, D§M¡M¼¿¹Ø&5Ð%6ð ó 8ˆCð �!�fˆð ˜cÔ!Ø'*¨?Õ';ˆDÖ$ñ "øô �|‰|ô 	2ØŸ7™7‰LˆTÝØ ŸMœM«4ð1ó 2ð 2ûð	2ús   ‚-A ÁBÁ&,BÂBc                óH   € V P                   e   V P                   V8X  d   R# R# )NTF)rr   ©r,   rj   s   &&r   Úis_fsmo_role_ownerÚNCReplica.is_fsmo_role_owner»  s"   € Ø×#Ñ#Ò/Ø×#Ñ# yÔ0ÙÙr   c                óF  €  VP                  V P                  \        P                  R.R7      pT^ ,          pRT9   d_   TR,           FO  p \        \        P                  T4      p\        T P                  T4      p
T P                  P!                  T
4       KQ  	  R# R#   \        P                   d2   pTP
                  w  rE\        RT P                  : RT: R24      hRp?ii ; i  \         d.   p	\        RT,          \        P                  R7        Rp	?	KÓ  Rp	?	ii ; i)	ar  Given an NC replica which has been discovered thru the nTDSDSA
database object, load the repsTo attribute for the local replica.
held by my dsa.  The repsTo attribute is not replicated so this
attribute is relative only to the local DSA that the samdb exists on

This is responsible for push replication, not scheduled pull
replication. Not to be confused for repsFrom.
ÚrepsTor>   r    rB   r3   Nzbad repsTo NDR: %rr¡   )rC   r'   rD   rE   rF   rG   r   r   r   r£   r¤   r¥   r¦   r§   r¨   rt   r©   )r,   rJ   rK   Úe4rM   rN   rO   r«   r¬   rL   r‚   s   &&         r   Úload_repsToÚNCReplica.load_repsToÁ  sö   € ð	2Ø—,‘, D§M¡M¼¿¹Ø&. Zð ó 1ˆCð �!�fˆð �sŒ?Ø˜XŸ˜�ðÜ)¬(×*AÑ*AÀ5ÓI�Hô
 ! §¡°Ó9�Ø—‘×&Ñ& sÖ+ó 'ñ øô �|‰|ô 	2ØŸ7™7‰LˆTÝØ ŸMœM«4ð1ó 2ð 2ûð	2ûô $ô ÜÐ.°%Õ8Ü"Ÿz™zõ+åûðúr¯   c                óî  € Rp. p. pV P                    Fv  pVP                  '       d   VP                  V4       RpK*  VP                  4       '       d   VP	                  4        RpVP                  \        VP                  4      4       Kx  	  V F  pV P                   P                  V4       K   	  . pV'       d	   V'       d   R# \        P                  ! 4       p\        P                  ! WP                  4      Vn        \        P                  ! V\        P                  R4      VR&    VP                  V4       R#   \        P                    d$   p\#        RT P                  : RT: R24      hRp?ii ; i)zCommit repsTo to the databaseFTNrè   zCould not set repsTo for (rB   r3   )rt   r±   r©   r²   r³   r	   r´   rµ   rD   r¶   r·   r'   r¸   r¹   rº   r»   rF   r   )	r,   rJ   r¼   r»   r½   r¾   rè   r¿   rN   s	   &&&      r   Úcommit_repsToÚNCReplica.commit_repsToá  s(  € ð ˆØˆØˆà—o”oˆFð ×#×#Ð#Ø—‘˜vÔ&Ø�Ùà×!Ñ!×#Ò#Ø×%Ñ%Ô'Ø�ð �N‰Nœ8 F§O¡OÓ4Ö5ñ' &ó, ˆFØ�O‰O×"Ñ" 6Ö*ñ àˆ÷ ŸÙä�KŠK‹MˆÜ�vŠv�eŸ]™]Ó+ˆŒô ×Ò˜w¬×(<Ñ(<¸hÓGð 	
ˆ(‰ð	2Ø�L‰L˜ŽOøä�|‰|ô 	2ÝØ ŸMœM«4ð1ó 2ð 2ûð	2úrÂ   )rn   rk   rm   rr   rq   ro   ru   rÊ   rs   rt   rp   N©r   ©F)r   r   r   r   rc   r-   r9   rŒ   ra   r“   r–   r™   r‡   r­   rÀ   rÍ   rÖ   rÜ   rá   rå   rê   rí   r   rd   re   s   @r   rh   rh   ¢   sj   ø‡ € ñò/ò>>ô,ò/>òb ò
ò ò
ò.ô:=2ò~5òBOòOò<ò&ò,÷@=2ò =2r   rh   c                   ó¢   a € ] tR tRt o R tR tR tR tR tR t	R t
R	 tR
 tR tR tR tR tR tRR ltR tR tR tR tR tR tRtV tR# )ÚDirectoryServiceAgenti!  c                óž   € Wn         RV n        RV n        RV n        RV n        ^ V n        ^ V n        RV n        / V n        / V n	        / V n
        R# )z„Initialize DSA class.

Class is subsequently fully populated by calling the load_dsa() method

:param dsa_dnstr:  DN of the nTDSDSA
NF)rj   rl   Údsa_ividÚ	dsa_is_roÚdsa_is_istgÚoptionsÚdsa_behaviorÚdefault_dnstrÚcurrent_rep_tableÚneeded_rep_tableÚconnect_tablerä   s   &&r   r-   ÚDirectoryServiceAgent.__init__#  s[   € ð #ŒØˆŒØˆŒØˆŒØ ˆÔØˆŒØˆÔØ!ˆÔð "$ˆÔð !#ˆÔð
  ˆÖr   c                óÒ  € RV P                   P                  ,          pV P                  e   VRV P                  ,          ,           pV P                  e$   VR\	        V P                  4      ,          ,           pV P
                  e$   VR\	        V P
                  4      ,          ,           pVRV P                  4       ,          RV P                  4       ,          ,           RV P                  4       ,          ,           R,           R	V P                  4       ,          ,           R
,           R	V P                  4       ,          ,           R,           R	V P                  4       ,          ,           ,          pV# )r0   ry   rz   r{   z
	dsa_ivid=%sr|   z
	gc=%sz	
	istg=%sz
current_replica_table:r€   z
needed_replica_table:z
connect_table:)r4   r   rj   rl   r5   rô   r–   Úis_gcÚis_istgÚdumpstr_current_replica_tableÚdumpstr_needed_replica_tableÚdumpstr_connect_tabler7   s   & r   r9   ÚDirectoryServiceAgent.__str__@  s&  € ð �t—~‘~×.Ñ.Õ.ˆØ�>‰>Ò%ØÐ,¨t¯~©~Õ=Õ=ˆDØ�=‰=Ò$ØÐ+¬c°$·-±-Ó.@Õ@Õ@ˆDØ�=‰=Ò$ØÐ+¬c°$·-±-Ó.@Õ@Õ@ˆDà�˜dŸj™j›lÕ*Ø˜dŸj™j›lÕ*õ+à §¡£Õ.õ/ð +õ+ð ˜×;Ñ;Ó=Õ=õ	>ð
 *õ*ð ˜×:Ñ:Ó<Õ<õ=ð #õ#ð ˜×3Ñ3Ó5Õ5õ6õ 	6ˆð ˆr   c                ó8   € V P                   P                  V4      # rÑ   )rú   Úgetr+   s   &&r   Úget_current_replicaÚ)DirectoryServiceAgent.get_current_replicaW  s   € Ø×%Ñ%×)Ñ)¨(Ó3Ð3r   c                óB   € V P                   ;'       g    V P                  # )zAReturns True if dsa is intersite topology generator for it's site)rö   rõ   rS   s   &r   r   ÚDirectoryServiceAgent.is_istgZ  s   € ð ×Ñ×1Ð1 4§>¡>Ð1r   c                ó   € V P                   # )z1Returns True if dsa a read only domain controller)rõ   rS   s   &r   r–   ÚDirectoryServiceAgent.is_ro_  s   € à�~‰~Ðr   c                óV   € V P                   \        P                  ,          ^ 8w  d   R# R# )z*Returns True if dsa hosts a global catalogTF)r÷   r   ÚDS_NTDSDSA_OPT_IS_GCrS   s   &r   rÿ   ÚDirectoryServiceAgent.is_gcc  s   € à�L‰Lœ4×4Ñ4Õ4¸Ô:ÙÙr   c                ó,   € V P                   V8¼  d   R# R# )z—Is dsa at minimum windows level greater than or equal to (version)

:param version: Windows version to test against
    (e.g. DS_DOMAIN_FUNCTION_2008)
TF)rø   )r,   rÆ   s   &&r   Úis_minimum_behaviorÚ)DirectoryServiceAgent.is_minimum_behaviori  s   € ð ×Ñ Ô'ÙÙr   c                óV   € V P                   \        P                  ,          ^ 8w  d   R# R# )z>Whether this allows NTDSConnection translation in its options.TF)r÷   r   Ú%DS_NTDSDSA_OPT_DISABLE_NTDSCONN_XLATErS   s   &r   Úis_translate_ntdsconn_disabledÚ4DirectoryServiceAgent.is_translate_ntdsconn_disableds  s   € à�L‰Lœ4×EÑEÕEÈ!ÔKÙÙr   c                ó2   € V P                   V P                  3# )z5Return DSA current and needed replica tables
        )rú   rû   rS   s   &r   Úget_rep_tablesÚ$DirectoryServiceAgent.get_rep_tablesy  s   € ð ×%Ñ% t×'<Ñ'<Ð<Ð<r   c                óB   € V P                   P                  R4      w  rpV# )z(Get the parent DN string of this object.Ú,)rj   Ú	partition)r,   ÚheadÚsepÚtails   &   r   Úget_parent_dnstrÚ&DirectoryServiceAgent.get_parent_dnstr~  s   € àŸ.™.×2Ñ2°3Ó7‰ˆ�4Øˆr   c                ó>  € . ROp VP                  V P                  \        P                  VR7      pT^ ,          p\        P                  ! TP                  RTR,          ^ ,          4      4      T n
        R
T9   d:   \        P                  ! TP                  RTR
,          ^ ,          4      4      T n        RT9   d   \        TR,          ^ ,          4      T n        RT9   d'   \        TR,          ^ ,          4      R8X  d	   RT n        MRT n        RT9   d   \        TR,          ^ ,          4      T n        T P#                  T4       T P%                  T4       R	#   \        P                   d2   pTP
                  w  rV\        RT P                  : RT: R24      hR	p?ii ; i)zÉLoad a DSA from the samdb.

Prior initialization has given us the DN of the DSA that we are to
load.  This method initializes all other attributes, including loading
the NC replica table for this DSA.
r<   r÷   úmsDS-isRODCúmsDS-Behavior-Versionr>   zUnable to find nTDSDSA for (rB   r3   NÚinvocationIdÚTRUETF)r<   ÚinvocationIDr÷   r#  r$  )rC   rj   rD   rE   rF   rG   r   r   rH   rI   rl   rô   Úintr÷   r5   rõ   rø   Úload_current_replica_tableÚload_connection_table)r,   rJ   rA   rK   Úe5rM   rN   rO   s   &&      r   Úload_dsaÚDirectoryServiceAgent.load_dsaƒ  sd  € ò*ˆð
	3Ø—,‘, D§N¡N¼#¿.¹.Ø%*ð ó ,ˆCð �!�fˆÜŸ	š	 %×";Ñ";¸LØ"% lÕ"3°AÕ"6ó#8ó 9ˆŒð
 ˜SÔ Ü ŸIšI e×&?Ñ&?ÀØ&)¨.Õ&9¸!Õ&<ó'>ó ?ˆDŒMð ˜ÔÜ˜s 9�~¨aÕ0Ó1ˆDŒLà˜CÔ¤C¨¨MÕ(:¸1Õ(=Ó$>À&Ô$HØ!ˆD�Nà"ˆDŒNà" cÔ)Ü # CÐ(?Õ$@ÀÕ$CÓ DˆDÔð 	×'Ñ'¨Ô.ð 	×"Ñ" 5Ö)øô= �|‰|ô 	3ØŸ7™7‰LˆTÝØ ŸNœN«Dð2ó 3ð 3ûð	3ús   †,E ÅFÅ+,FÆFc                ó:  € . R
Op VP                  V P                  \        P                  VR7      p/ p\        T^ ,          4      ^ 8”  dæ   T^ ,          P                  4        FÉ  pTR8X  d   K  T^ ,          T,           F©  p	\        YP                  R4      4      p
T
P                  4       p\        T
P                  4      pYÇ9  d   \        Y4      pY×T&   MY|,          pTR8X  d   TP                  T4       Kz  TP!                  Y4       TP#                  4       '       g   K£  YÀn        K«  	  KË  	  M\        R	T P                  ,          4      hYpn        R#   \        P                   d2   pTP
                  w  rV\        RT P                  : RT: R24      hRp?ii ; i)aã  Method to load the NC replica's listed for DSA object.

This method queries the samdb for (hasMasterNCs, msDS-hasMasterNCs,
hasPartialReplicaNCs, msDS-HasDomainNCs, msDS-hasFullReplicaNCs, and
msDS-HasInstantiatedNCs) to determine complete list of NC replicas that
are enumerated for the DSA.  Once a NC replica is loaded it is
identified (schema, config, etc) and the other replica attributes
(partial, ro, etc) are determined.

:param samdb: database to query for DSA replica list
úmsDS-HasInstantiatedNCsr>   z Unable to find nTDSDSA NCs for (rB   r3   Nr¸   Úutf8zNo nTDSDSA NCs for (%s))r^   r�   r]   r\   r�   r/  )rC   rj   rD   rE   rF   rG   r   ÚlenÚkeysr   ÚdecodeÚget_binary_integerr5   r¸   rh   rŒ   ra   r“   rù   rú   )r,   rJ   ÚncattrsrK   Úe6rM   rN   Ú	tmp_tabler!   r«   Údsdnr‹   Údnstrr‚   s   &&            r   r)  Ú0DirectoryServiceAgent.load_current_replica_table³  sg  € ò
ˆð	3Ø—,‘, D§N¡N¼#¿.¹.Ø%,ð ó .ˆCð ˆ	ô ˆs�1�v‹;˜Œ?ð ˜•V—[‘[–]�Ø˜”9Ùð
 ! �V AŸY˜Y�Eô # 5¯,©,°vÓ*>Ó?�DØ ×3Ñ3Ó5�EÜ §¡›L�EàÔ-Ü'¨Ó4˜Ø+. %Ò(à'Õ.˜àÐ5Ô5Ø×2Ñ2°5Ô9Ù à×,Ñ,¨UÔ6ð —~‘~×'Ô'Ø-2Ö*ó- 'ò #ô> Ð4°t·~±~ÕEÓFÐFð "+Öøôg �|‰|ô 	3ØŸ7™7‰LˆTÝØ ŸNœN«Dð2ó 3ð 3ûð	3ús   †,E ÅFÅ),FÆFc                ó6   € WP                   VP                  &   R# )zMMethod to add a NC replica that "should be present" to the
needed_rep_table.
N)rû   r'   )r,   r‚   s   &&r   Úadd_needed_replicaÚ(DirectoryServiceAgent.add_needed_replica  s   € ð /2×Ñ˜cŸl™lÓ+r   c                ó¦  €  VP                  V P                  \        P                  RR7      pT FT  p\        TP                  4      pYpP                  9   d   K*  \        T4      pTP                  T4       Y€P                  T&   KV  	  R#   \        P                   d2   pTP
                  w  rE\        RT P                  : RT: R24      hRp?ii ; i)zsMethod to load the nTDSConnections listed for DSA object.

:param samdb: database to query for DSA connection list
z(objectClass=nTDSConnection)©r?   r@   Ú
expressionú#Unable to find nTDSConnection for (rB   r3   N)rC   rj   rD   ÚSCOPE_SUBTREErF   rG   r   r5   r¸   rü   ÚNTDSConnectionÚload_connection)	r,   rJ   rK   Úe7rM   rN   rO   r9  Úconnects	   &&       r   r*  Ú+DirectoryServiceAgent.load_connection_table  s¹   € ð
	3Ø—,‘, D§N¡NÜ%(×%6Ñ%6Ø*Hð ó JˆCó ˆCÜ˜Ÿ™“KˆEð ×*Ñ*Ô*Ùä$ UÓ+ˆGà×#Ñ# EÔ*Ø(/×Ñ˜uÓ%ó øô �|‰|ô 	3ØŸ7™7‰LˆTÝØ ŸNœN«Dð2ó 3ð 3ûð	3ús   ‚,B
 Â
CÂ,CÃCc                ót  € . pV P                   P                  4        F�  w  rEVP                  '       d   VP                  W4       VP                  '       d   VP                  W4       VP                  '       g   K_  VP                  W4       VP                  V4       Kƒ  	  V F  pV P                   V K  	  R# )aC  Method to commit any uncommitted nTDSConnections
modifications that are in our table.  These would be
identified connections that are marked to be added or
deleted

:param samdb: database to commit DSA connection list to
:param ro: if (true) then perform internal operations but
    do not write to the database (readonly)
N)	rü   ÚitemsÚto_be_addedÚcommit_addedÚto_be_modifiedÚcommit_modifiedr±   Úcommit_deletedr©   )r,   rJ   r¼   Údelconnr9  rF  s   &&&   r   Úcommit_connectionsÚ(DirectoryServiceAgent.commit_connections'  s˜   € ð ˆà"×0Ñ0×6Ñ6Ö8‰NˆEØ×"×"Ð"Ø×$Ñ$ UÔ/à×%×%Ð%Ø×'Ñ'¨Ô2à×$×$Ò$Ø×&Ñ& uÔ1Ø—‘˜uÖ%ñ 9ó ˆEØ×"Ñ" 5Ò)ó r   c                óF   € WP                   9  g   Q hW P                   V&   R # rÑ   )rü   )r,   r9  rF  s   &&&r   Úadd_connectionÚ$DirectoryServiceAgent.add_connectionB  s"   € Ø×.Ñ.Ô.Ð.Ð.Ø$+×Ñ˜5Ó!r   c                óœ   € . pV P                   P                  4        F+  pVP                  4       V8X  g   K  VP                  V4       K-  	  V# )z®Scan DSA nTDSConnection table and return connection
with a "fromServer" dn string equivalent to method
input parameter.

:param from_dnstr: search for this from server entry
)rü   ÚvaluesÚget_from_dnstrr©   )r,   Ú
from_dnstrÚanswerrF  s   &&  r   Úget_connection_by_from_dnstrÚ2DirectoryServiceAgent.get_connection_by_from_dnstrF  sF   € ð ˆØ×)Ñ)×0Ñ0Ö2ˆGØ×%Ñ%Ó'¨:Ö5Ø—‘˜gÖ&ñ 3ð ˆr   c                óF   € RP                  R V P                   4       4      # )z1Debug dump string output of current replica tabler†   c              3   ó8   "  € T F  p\        V4      x € K  	  R # 5irÑ   ©r5   rÒ   s   & r   r#   ÚFDirectoryServiceAgent.dumpstr_current_replica_table.<locals>.<genexpr>V  s   é € Ð@Ñ)? Aœ˜QŸ˜Ó)?ùó   ‚)rˆ   rú   rS   s   &r   r  Ú3DirectoryServiceAgent.dumpstr_current_replica_tableT  s   € à�y‰yÑ@¨×)?Ò)?Ó@Ó@Ð@r   c                óF   € RP                  R V P                   4       4      # )z0Debug dump string output of needed replica tabler†   c              3   ó8   "  € T F  p\        V4      x € K  	  R # 5irÑ   r^  rÒ   s   & r   r#   ÚEDirectoryServiceAgent.dumpstr_needed_replica_table.<locals>.<genexpr>Z  s   é € Ð?Ñ)> Aœ˜QŸ˜Ó)>ùr`  )rˆ   rû   rS   s   &r   r  Ú2DirectoryServiceAgent.dumpstr_needed_replica_tableX  s   € à�y‰yÑ?¨×)>Ò)>Ó?Ó?Ð?r   c                óF   € RP                  R V P                   4       4      # )z)Debug dump string output of connect tabler†   c              3   ó8   "  € T F  p\        V4      x € K  	  R # 5irÑ   r^  rÒ   s   & r   r#   Ú>DirectoryServiceAgent.dumpstr_connect_table.<locals>.<genexpr>^  s   é € Ð<Ñ); Aœ˜QŸ˜Ó);ùr`  )rˆ   rü   rS   s   &r   r  Ú+DirectoryServiceAgent.dumpstr_connect_table\  s   € à�y‰yÑ<¨×);Ò);Ó<Ó<Ð<r   c                ój  € R\        \        P                  ! 4       4      ,          V P                  ,           p\	        V4      pRVn        RVn        WGn        Wn        W'n	        Ve#   VP                  Vn        VP                  Vn        Ve   WWn        M\        4       Vn        V P!                  Wg4       V# )z½Set up a new connection for the DSA based on input
parameters.  Connection will be added to the DSA
connect_table and will be marked as "to be added" pending
a call to commit_connections()
zCN=%s,T)r5   ÚuuidÚuuid4rj   rC  rJ  ÚenabledrX  r÷   Úsystem_flagsr9  Útransport_dnstrÚguidÚtransport_guidÚscheduleÚnew_connection_schedulerS  )r,   r÷   rn  Ú	transportrX  Úschedr9  rF  s   &&&&&&  r   Únew_connectionÚ$DirectoryServiceAgent.new_connection`  s–   € ð œ3œtŸzšz›|Ó,Õ,¨t¯~©~Õ=ˆä  Ó'ˆØ"ˆÔØˆŒØ'ÔØ!ŒØ+ÔàÒ Ø&/§o¡oˆGÔ#Ø%.§^¡^ˆGÔ"àÒØ$Õô  7Ó8ˆGÔà×Ñ˜EÔ+Øˆr   )rü   rú   rù   rø   rj   rl   rö   rõ   rô   rû   r÷   Nrð   )r   r   r   r   r-   r9   r  r   r–   rÿ   r  r  r  r   r,  r)  r<  r*  rP  rS  rZ  r  r  r  rv  r   rd   re   s   @r   rò   rò   !  sx   ø‡ € ò ò:ò.4ò2ò
òòòò=ò
ò
.*ò`Q+òf2ò0ô6*ò6,òòAò@ò=÷ð r   rò   c                   ó¢   a € ] tR tRt o RtR tR tR tR tRR lt	RR lt
RR	 ltR
 tR tR tR tR tR tR tR tR tR tR tR tRtV tR# )rC  i  z5Class defines a nTDSConnection found under a DSA
    c                óº   € Wn         R V n        RV n        ^ V n        RV n        RV n        RV n        ^ V n        ^ V n        R V n	        R V n
        R V n        R V n        R # )NF)r9  rp  rm  ÚwhenCreatedrJ  r±   rL  r÷   rn  ro  rq  rX  rr  ©r,   r9  s   &&r   r-   ÚNTDSConnection.__init__‚  sb   € ØŒ
ØˆŒ	ØˆŒØˆÔØ ˆÔØ"ˆÔØ#ˆÔØˆŒØˆÔØ#ˆÔØ"ˆÔØˆŒØˆŽr   c                ó   € V P                   P                  : RV P                  : 2RV P                  ,          ,           RV P                  ,          ,           RV P
                  ,          ,           RV P                  ,          ,           RV P                  ,          ,           RV P                  ,          ,           RV P                  ,          ,           R	V P                  ,          ,           pV P                  e$   VR
\        V P                  4      ,          ,          pV P                  e$   VR\        V P                  4      ,          ,          pVRV P                  ,          ,           pV P                  Ee   VRV P                  P                   ,          RV P                  P"                  ,          ,           RV P                  P$                  ,          ,           ,          p\'        V P                  P(                  4       F�  w  r#VRW#P*                  3,          RW#P,                  3,          ,           RV,          ,           RP/                  R V P                  P0                  V,          P2                   4       4      ,           R,           ,          pK’  	  V# )z1Debug dump string output of NTDSConnection objectú:
	dn=z
	enabled=%sz
	to_be_added=%sz
	to_be_deleted=%sz
	to_be_modified=%sz
	options=0x%08Xz
	system_flags=0x%08Xz
	whenCreated=%dz
	transport_dn=%sú	
	guid=%sú
	transport_guid=%sz
	from_dn=%sú
	schedule.size=%sú
	schedule.bandwidth=%sú
	schedule.numberOfSchedules=%sú"
	schedule.headerArray[%d].type=%dú$
	schedule.headerArray[%d].offset=%dú 
	schedule.dataArray[%d].slots[ r}   c              3   ó4   "  € T F  pR V,          x € K  	  R# 5i©z0x%X Nr   ©r    Úslots   & r   r#   Ú)NTDSConnection.__str__.<locals>.<genexpr>²  ó   é € Ð\Ñ;[°4 ¨$§¢Ó;[ùr„   Ú])r4   r   r9  rm  rJ  r±   rL  r÷   rn  rz  ro  rp  r5   rq  rX  rr  ÚsizeÚ	bandwidthÚnumberOfSchedulesÚ	enumerateÚheaderArrayÚtypeÚoffsetrˆ   Ú	dataArrayÚslots)r,   r8   ÚiÚheaders   &   r   r9   ÚNTDSConnection.__str__‘  s  € ð "&§¡×!8Ô!8¸$¿*»*ÐEØ $§,¡,Õ.õ/à# d×&6Ñ&6Õ6õ7ð &¨×(:Ñ(:Õ:õ;ð '¨×)<Ñ)<Õ<õ	=ð
 $ d§l¡lÕ2õ3ð )¨4×+<Ñ+<Õ<õ=ð $ d×&6Ñ&6Õ6õ7ð % t×';Ñ';Õ;õ<ˆð �9‰9Ò Ø�M¤C¨¯	©	£NÕ2Õ2ˆDà×ÑÒ*ØÐ+¬c°$×2EÑ2EÓ.FÕFÕFˆDàÐ&¨¯©Õ8Õ8ˆà�=‰=Ó$ØÐ*¨T¯]©]×-?Ñ-?Õ?Ø/°$·-±-×2IÑ2IÕIõJà8Ø—]‘]×4Ñ4õ5õ6õ 6ˆDô
 ' t§}¡}×'@Ñ'@ÖA‘	�ØÐ?ØŸK™KÐ(õ)àAØŸ]™]Ð+õ,õ-ð =¸qÕ@õ	Að
 Ÿ™Ñ\¸4¿=¹=×;RÑ;RÐSTÕ;U×;[Ò;[Ó\Ó\õ]ð õõ ’ñ Bð ˆr   c                óN  € . ROp VP                  V P                  \        P                  VR	7      pT^ ,          pRT9   d   \        TR,          ^ ,          4      T n        RT9   dP   \        TR,          ^ ,          4      P                  4       P                  4       P                  4       R8X  d   RT n        RT9   d   \        TR,          ^ ,          4      T n         \        P                   ! TP#                  RTR,          ^ ,          4      4      T n        RT9   dN   \)        YR,          ^ ,          P+                  R4      4      pT P-                  T\        TP.                  4      4       RT9   d.   \1        \2        P4                  TR,          ^ ,          4      T n        RT9   d3   \        P6                  ! \        TR,          ^ ,          4      4      T n        RT9   dU   \)        YR,          ^ ,          P+                  R4      4      p\        TP.                  4      T n        T P:                  f   Q hR# R#   \        P                   d2   pTP
                  w  rV\        R
T P                  : RT: R24      hRp?ii ; i  \&         d    \        RT P                  ,          4      hi ; i)z†Given a NTDSConnection object with an prior initialization
for the object's DN, search for the DN and load attributes
from the samdb.
r÷   ÚenabledConnectionrr  rz  r<   ÚtransportTypeÚ
fromServerÚsystemFlagsr>   rA  rB   r3   Nr&  Tz4Unable to find objectGUID in nTDSConnection for (%s)r0  )r÷   r›  rr  rz  r<   rœ  r�  rž  )rC   r9  rD   rE   rF   rG   r   r(  r÷   r5   ÚupperÚlstripÚrstriprm  rn  r   rH   rI   rp  ÚKeyErrorr   r3  Úload_connection_transportr¸   r   r   rr  Ústring_to_timerz  rX  )	r,   rJ   rA   rK   Úe8rM   rN   rO   r8  s	   &&       r   rD  ÚNTDSConnection.load_connection·  s5  € ò
 ˆð	/Ø—,‘, D§J¡J´c·n±nØ%*ð ó ,ˆCð �!�fˆà˜ÔÜ˜s 9�~¨aÕ0Ó1ˆDŒLà #Ô%Ü�3Ð*Õ+¨AÕ.Ó/×5Ñ5Ó7×>Ñ>Ó@×GÑGÓIÈVÔSØ#�”à˜CÔÜ # C¨Õ$6°qÕ$9Ó :ˆDÔð	6ä—	’	˜%×3Ñ3°LØ47¸Õ4EÀaÕ4HóJó Kð ŒIð ˜cÔ!Ü˜5 oÕ"6°qÕ"9×"@Ñ"@ÀÓ"HÓIˆDØ×*Ñ*¨5´#°d·g±g³,Ô?à˜ÔÜ&¤x×'8Ñ'8¸#¸j½/È!Õ:LÓMˆDŒMà˜CÔÜ"×1Ò1´#°c¸-Õ6HÈÕ6KÓ2LÓMˆDÔà˜3ÔÜ˜5 lÕ"3°AÕ"6×"=Ñ"=¸fÓ"EÓFˆDÜ! $§'¡'›lˆDŒOØ—?‘?Ò.Ð.Ò.ñ øôG �|‰|ô 	/ØŸ7™7‰LˆTÝØ ŸJœJ«ð.ó /ð /ûð	/ûô* ô 	6Üð &Ø)-¯©õ5ó 6ð 6ð	6ús#   †,H3 Ã9I< È3I9É,I4É4I9É<(J$c                ó¼  € R.p VP                  V\        P                  VR7      pRT^ ,          9   dI   T^ ,          pY n        \        P                  ! TP                  RTR,          ^ ,          4      4      T n
        T P                  f   Q hT P                  f   Q hR#   \        P                   d(   pTP                  w  rg\        RT: RT: R24      hRp?ii ; i)z�Given a NTDSConnection object which enumerates a transport
DN, load the transport information for the connection object

:param tdnstr: transport DN to load
r<   r>   zUnable to find transport (rB   r3   N)rC   rD   rE   rF   rG   r   ro  r   rH   rI   rq  )	r,   rJ   ÚtdnstrrA   rK   Úe9rM   rN   rO   s	   &&&      r   r£  Ú(NTDSConnection.load_connection_transportð  sÜ   € ð �ˆð	+Ø—,‘, FÜ%(§^¡^¸5ð ó BˆCð ˜3˜q�6Ô!Ø�a•&ˆCØ#)Ô ä—	’	˜%×3Ñ3°LØ47¸Õ4EÀaÕ4HóJó Kð Ôð ×#Ñ#Ò/Ð/Ð/Ø×"Ñ"Ò.Ð.Ò.øô �|‰|ô 	+ØŸ7™7‰LˆTÝÛ"£Dð*ó +ð +ûð	+ús   …"B ÂCÂ4"CÃCc                ó  € V P                   '       g   Q hRV n         V'       d   R#  VP                  V P                  4       R#   \        P                   d2   pTP
                  w  rE\        RT P                  : RT: R24      hRp?ii ; i)z„Local helper routine for commit_connections() which
handles committed connections that are to be deleted from
the database database
FNz%Could not delete nTDSConnection for (rB   r3   )r±   Údeleter9  rD   rF   rG   r   )r,   rJ   r¼   Úe10rM   rN   s   &&&   r   rN  ÚNTDSConnection.commit_deleted	  su   € ð
 ×!×!Ð!Ð!Ð!Ø"ˆÔ÷ Ùð	/Ø�L‰L˜Ÿ™Ö$øÜ�|‰|ô 	/ØŸ8™8‰LˆTÝØ ŸJœJ«ð.ó /ð /ûð	/ús   §A ÁB
Á,BÂB
c                ó¬  € V P                   '       g   Q hRV n         V'       d   R# Rp VP                  V P                  \        P                  R7      p\        V4      ^ 8w  d   RpT'       d   \        RT P                  ,          4      hT P                  '       d   R	pMR
p\        P                  ! 4       p	\        P                  ! YP                  4      T	n        \        P                  ! R\        P                  R4      T	R&   \        P                  ! R	\        P                  R4      T	R&   \        P                  ! T\        P                  R4      T	R&   \        P                  ! T P                   \        P                  R4      T	R&   \        P                  ! \#        T P$                  4      \        P                  R4      T	R&   \        P                  ! \#        T P&                  4      \        P                  R4      T	R&   T P(                  e=   \        P                  ! \#        T P(                  4      \        P                  R4      T	R&   T P*                  e=   \        P                  ! \-        T P*                  4      \        P                  R4      T	R&    TP/                  T	4       R#   \        P                   dM   pTP                  w  rgT\        P                  8w  d   \        RT P                  : RT: R24      h Rp?ELŸRp?ii ; i  \        P                   d2   p
T
P                  w  rg\        RT P                  : RT: R24      hRp
?
ii ; i)zwLocal helper routine for commit_connections() which
handles committed connections that are to be added to the
database
FN©r?   r@   TúUnable to search for (rB   r3   z'nTDSConnection for (%s) already exists!r&  ÚFALSEÚnTDSConnectionÚobjectClassÚshowInAdvancedViewOnlyr›  r�  r÷   rž  rœ  rr  z"Could not add nTDSConnection for ()rJ  rC   r9  rD   rE   r1  rF   rG   ÚERR_NO_SUCH_OBJECTr   rm  r¶   r·   r¸   r¹   ÚFLAG_MOD_ADDrX  r5   r÷   rn  ro  rr  r	   Úadd)r,   rJ   r¼   ÚfoundrO   Úe11rM   rN   Ú	enablestrr¿   Úe12s   &&&        r   rK  ÚNTDSConnection.commit_added  sÄ  € ð
 ××ÐÐÐØ ˆÔ÷ Ùð ˆð		3Ø—,‘, D§J¡J´c·n±n�,ÓEˆCÜ�3‹x˜1Œ}Ø�÷ ÜÐDØŸ:™:õ&ó 'ð 'ð �<�<ˆ<Ø‰IàˆIô �KŠK‹MˆÜ�vŠv�eŸZ™ZÓ(ˆŒô ×ÒÐ/´×1AÑ1AØ,ó.ð 	
ˆ-Ñô ×Ò˜v¤s×'7Ñ'7Ø7ó9ð 	
Ð
"Ñ#ô ×Ò˜y¬#×*:Ñ*:Ø2ó4ð 	
Ð
Ñô ×Ò˜tŸ™´×0@Ñ0@À,ÓOð 	
ˆ,‰ô ×Òœs 4§<¡<Ó0´#×2BÑ2BÀIÓNð 	
ˆ)‰ô ×Òœs 4×#4Ñ#4Ó5´s×7GÑ7GØ,ó.ð 	
ˆ-Ñð ×ÑÒ+ä×"Ò"¤3 t×';Ñ';Ó#<¼c×>NÑ>NØ#2ó4ð ˆoÑð �=‰=Ò$ä×"Ò"¤8¨D¯M©MÓ#:Ü#&×#3Ñ#3°ZóAð ˆj‰Mð	/Ø�I‰I�aŽLøô[ �|‰|ô 	3ØŸ8™8‰LˆTØ”s×-Ñ-Ô-ÝØ $§
¤
«Dð 2ó 3ð 3õ .ûð	3ûô\ �|‰|ô 	/ØŸ8™8‰LˆTÝØ ŸJœJ«ð.ó /ð /ûð	/ús0   ©=J) ÊL Ê)L
Ê>ALÌL
ÌMÌ",MÍMc                ól  € V P                   '       g   Q hRV n         V'       d   R#  VP                  V P                  \        P                  R7       T P                  '       d   RpMR	p\        P                  ! 4       p\        P                  ! YP                  4      Tn        \        P                  ! T\        P                  R
4      TR
&   \        P                  ! T P                  \        P                  R4      TR&   \        P                  ! \!        T P"                  4      \        P                  R4      TR&   \        P                  ! \!        T P$                  4      \        P                  R4      TR&   T P&                  e>   \        P                  ! \!        T P&                  4      \        P                  R4      TR&   M)\        P                  ! . \        P(                  R4      TR&   T P*                  e>   \        P                  ! \-        T P*                  4      \        P                  R4      TR&   M)\        P                  ! . \        P(                  R4      TR&    TP/                  T4       R#   \        P
                   dc   pTP                  w  rET\        P                  8X  d   \        RT P                  ,          4      h\        RT P                  : RT: R24      hRp?ii ; i  \        P
                   d2   pTP                  w  rE\        RT P                  : RT: R24      hRp?ii ; i)zzLocal helper routine for commit_connections() which
handles committed connections that are to be modified to the
database
FNr°  z&nTDSConnection for (%s) doesn't exist!r±  rB   r3   r&  r²  r›  r�  r÷   rž  rœ  rr  z%Could not modify nTDSConnection for ()rL  rC   r9  rD   rE   rF   rG   r¶  r   rm  r¶   r·   r¸   r¹   rº   rX  r5   r÷   rn  ro  ÚFLAG_MOD_DELETErr  r	   r»   )	r,   rJ   r¼   Úe13rM   rN   r»  r¿   Úe14s	   &&&      r   rM  ÚNTDSConnection.commit_modifiedc  s¡  € ð
 ×"×"Ð"Ð"Ð"Ø#ˆÔ÷ Ùð	/ð �L‰L˜dŸj™j´·±ˆLÔ?ð �<�<ˆ<Ø‰IàˆIô �KŠK‹MˆÜ�vŠv�eŸZ™ZÓ(ˆŒô ×Ò˜y¬#×*>Ñ*>Ø2ó4ð 	
Ð
Ñô ×Ò˜tŸ™´×0DÑ0DØ+ó-ð 	
ˆ,‰ô ×Òœs 4§<¡<Ó0´#×2FÑ2FØ(ó*ð 	
ˆ)‰ô ×Òœs 4×#4Ñ#4Ó5´s×7KÑ7KØ,ó.ð 	
ˆ-Ñð ×ÑÒ+ä×"Ò"¤3 t×';Ñ';Ó#<Ü#&×#7Ñ#7¸óJð ˆoÒô
 ×"Ò" 2¤s×':Ñ':¸OÓLð ˆoÑð �=‰=Ò$ä×"Ò"¤8¨D¯M©MÓ#:Ü#&×#7Ñ#7¸óEð ˆjŠMô
 ×"Ò" 2¤s×':Ñ':¸JÓGð ˆj‰Mð	/Ø�L‰L˜ŽOøô] �|‰|ô 	/ØŸ8™8‰LˆTØ”s×-Ñ-Ô-ÜÐGØ#Ÿz™zõ *ó +ð +åØ ŸJœJ«ð.ó /ð /ûð	/ûô^ �|‰|ô 	/ØŸ8™8‰LˆTÝØ ŸJœJ«ð.ó /ð /ûð	/ús0   §+I3 É K- É3K*ÊAK%Ë%K*Ë-L3Ì,L.Ì.L3c                ó   € Wn         R # rÑ   )rL  )r,   Ú	truefalses   &&r   Úset_modifiedÚNTDSConnection.set_modifiedª  s   € Ø'Ör   c                óâ   € V P                   e    V P                   P                  ^ ,          f   R# V P                   P                  ^ ,          P                   F  pV^,          ^ 8w  g   K   R# 	  R# )zjReturns True if our schedule includes at least one
replication interval within the week.  False otherwise
FT)rr  r•  r–  )r,   rŠ  s   & r   Ú!is_schedule_minimum_once_per_weekÚ0NTDSConnection.is_schedule_minimum_once_per_week­  sX   € ð �=‰=Ò  D§M¡M×$;Ñ$;¸AÕ$>Ò$FÙà—M‘M×+Ñ+¨AÕ.×4Ô4ˆDØ�t• Ö#Úñ 5ñ r   c                óN  € V P                   f   VRJ # Vf   R# V P                   P                  VP                  8w  gK   V P                   P                  VP                  8w  g&   V P                   P                  VP                  8w  d   R# \	        V P                   P
                  4       Fø  w  r#V P                   P
                  V,          P                  VP
                  V,          P                  8w  d    R# V P                   P
                  V,          P                  VP
                  V,          P                  8w  d    R# \        V P                   P                  V,          P                  VP                  V,          P                  4       F  w  rEWE8w  g   K    R# 	  Kú  	  R# )zrReturns True if our schedule is equivalent to the input
comparison schedule.

:param shed: schedule to compare to
NFT)rr  rŽ  r�  r�  r‘  r’  r“  r”  Úzipr•  r–  )r,   ru  r—  r˜  ÚaÚbs   &&    r   Úis_equivalent_scheduleÚ%NTDSConnection.is_equivalent_schedule»  s.  € ð �=‰=Ò Ø˜D�=Ð àŠ=Ùà�]‰]×Ñ 5§:¡:Ô-Ø�]‰]×$Ñ$¨¯©Ô7Ø�]‰]×,Ñ,°×0GÑ0GÔGÙä" 4§=¡=×#<Ñ#<Ö=‰IˆAà�}‰}×(Ñ(¨Õ+×0Ñ0°E×4EÑ4EÀaÕ4H×4MÑ4MÔMÚà�}‰}×(Ñ(¨Õ+×2Ñ2Ø× Ñ  Õ#×*Ñ*ô+âä˜DŸM™M×3Ñ3°AÕ6×<Ñ<Ø!ŸO™O¨AÕ.×4Ñ4ö6‘�à–6Û ó6ñ >ñ r   c                óV   € V P                   \        P                  ,          ^ 8X  d   R# R# )z=Returns True if NTDS Connection specifies RODC
topology only
FT)r÷   r   ÚNTDSCONN_OPT_RODC_TOPOLOGYrS   s   &r   Úis_rodc_topologyÚNTDSConnection.is_rodc_topologyã  s!   € ð �<‰<œ$×9Ñ9Õ9¸QÔ>ÙÙr   c                óV   € V P                   \        P                  ,          ^ 8X  d   R# R# )zsReturns True if NTDS Connection was generated by the
KCC topology algorithm as opposed to set by the administrator
FT)r÷   r   ÚNTDSCONN_OPT_IS_GENERATEDrS   s   &r   Úis_generatedÚNTDSConnection.is_generatedë  s!   € ð �<‰<œ$×8Ñ8Õ8¸AÔ=ÙÙr   c                óV   € V P                   \        P                  ,          ^ 8X  d   R# R# )zGReturns True if NTDS Connection should override notify default
        FT)r÷   r   Ú$NTDSCONN_OPT_OVERRIDE_NOTIFY_DEFAULTrS   s   &r   Úis_override_notify_defaultÚ)NTDSConnection.is_override_notify_defaultó  s!   € ð �<‰<œ$×CÑCÕCÀqÔHÙÙr   c                óV   € V P                   \        P                  ,          ^ 8X  d   R# R# )z:Returns True if NTDS Connection should use notify
        FT)r÷   r   ÚNTDSCONN_OPT_USE_NOTIFYrS   s   &r   Úis_use_notifyÚNTDSConnection.is_use_notifyú  s!   € ð �<‰<œ$×6Ñ6Õ6¸!Ô;ÙÙr   c                óV   € V P                   \        P                  ,          ^ 8X  d   R# R# )z?Returns True if NTDS Connection should use twoway sync
        FT)r÷   r   ÚNTDSCONN_OPT_TWOWAY_SYNCrS   s   &r   Úis_twoway_syncÚNTDSConnection.is_twoway_sync  s!   € ð �<‰<œ$×7Ñ7Õ7¸1Ô<ÙÙr   c                óV   € V P                   \        P                  ,          ^ 8X  d   R# R# )zBReturns True if NTDS Connection intersite compression
is disabled
FT)r÷   r   Ú*NTDSCONN_OPT_DISABLE_INTERSITE_COMPRESSIONrS   s   &r   Ú!is_intersite_compression_disabledÚ0NTDSConnection.is_intersite_compression_disabled  s!   € ð �<‰<œ$×IÑIÕIÈQÔNÙÙr   c                óV   € V P                   \        P                  ,          ^ 8X  d   R# R# )zBReturns True if NTDS Connection has a user owned schedule
        FT)r÷   r   Ú NTDSCONN_OPT_USER_OWNED_SCHEDULErS   s   &r   Úis_user_owned_scheduleÚ%NTDSConnection.is_user_owned_schedule  s!   € ð �<‰<œ$×?Ñ?Õ?À1ÔDÙÙr   c                ó   € V P                   # )z3Returns True if NTDS Connection is enabled
        )rm  rS   s   &r   Ú
is_enabledÚNTDSConnection.is_enabled  s   € ð �|‰|Ðr   c                ó   € V P                   # )z%Return fromServer dn string attribute)rX  rS   s   &r   rW  ÚNTDSConnection.get_from_dnstr  s   € à�‰Ðr   )r9  rm  rX  rp  r÷   rr  rn  rJ  r±   rL  ro  rq  rz  Nrð   )r   r   r   r   rc   r-   r9   rD  r£  rN  rK  rM  rÅ  rÈ  rÎ  rÒ  rÖ  rÚ  rÞ  râ  ræ  rê  rí  rW  r   rd   re   s   @r   rC  rC    su   ø‡ € ñòò$òL7/òr/ô2/ô&E/ôNE/òN(òò&òPòòòòòòò÷
ð r   rC  c                   óH   a € ] tR tRt o RtR tR tR tR tR t	R t
R	tV tR
# )Ú	Partitioni!  a  A naming context discovered thru Partitions DN of the config schema.

This is a more specific form of NamingContext class (inheriting from that
class) and it identifies unique attributes enumerated in the Partitions
such as which nTDSDSAs are cross referenced for replicas
c                óv   € Wn         R V n        ^ V n        . V n        . V n        \
        P                  V R4       R# )TN)Úpartstrrm  rn  Úrw_location_listÚro_location_listr%   r-   )r,   rô  s   &&r   r-   ÚPartition.__init__(  s8   € ØŒØˆŒØˆÔØ "ˆÔØ "ˆÔô
 	×Ñ˜t TÖ*r   c                ó¦  € . ROp VP                  V P                  \        P                  VR7      pT^ ,          pTP                  4        EF'  pTR8X  d   K  TR8X  dY   \        Yx,          ^ ,          4      P                  4       P                  4       P                  4       R8X  d	   RT n        MRT n        Kl  TR8X  d    \        Yx,          ^ ,          4      T n        K’  Yx,           F‰  p	\        YP!                  R4      4      p
\        T
P"                  4      pTR8X  d	   Y°n        KA  TR8X  d   T P&                  P)                  T4       Ke  TR8X  g   Kn  T P*                  P)                  T4       K‹  	  EK*  	  T P-                  T4       R
#   \        P                   d2   pTP
                  w  rV\        RT P                  : RT: R	24      hR
p?ii ; i)aw  Given a Partition class object that has been initialized with its
partition dn string, load the partition from the sam database, identify
the type of the partition (schema, domain, etc) and record the list of
nTDSDSAs that appear in the cross reference attributes
msDS-NC-Replica-Locations and msDS-NC-RO-Replica-Locations.

:param samdb: sam database to load partition from
ÚnCNameÚEnabledrž  úmsDS-NC-Replica-LocationsúmsDS-NC-RO-Replica-Locationsr>   zUnable to find partition for (rB   r3   Nr¸   r&  TFr0  )rù  rú  rž  rû  rü  )rC   rô  rD   rE   rF   rG   r   r2  r5   rŸ  r   r¡  rm  r(  rn  r   r3  r¸   r'   rõ  r©   rö  rY   )r,   rJ   rA   rK   Úe15rM   rN   rO   r!   r«   r8  r9  s   &&          r   Úload_partitionÚPartition.load_partition4  s‚  € ò1ˆð
	1Ø—,‘, D§L¡L¼¿¹Ø%*ð ó ,ˆCð �!�fˆØ—‘—ˆAØ�DŒyÙà�IŒ~Ü�s•v˜a•y“>×'Ñ'Ó)×0Ñ0Ó2×9Ñ9Ó;¸vÔEØ#'�D•Là#(�D”LÙà�MÔ!Ü$'¨­¨q­	£N�Ô!ÙàŸ˜�Ü˜u§l¡l°6Ó&:Ó;�Ü˜DŸG™G›�à˜”=Ø$)”MÙàÐ3Ô3Ø×)Ñ)×0Ñ0°Ô7ÙàÐ6Ö6Ø×)Ñ)×0Ñ0°Ô7Ùô  ñ ðB 	×Ñ Ö&øôM �|‰|ô 	1ØŸ8™8‰LˆTÝØ ŸLœL«$ð0ó 1ð 1ûð	1ús   †,F
 Æ
GÆ,GÇGc                ó   € V P                   # )z-Returns True if partition is enabled
        )rí  rS   s   &r   rí  ÚPartition.is_enabledn  s   € ð �‰Ðr   c                óV   € V P                   \        P                  ,          ^ 8X  d   R# R# )zsReturns True if this is not an Active Directory NC in our
forest but is instead something else (e.g. a foreign NC)
TF)rn  r   ÚSYSTEM_FLAG_CR_NTDS_NCrS   s   &r   Ú
is_foreignÚPartition.is_foreigns  s#   € ð ×Ñ¤× ;Ñ ;Õ;ÀÔAÙár   c                óf  € RpRpV P                   \        P                  8H  ;'       gd    V P                   \        P                  8H  ;'       g?    V P                   \        P                  8H  ;'       d    V P
                  VP                  8H  pV P                   \        P                  8X  dR   VP                  4       '       d   VP                  V P                  9   d   RpMVP                  V P                  9   d   RpVP                  4       '       du   V P                   \        P                  8X  dV   V P
                  VP                  8w  d;   VP                  V P                  9   g   VP                  V P                  9   d   RpRpV'       d!   VP                  4       '       g	   V'       d   RpWBV3# )zÖTests whether this partition should have an NC replica
on the target dsa.  This method returns a tuple of
needed=True/False, ro=True/False, partial=True/False

:param target_dsa: should NC be present on target dsa
FT)r*   r   r   r   r   r'   rù   r   r–   rj   rö  rõ  rÿ   )r,   Ú
target_dsar¼   ÚpartialÚneededs   &&   r   Úshould_be_presentÚPartition.should_be_present|  sU  € ð ˆØˆð
 —,‘,¤&§-¡-Ñ/÷ >ð >Ø—,‘,¤&§-¡-Ñ/÷>ð >à—<‘<¤6§=¡=Ñ0÷ =ð =Ø—=‘= J×$<Ñ$<Ñ<ð 	ð �<‰<œ6×-Ñ-Ô-Ø×Ñ×!Ò!Ø×'Ñ'¨4×+@Ñ+@Ô@Ø!�Føà×'Ñ'¨4×+@Ñ+@Ô@Ø!�Fð
 ×Ñ×ÒØ�L‰LœFŸM™MÔ)Ø�M‰M˜Z×5Ñ5Ô5Ø×!Ñ! T×%:Ñ%:Ô:Ø×!Ñ! T×%:Ñ%:Ô:ØˆFØˆG÷ �z×'Ñ'×)Ò)¯WØˆBà˜7Ð"Ð"r   c                ó
  € R\         P                  V 4      ,          RV P                  ,          ,           RP                  R V P                   4       4      ,           RP                  R V P
                   4       4      ,           pV# )r0   z%sz
	partdn=%sr}   c              3   ó4   "  € T F  pR V,          x € K  	  R# 5i)z
	msDS-NC-Replica-Locations=%sNr   ©r    r!   s   & r   r#   Ú$Partition.__str__.<locals>.<genexpr>°  s   é € Ð]ÑG\À!Ð9¸A×=Ò=ÓG\ùr„   c              3   ó4   "  € T F  pR V,          x € K  	  R# 5i)z!
	msDS-NC-RO-Replica-Locations=%sNr   r  s   & r   r#   r  ±  s   é € Ð`ÑJ_ÀQÐ<¸q×@Ò@ÓJ_ùr„   )r%   r9   rô  rˆ   rõ  rö  r7   s   & r   r9   ÚPartition.__str__¬  sm   € à”m×+Ñ+¨DÓ1Õ1Ø §¡Õ-õ.à�w‰wÑ]Àt×G\ÒG\Ó]Ó]õ^ð �w‰wÑ`È$×J_ÒJ_Ó`Ó`õaˆð ˆr   )rm  r'   rô  rö  rõ  rn  N)r   r   r   r   rc   r-   rþ  rí  r  r
  r9   r   rd   re   s   @r   rò  rò  !  s/   ø‡ € ñò
+ò8'òtò
ò.#÷`ð r   rò  c                   ór   a € ] tR tRt o RtR tR tR tR tR t	R t
R	 tR
 tR tR tR tR tR tRtV tR# )ÚSiteiµ  zzAn individual site object discovered thru the configuration
naming context.  Contains all DSAs that exist within the site
c                ór   € Wn         R V n        ^ V n        R V n        ^ V n        / V n        / V n        W n        R # rÑ   )Ú
site_dnstrÚ	site_guidÚsite_optionsÚsite_topo_generatorÚsite_topo_failoverÚ	dsa_tableÚrw_dsa_tableÚnt_now)r,   r  r  s   &&&r   r-   ÚSite.__init__¹  s:   € Ø$ŒØˆŒØˆÔØ#'ˆÔ Ø"#ˆÔØˆŒØˆÔØŽr   c                óö  € RV P                   ,          p. ROp VP                  V\        P                  VR7      pVP                  V P                   \        P                  R.R7      pT^ ,          p	RT	9   d   \        T	R,          ^ ,          4      T n        RT	9   d   \        T	R,          ^ ,          4      T n
        RT	9   d   \        T	R,          ^ ,          4      T n        T^ ,          p	RT	9   d:   \        P                  ! TP                  RT	R,          ^ ,          4      4      T n        T P!                  T4       R
#   \        P                   d(   pTP
                  w  rx\        RT: RT: R	24      hR
p?ii ; i)z‚Loads the NTDS Site Settings options attribute for the site
as well as querying and loading all DSAs that appear within
the site.
úCN=NTDS Site Settings,%sr÷   ÚinterSiteTopologyFailoverÚinterSiteTopologyGeneratorr>   r<   z"Unable to find site settings for (rB   r3   N)r÷   r   r!  )r  rC   rD   rE   rF   rG   r   r(  r  r5   r  r  r   rH   rI   r  Úload_all_dsa)
r,   rJ   ÚssdnrA   rK   Úself_resÚe16rM   rN   rO   s
   &&        r   Ú	load_siteÚSite.load_siteÃ  sS  € ð
 *¨D¯O©OÕ;ˆò/ˆð	)Ø—,‘, D´·±Ø%*ð ó ,ˆCà—|‘|¨¯©ÄÇÁØ+7¨.ð $ó :ˆHð �!�fˆØ˜ÔÜ # C¨	¥N°1Õ$5Ó 6ˆDÔà'¨3Ô.ä�CÐ4Õ5°aÕ8Ó9ð Ô$ð '¨#Ô-Ü&)¨#Ð.IÕ*JÈ1Õ*MÓ&NˆDÔ#à�q�kˆØ˜3ÔÜ!ŸYšY u×'@Ñ'@ÀØ'*¨<Õ'8¸Õ';ó(=ó >ˆDŒNð 	×Ñ˜%Ö øô+ �|‰|ô 	)ØŸ8™8‰LˆTÝÛ £$ð(ó )ð )ûð	)ús   ™AD< Ä<E8Å"E3Å3E8c                óÚ  €  VP                  V P                  \        P                  RR7      pT Fz  p\        TP                  4      pYpP                  9   d   K*  \        T4      pTP                  T4       Y€P                  T&   TP                  4       '       d   Kl  Y€P                  T&   K|  	  R#   \        P                   d&   pTP
                  w  rE\        RT,          4      hRp?ii ; i)z„Discover all nTDSDSA thru the sites entry and
instantiate and load the DSAs.  Each dsa is inserted
into the dsa_table by dn string.
z(objectClass=nTDSDSA))r@   r@  zUnable to find nTDSDSAs - (%s)N)rC   r  rD   rB  rF   rG   r   r5   r¸   r  rò   r,  r–   r  )	r,   rJ   rK   Úe17rM   rN   rO   r9  rv   s	   &&       r   r"  ÚSite.load_all_dsaè  sÇ   € ð
	DØ—,‘,˜tŸ™Ü%(×%6Ñ%6Ø*Að ó CˆCó ˆCÜ˜Ÿ™“KˆEð Ÿ™Ô&Ùä'¨Ó.ˆCà�L‰L˜Ôð %(�N‰N˜5Ñ!Ø—9‘9—;”;Ø+.×!Ñ! %Ó(ó øô	 �|‰|ô 	DØŸ8™8‰LˆTÜÐ;¸dÕBÓCÐCûð	Dús   ‚,B0 Â0C*Ã C%Ã%C*c                ó8   € V P                   P                  V4      # )z‹Return a previously loaded DSA object by consulting
the sites dsa_table for the provided DSA dn string

:return: None if DSA doesn't exist
)r  r  r{  s   &&r   Úget_dsaÚSite.get_dsa  s   € ð �~‰~×!Ñ! %Ó(Ð(r   c                ót  € VP                   '       d   RVn        VP                  V n        R# \	        V4      pVP                  V4       VP                  V4       \        V P                  P                  4       R R7      pV P                  ^ 8X  d   RpMV P                  ^<,          R,          pV P                  P                  V P                  4      pVeŽ   WrJd‰   VP                  V4      pRp	VP                   F"  p
VP                  V
P                   8X  g   K   Rp	 M	  V	'       g   Tp^ pMSV P"                  X
P$                  ,
          V8”  d   ^ p^ pM,TpV
P$                  pMVP                  V4      pV P"                  pW°P"                  V,
          V,          ,           \'        V4      ,          pW],          pRVn        WrJd   R# V P                  VP                  8X  d   R# VP                  V n        V'       d   R# RV P(                  ,          p\*        P,                  ! 4       p\*        P.                  ! W4      Vn        \*        P2                  ! VP                  \*        P4                  R4      VR&    VP7                  V4       R#   \*        P8                   d   p\;        R	T: R
T: R24      hRp?ii ; i)a<  Determine if my DC should be an intersite topology
generator.  If my DC is the istg and is both a writeable
DC and the database is opened in write mode then we perform
an originating update to set the interSiteTopologyGenerator
attribute in the NTDS Site Settings object.  An RODC always
acts as an ISTG for itself.
Tc                 ó,   € \        V P                  4      # rÑ   )r	   rl   )rv   s   &r   Ú<lambda>Ú"Site.select_istg.<locals>.<lambda>5  s   € œH S§\¡\Ô2r   )Úkeyi€–˜ NFr  r!  z.Could not set interSiteTopologyGenerator for (rB   r3   l    PC )rõ   rö   rj   r  Úget_dsa_config_repr­   rÍ   Úsortedr  rV  r  r  r  ÚindexrÊ   rô   Úsource_dsa_invocation_idr  Úlast_sync_successr1  r  rD   r¶   r·   r¸   r¹   rº   r»   rF   r   )r,   rJ   Úmydsar¼   Úc_repÚD_sortÚfÚd_dsaÚj_idxr¹  ÚcursorÚi_idxÚt_timeÚk_idxr#  r¿   rN   s   &&&&             r   Úselect_istgÚSite.select_istg  s[  € ð �?�?ˆ?Ø $ˆEÔØ',§¡ˆDÔ$Ùä" 5Ó)ˆð
 	×Ñ˜EÔ"à×%Ñ% eÔ,ô  Ø×Ñ×$Ñ$Ó&Ù2ô4ˆð$ ×"Ñ" aÔ'Ø&‰Aà×'Ñ'¨"Õ,¨xÕ7ˆAð —‘×"Ñ" 4×#;Ñ#;Ó<ˆð Ò Ó!3ð( —L‘L Ó'ˆEàˆEØ×>Ô>�Ø—>‘> V×%DÑ%DÖDØ �EÙñ ?÷
 Ø�Ø‘ð
 —‘˜v×7Ñ7Õ7¸!Ô;Ø�Ø‘à�Ø×1Ñ1‘ð —L‘L Ó'ˆEØ—[‘[ˆFð Ÿ;™;¨Õ/°AÕ5Õ6¼#¸f»+ÕEˆð •ˆØ ˆÔð ÓÙð ×#Ñ# u§¡Ô6Ùà#(§?¡?ˆÔ ÷ Ùð *¨D¯O©OÕ;ˆä�KŠK‹MˆÜ�vŠv�eÓ"ˆŒô ×Ò˜uŸ™´×0DÑ0DØ;ó=ð 	
Ð
&Ñ'ð	Ø�L‰L˜ŒOñ øô	 �|‰|ô 	Ýã“tðóð ûð	ús   É6J	 Ê	J7ÊJ2Ê2J7c                óJ   € V P                   \        P                  ,          ^ 8g  # )z8Returns True if intra-site topology is disabled for site)r  r   Ú-DS_NTDSSETTINGS_OPT_IS_AUTO_TOPOLOGY_DISABLEDrS   s   &r   Úis_intrasite_topology_disabledÚ#Site.is_intrasite_topology_disabled·  s)   € à×!Ñ!Ü×BÑBõCØGHñIð 	Ir   c                óJ   € V P                   \        P                  ,          ^ 8g  # )z8Returns True if inter-site topology is disabled for site)r  r   Ú8DS_NTDSSETTINGS_OPT_IS_INTER_SITE_AUTO_TOPOLOGY_DISABLEDrS   s   &r   Úis_intersite_topology_disabledÚ#Site.is_intersite_topology_disabled¼  s'   € à×"Ñ"Ü×NÑNõOàñð 	r   c                óJ   € V P                   \        P                  ,          ^ 8g  # )z:Returns True if selection of random bridgehead is disabled)r  r   Ú1DS_NTDSSETTINGS_OPT_IS_RAND_BH_SELECTION_DISABLEDrS   s   &r   Úis_random_bridgehead_disabledÚ"Site.is_random_bridgehead_disabledÂ  ó)   € à×!Ñ!Ü×FÑFõGØKLñMð 	Mr   c                óJ   € V P                   \        P                  ,          ^ 8g  # )z1Returns True if detect stale is disabled for site)r  r   Ú1DS_NTDSSETTINGS_OPT_IS_TOPL_DETECT_STALE_DISABLEDrS   s   &r   Úis_detect_stale_disabledÚSite.is_detect_stale_disabledÇ  rP  r   c                óJ   € V P                   \        P                  ,          ^ 8g  # )z<Returns True if NTDS Connection cleanup is disabled for site)r  r   Ú,DS_NTDSSETTINGS_OPT_IS_TOPL_CLEANUP_DISABLEDrS   s   &r   Úis_cleanup_ntdsconn_disabledÚ!Site.is_cleanup_ntdsconn_disabledÌ  s)   € à×!Ñ!Ü×AÑAõBØFGñHð 	Hr   c                óL   € V P                  VP                  4      '       d   R# R# )z"Return True if dsa is in this siteTF)r,  rj   )r,   rv   s   &&r   Ú	same_siteÚSite.same_siteÑ  s   € à�<‰<˜Ÿ™×&Ò&ÙÙr   c                ór   € \        V P                  4      ^ 8”  d   \        V P                  4      ^ 8X  d   R# R# )r   TF)r1  r  r  rS   s   &r   Úis_rodc_siteÚSite.is_rodc_site×  s+   € Üˆt�~‰~Ó Ô"¤s¨4×+<Ñ+<Ó'=ÀÔ'BÙÙr   c                óf  € RV P                   P                  ,          RV P                  ,          ,           RV P                  ,          ,           RV P                  ,          ,           RV P
                  ,          ,           pV P                  P                  4        F  w  r#VRV,          ,           pK  	  V# )r0   ry   z
	dn=%sz
	options=0x%Xz
	topo_generator=%sz
	topo_failover=%dr€   )r4   r   r  r  r  r  r  rI  )r,   r8   r2  rv   s   &   r   r9   ÚSite.__str__Ü  s”   € à�t—~‘~×.Ñ.Õ.Ø˜TŸ_™_Õ,õ-à! D×$5Ñ$5Õ5õ6ð '¨×)AÑ)AÕAõBð &¨×(?Ñ(?Õ?õ	@ˆð
 Ÿ™×,Ñ,Ö.‰HˆCØ˜& 3�,Õ&ŠDñ /àˆr   )r  r  r  r  r  r  r  r  N)r   r   r   r   rc   r-   r&  r"  r,  rB  rF  rJ  rN  rS  rW  rZ  r]  r9   r   rd   re   s   @r   r  r  µ  sW   ø‡ € ñòò#!òJ/ò<)ògòRIò
òMò
Mò
Hò
ò÷
	ð 	r   r  c                   óH   a € ] tR tRt o RtR tR tR tR tR t	R t
R	tV tR
# )Ú	GraphNodeiè  zÀA graph node describing a set of edges that should be directed to it.

Each edge is a connection for a particular naming context replica directed
from another node in the forest to this node.
c                ó,   € W n         Wn        . V n        R# )z•Instantiate the graph node according to a DSA dn string

:param max_node_edges: maximum number of edges that should ever
    be directed to the node
N)Ú	max_edgesrj   Ú	edge_from)r,   rj   Úmax_node_edgess   &&&r   r-   ÚGraphNode.__init__ï  s   € ð (ŒØ"ŒØˆŽr   c                ó.  € R V P                   P                  ,          RV P                  ,          ,           RV P                  ,          ,           p\	        V P
                  4       F.  w  r#\        V\        4      '       g   K  VRW#3,          ,          pK0  	  V# )ry   rz   z
	max_edges=%dz
	edge_from[%d]=%s)r4   r   rj   rd  r‘  re  Ú
isinstancer5   )r,   r8   r—  Úedges   &   r   r9   ÚGraphNode.__str__ù  su   € Ø�t—~‘~×.Ñ.Õ.Ø! D§N¡NÕ2õ3à! D§N¡NÕ2õ3ˆô ! §¡Ö0‰GˆAÜ˜$¤×$Ô$ØÐ.°!°Õ:Õ:’ñ 1ð ˆr   c                ó   € \        V\        4      '       g   Q hWP                  8X  d   R# WP                  9   d   R# \	        V P                  4      V P
                  8¼  d   R# V P                  P                  V4       R# )zwAdd an edge from the dsa to our graph nodes edge from list

:param from_dsa_dnstr: the dsa that the edge emanates from
FT)ri  r5   rj   re  r1  rd  r©   )r,   Úfrom_dsa_dnstrs   &&r   Úadd_edge_fromÚGraphNode.add_edge_from  s`   € ô
 ˜.¬#×.Ò.Ð.Ð.ð Ÿ^™^Ô+ÙàŸ^™^Ô+Ùäˆt�~‰~Ó $§.¡.Ô0ÙØ�‰×Ñ˜nÔ-Ùr   c                ó~   € VP                   P                  4        F  pV P                  VP                  4       K   	  R# )a5  For each nTDSConnection object associated with a particular
DSA, we test if it implies an edge to this graph node (i.e.
the "fromServer" attribute).  If it does then we add an
edge from the server unless we are over the max edges for this
graph node

:param dsa: dsa with a dnstr equivalent to his graph node
N)rü   rV  rn  rX  )r,   rv   rF  s   && r   Úadd_edges_from_connectionsÚ$GraphNode.add_edges_from_connections  s1   € ð ×(Ñ(×/Ñ/Ö1ˆGØ×Ñ˜w×1Ñ1Ö2ó 2r   c                ó<  € V P                    F‹  pVP                  V4      pRpV F  pVP                  4       '       d   K  RpK  	  V'       d   KC  \        P                  p\        P
                  \        P                  ,          pVP                  WxW#R4       K�  	  R# )zmFor each edge directed to this graph node, ensure there
is a corresponding nTDSConnection object in the dsa.
FTN)re  rZ  rÒ  r   rÕ  ÚSYSTEM_FLAG_CONFIG_ALLOW_RENAMEÚSYSTEM_FLAG_CONFIG_ALLOW_MOVErv  )	r,   rv   rt  Ú
edge_dnstrÚconnectionsÚfound_validrF  Úoptr‹   s	   &&&      r   Úadd_connections_from_edgesÚ$GraphNode.add_connections_from_edges#  s�   € ð Ÿ.œ.ˆJØ×:Ñ:¸:ÓFˆKð  ˆKÛ&�Ø×+Ñ+×-Ò-ÙØ"’ñ '÷
 Ùô ×0Ñ0ˆCÜ×9Ñ9Ü×7Ñ7õ8ˆEð ×Ñ˜s¨9À$ÖGóC )r   c                óR   € \        V P                  4      V P                  8¼  d   R# R# )z<Return True if we have met the maximum "from edges" criteriaTF)r1  re  rd  rS   s   &r   Úhas_sufficient_edgesÚGraphNode.has_sufficient_edgesJ  s   € äˆt�~‰~Ó $§.¡.Ô0ÙÙr   )rj   re  rd  N)r   r   r   r   rc   r-   r9   rn  rq  rz  r}  r   rd   re   s   @r   rb  rb  è  s/   ø‡ € ñòò	òò&
3ò%H÷Nð r   rb  c                   ó6   a € ] tR tRt o RtR tR tR tRtV t	R# )Ú	TransportiQ  z;Class defines a Inter-site transport found under Sites
    c                óX   € Wn         ^ V n        RV n        RV n        RV n        . V n        R# ©r   N)r9  r÷   rp  ÚnameÚaddress_attrÚbridgehead_listr{  s   &&r   r-   ÚTransport.__init__U  s,   € ØŒ
ØˆŒØˆŒ	ØˆŒ	Ø ˆÔØ!ˆÖr   c                ót  € V P                   P                  : RV P                  : 2R\        V P                  4      ,          ,           RV P
                  ,          ,           RV P                  ,          ,           RV P                  ,          ,           RP                  R V P                   4       4      ,           pV# )ú,Debug dump string output of Transport objectr~  r  ú
	options=%dz
	address_attr=%sz	
	name=%sr}   c              3   ó4   "  € T F  pR V,          x € K  	  R# 5i)z
	bridgehead_list=%sNr   )r    r9  s   & r   r#   Ú$Transport.__str__.<locals>.<genexpr>e  s   é € ÐZÑEY¸EÐ/°%×7Ò7ÓEYùr„   )
r4   r   r9  r5   rp  r÷   r„  rƒ  rˆ   r…  r7   s   & r   r9   ÚTransport.__str__]  s‘   € ð "&§¡×!8Ô!8¸$¿*»*ÐEØœs 4§9¡9›~Õ-õ.à $§,¡,Õ.õ/ð % t×'8Ñ'8Õ8õ9ð ˜tŸy™yÕ(õ	)ð
 �w‰wÑZÀT×EYÒEYÓZÓZõ[ˆð ˆr   c                óF  € . ROp VP                  V P                  \        P                  VR7      pT^ ,          p\        P                  ! TP                  RTR,          ^ ,          4      4      T n
        RT9   d   \        TR,          ^ ,          4      T n        RT9   d   \        TR,          ^ ,          4      T n        RT9   d   \        TR,          ^ ,          4      T n        RT9   do   TR,           F_  p\!        YP#                  R4      4      p	\        T	P$                  4      p
Y P&                  9  g   KD  T P&                  P)                  T
4       Ka  	  R
# R
#   \        P                   d2   pTP
                  w  rV\        RT P                  : RT: R	24      hR
p?ii ; i)z�Given a Transport object with an prior initialization
for the object's DN, search for the DN and load attributes
from the samdb.
r<   r÷   rƒ  ÚbridgeheadServerListBLÚtransportAddressAttributer>   zUnable to find Transport for (rB   r3   Nr0  )r<   r÷   rƒ  rŽ  r�  )rC   r9  rD   rE   rF   rG   r   r   rH   rI   rp  r(  r÷   r5   r„  rƒ  r   r3  r¸   r…  r©   )r,   rJ   rA   rK   Úe18rM   rN   rO   r«   r8  r9  s   &&         r   Úload_transportÚTransport.load_transporti  s]  € ò
.ˆð
	/Ø—,‘, D§J¡J´c·n±nØ%*ð ó ,ˆCð �!�fˆÜ—I’I˜e×7Ñ7¸Ø! ,Õ/°Õ2ó4ó 5ˆŒ	ð ˜ÔÜ˜s 9�~¨aÕ0Ó1ˆDŒLà&¨#Ô-Ü # CÐ(CÕ$DÀQÕ$GÓ HˆDÔà�SŒ=Ü˜C �K¨�NÓ+ˆDŒIà# sÔ*ØÐ5×6Ð6�Ü˜u§l¡l°6Ó&:Ó;�Ü˜DŸG™G›�Ø× 4Ñ 4Ö4Ø×(Ñ(×/Ñ/°Ö6ó	 7ñ +øô% �|‰|ô 	/ØŸ8™8‰LˆTÝØ ŸJœJ«ð.ó /ð /ûð	/ús   †,E ÅF Å/,FÆF )r„  r…  r9  rp  rƒ  r÷   N)
r   r   r   r   rc   r-   r9   r‘  r   rd   re   s   @r   r€  r€  Q  s   ø‡ € ñò"ò
÷%7ð %7r   r€  c                   óL   a € ] tR tRt o RtRR ltR tR tR tR t	R	 t
R
tV tR# )r¨   i‘  zžClass encapsulation of the NDR repsFromToBlob.

Removes the necessity of external code having to
understand about other_info or manipulation of
update flags.
Nc                óV  € R V P                   R&   WP                   R&   ^ V P                   R&   VfŸ   \        P                  ! 4       V P                   R&   ^V P                   R,          n        RV P                   R&   RV P                   R&   \        P                  ! 4       ;V P                   R,          P
                  n        V P                   R&   R# W P                   R&   VP
                  P                  V P                   R&   VP                  ^8X  d?   VP
                  P                  P                  V P                   R&   RV P                   R&   R# VP
                  P                  P                  V P                   R&   VP
                  P                  P                  V P                   R&   R# )	Fr±   r'   Úupdate_flagsNr´   Ú	dns_name1Ú	dns_name2Ú
other_info)
Ú__dict__r   r£   rÆ   ÚrepsFromTo1OtherInforÈ   r˜  Údns_namer–  r—  )r,   r'   r´   s   &&&r   r-   ÚRepsFromTo.__init__˜  sF  € à).ˆ�‰�oÑ&Ø$,�‰�jÑ!Ø(+ˆ�‰�nÑ%ð8 ÒÜ(0×(?Ò(?Ó(AˆD�M‰M˜*Ñ%Ø03ˆD�M‰M˜*Õ%Ô-Ø)-ˆD�M‰M˜+Ñ&Ø)-ˆD�M‰M˜+Ñ&ô /7×.KÒ.KÓ.MðNˆD�M‰M˜*Õ%×)Ñ)Ô4Ø—‘˜lÓ+ð )1�M‰M˜*Ñ%Ø*2¯,©,×*AÑ*AˆD�M‰M˜,Ñ'à×Ñ 3Ô&Ø-5¯\©\×-DÑ-D×-MÑ-M�—‘˜kÑ*Ø-1�—‘˜kÓ*à-5¯\©\×-DÑ-D×-NÑ-N�—‘˜kÑ*Ø-5¯\©\×-DÑ-D×-NÑ-N�—‘˜kÓ*r   c                óê  € RV P                   P                  ,          RV P                  ,          ,           RV P                  ,          ,           RV P                  ,          ,           RV P
                  ,          ,           RV P                  ,          ,           RV P                  ,          ,           RV P                  ,          ,           R	V P                  ,          ,           R
V P                  ,          ,           RV P                  ,          ,           RV P                  ,          ,           RV P                  ,          ,           R,           RP                  R V P                   4       4      ,           R,           pV# )r0   ry   z

	dnstr=%sz
	update_flags=0x%Xz
	version=%dz
	source_dsa_obj_guid=%sz
	source_dsa_invocation_id=%sr€  z
	replica_flags=0x%Xz
	consecutive_sync_failures=%dz
	last_success=%sz
	last_attempt=%sz
	dns_name1=%sz
	dns_name2=%sz
	schedule[ r}   c              3   ó4   "  € T F  pR V,          x € K  	  R# 5irˆ  r   r‰  s   & r   r#   Ú%RepsFromTo.__str__.<locals>.<genexpr>ß  s   é € Ð@±-¨$�w —~’~³-ùr„   r�  )r4   r   r'   r•  rÆ   Úsource_dsa_obj_guidr6  rq  Úreplica_flagsÚconsecutive_sync_failuresÚlast_successÚlast_attemptr–  r—  rˆ   rr  r7   s   & r   r9   ÚRepsFromTo.__str__Ì  sH  € ð �t—~‘~×.Ñ.Õ.Ø §¡Õ-õ.à&¨×):Ñ):Õ:õ;ð   $§,¡,Õ.õ/ð ,¨d×.FÑ.FÕFõ	Gð
 2Ø×.Ñ.õ/õ0ð '¨×)<Ñ)<Õ<õ=ð (¨$×*<Ñ*<Õ<õ=ð 3Ø×/Ñ/õ0õ
1ð % t×'8Ñ'8Õ8õ9ð % t×'8Ñ'8Õ8õ9ð " D§N¡NÕ2õ3ð " D§N¡NÕ2õ3ð  õ ð  �w‰wÑ@°$·-²-Ó@Ó@õ!Að" õ#ˆð& ˆr   c                ó¨  € VR
9   d“   VR9   d/   V P                   R;;,          \        P                  ,          uu&   M4VR9   d.   V P                   R;;,          \        P                  ,          uu&   \	        V P                   R,          P
                  W4       EM‹VR9   d®   W P                   R&   V P                   R,          P                  ^8X  d@   V P                   R,          V P                   R,          P
                  P                  n        EMV P                   R,          V P                   R,          P
                  P                  n	        M×VR9   dz   W P                   R&   V P                   R,          P                  ^8X  d   \        V4      hV P                   R,          V P                   R,          P
                  P                  n        MWVR9   d   W P                   R&   MAVR9   d   W P                   R&   M+VR9   d   \        RV,          4      h\        RV,          4      hV P                   R;;,          \        P                  ,          uu&   R	# )z–Set an attribute and change update flag.

Be aware that setting any RepsFromTo attribute will set the
drsuapi.DRSUAPI_DRS_UPDATE_ADDRESS update flag.
r•  r´   r–  r—  r'   r±   z$Attempt to set readonly attribute %súUnknown attribute %sN©rr  r¡  rq  r   r6  r¢  r£  r¤  )r¡  )rr  ©r–  ©r—  ©r'   ©r±   ©rÆ   )r™  r   ÚDRSUAPI_DRS_UPDATE_FLAGSÚDRSUAPI_DRS_UPDATE_SCHEDULEÚsetattrrÈ   rÆ   r˜  r›  r–  rÇ   r—  ÚDRSUAPI_DRS_UPDATE_ADDRESS)r,   Úitemr«   s   &&&r   Ú__setattr__ÚRepsFromTo.__setattr__ä  sÂ  € ð ð $ô $ð
 Ð(Ô(Ø—‘˜n×-´×1QÑ1QÕQÔ-Ø˜Ô%Ø—‘˜n×-´×1TÑ1TÕTÓ-ä�D—M‘M *Õ-×1Ñ1°4Ö?à�]Ô"Ø).�M‰M˜+Ñ&à�}‰}˜ZÕ(×0Ñ0°CÔ7à—M‘M +Õ.ð —‘˜jÕ)×-Ñ-×8Ñ8ÖAð —M‘M +Õ.ð —‘˜jÕ)×-Ñ-×8Ñ8ÕBð �]Ô"Ø).�M‰M˜+Ñ&à�}‰}˜ZÕ(×0Ñ0°CÔ7Ü$ TÓ*Ð*ð —M‘M +Õ.ð —‘˜jÕ)×-Ñ-×8Ñ8ÕBð �\Ô!Ø(-�M‰M˜*Ò%àÐ&Ô&Ø-2�M‰M˜/Ò*à�[Ô Ü Ð!GÈ$Õ!NÓOÐOä Ð!7¸$Õ!>Ó?Ð?à�‰�n×%¬×)KÑ)KÕKÕ%r   c                óF  € VR9   d(   \        V P                  R,          P                  V4      # VR9   d   V P                  R,          P                  # VR9   d…   V P                  R,          P                  ^8X  d2   V P                  R,          P                  P                  P
                  # V P                  R,          P                  P                  P                  # VR	9   d_   V P                  R,          P                  ^8X  d   \        V4      hV P                  R,          P                  P                  P                  # VR
9   d   V P                  R,          # VR9   d   V P                  R,          # VR9   d   V P                  R,          # \        RV,          4      h)zjOverload of RepsFromTo attribute retrieval.

Allows external code to ignore substructures within the blob
r´   r±   r'   r•  r§  r¨  r­  r©  rª  r¬  r«  ©r•  )	Úgetattrr™  rÈ   rÆ   r˜  r›  r–  rÇ   r—  )r,   r²  s   &&r   Ú__getattr__ÚRepsFromTo.__getattr__  sP  € ð
 ð $ô $ô ˜4Ÿ=™=¨Õ4×8Ñ8¸$Ó?Ð?à�[Ô Ø—=‘= Õ,×4Ñ4Ð4à�]Ô"Ø�}‰}˜ZÕ(×0Ñ0°CÔ7Ø—}‘} ZÕ0×4Ñ4×?Ñ?×HÑHÐHà—}‘} ZÕ0×4Ñ4×?Ñ?×IÑIÐIà�]Ô"Ø�}‰}˜ZÕ(×0Ñ0°CÔ7Ü$ TÓ*Ð*à—}‘} ZÕ0×4Ñ4×?Ñ?×IÑIÐIàÐ&Ô&Ø—=‘= Õ1Ð1à�\Ô!Ø—=‘= Õ,Ð,àÐ%Ô%Ø—=‘= Õ0Ð0äÐ3°dÕ:Ó;Ð;r   c                ó    € V P                   ^ 8g  # rï   r¶  rS   s   &r   r²   ÚRepsFromTo.is_modified;  s   € Ø×!Ñ! SÑ(Ð)r   c                ó$   € ^ V P                   R&   R# )r   r•  N)r™  rS   s   &r   r³   ÚRepsFromTo.set_unmodified>  s   € Ø(+ˆ�‰�nÓ%r   r   )NN)r   r   r   r   rc   r-   r9   r³  r¸  r²   r³   r   rd   re   s   @r   r¨   r¨   ‘  s2   ø‡ € ñô2Oòhò00Lòd#<òJ*÷,ð ,r   r¨   c                   ó6   a € ] tR tRt o RtR tR tR tRtV t	R# )ÚSiteLinkiB  z0Class defines a site link found under sites
    c                óf   € Wn         ^ V n        ^ V n        ^ V n        RV n        RV n        . V n        R# r‚  )r9  r÷   rn  Úcostrr  ÚintervalÚ	site_listr{  s   &&r   r-   ÚSiteLink.__init__F  s2   € ØŒ
ØˆŒØˆÔØˆŒ	ØˆŒØˆŒØˆŽr   c                ó¶  € V P                   P                  : RV P                  : 2RV P                  ,          ,           RV P                  ,          ,           RV P
                  ,          ,           RV P                  ,          ,           pV P                  Ee   VRV P                  P                  ,          RV P                  P                  ,          ,           RV P                  P                  ,          ,           ,          p\        V P                  P                  4       F�  w  r#VR	W#P                  3,          R
W#P                  3,          ,           RV,          ,           RP                  R V P                  P                   V,          P"                   4       4      ,           R,           ,          pK’  	  V P$                   F  w  rEVRV: RV: R2,           pK  	  V# )rˆ  r~  r‰  z
	system_flags=%dz	
	cost=%dz
	interval=%sr�  r‚  rƒ  r„  r…  r†  r}   c              3   ó4   "  € T F  pR V,          x € K  	  R# 5irˆ  r   r‰  s   & r   r#   Ú#SiteLink.__str__.<locals>.<genexpr>d  rŒ  r„   r�  z
	site_list=r2   r3   )r4   r   r9  r÷   rn  rÁ  rÂ  rr  rŽ  r�  r�  r‘  r’  r“  r”  rˆ   r•  r–  rÃ  )r,   r8   r—  r˜  rp  r¸   s   &     r   r9   ÚSiteLink.__str__O  s�  € ð "&§¡×!8Ô!8¸$¿*»*ÐEØ $§,¡,Õ.õ/à$ t×'8Ñ'8Õ8õ9ð ˜tŸy™yÕ(õ)ð ! 4§=¡=Õ0õ	1ˆð �=‰=Ó$ØÐ*¨T¯]©]×-?Ñ-?Õ?Ø/°$·-±-×2IÑ2IÕIõJà8Ø—]‘]×4Ñ4õ5õ6õ 6ˆDô
 ' t§}¡}×'@Ñ'@ÖA‘	�ØÐ?ØŸ[™[Ð)õ*àAØŸ]™]Ð+õ,õ-ð =¸qÕ@õ	Að
 Ÿ™Ñ\¸4¿=¹=×;RÑ;RÐSTÕ;U×;[Ò;[Ó\Ó\õ]ð õõ ’ñ Bð Ÿœ‰HˆDÙ³T»2Ð>Õ>ŠDñ 'àˆr   c                óð  € . ROp VP                  V P                  \        P                  VR.R7      pT^ ,          pRT9   d   \        TR,          ^ ,          4      T n        RT9   d   \        TR,          ^ ,          4      T n	        RT9   d   \        TR,          ^ ,          4      T n
        RT9   d   \        TR,          ^ ,          4      T n        RT9   dŸ   TR,           F‘  p\        YP                  R4      4      p	\        P                  ! T	P                   P#                  R4      4      p
\%        T	P                   4      pY«3T P&                  9  g   Ku  T P&                  P)                  Y«34       K“  	  RT9   d"   \+        \,        P.                  X4      T n        R# \1        4       T n        R#   \        P                   d2   pTP
                  w  rV\        R	T P                  : R
T: R24      hRp?ii ; i)z€Given a siteLink object with an prior initialization
for the object's DN, search for the DN and load attributes
from the samdb.
r÷   rž  rÁ  rr  ÚreplIntervalÚsiteListzextended_dn:0)r?   r@   rA   ÚcontrolszUnable to find SiteLink for (rB   r3   Nr0  rH   )r÷   rž  rÁ  rr  rÊ  rË  )rC   r9  rD   rE   rF   rG   r   r(  r÷   rn  rÁ  rÂ  r   r3  r   rH   r¸   Úget_extended_componentr5   rÃ  r©   r   r   rr  rs  )r,   rJ   rA   rK   Úe19rM   rN   rO   r«   r8  rp  r9  s   &&          r   Úload_sitelinkÚSiteLink.load_sitelinkk  s‘  € ò
ˆð	/Ø—,‘, D§J¡J´c·n±nØ%*°oÐ5Fð ó HˆCð �!�fˆà˜ÔÜ˜s 9�~¨aÕ0Ó1ˆDŒLà˜CÔÜ # C¨Õ$6°qÕ$9Ó :ˆDÔà�SŒ=Ü˜C �K¨�NÓ+ˆDŒIà˜SÔ Ü  NÕ 3°AÕ 6Ó7ˆDŒMà˜ÔØ˜ZŸ˜�Ü˜u§l¡l°6Ó&:Ó;�Ü—y’y §¡×!?Ñ!?ÀÓ!GÓH�Ü˜DŸG™G›�Ø�=¨¯©Ö6Ø—N‘N×)Ñ)¨4¨-Ö8ñ )ð ˜ÔÜ&¤x×'8Ñ'8¸%Ó@ˆDŽMä3Ó5ˆDŽMøô= �|‰|ô 	/ØŸ8™8‰LˆTÝØ ŸJœJ«ð.ó /ð /ûð	/ús   †.F/ Æ/G5Ç,G0Ç0G5)rÁ  r9  rÂ  r÷   rr  rÃ  rn  N)
r   r   r   r   rc   r-   r9   rÏ  r   rd   re   s   @r   r¿  r¿  B  s   ø‡ € ñòò÷8-6ð -6r   r¿  c                   ó&   a € ] tR tRt o R tRtV tR# )ÚKCCFailedObjecti›  c                óB   € Wn         W n        W0n        W@n        WPn        R # rÑ   )rk  Úfailure_countÚtime_first_failureÚlast_resultr›  )r,   rk  rÔ  rÕ  rÖ  r›  s   &&&&&&r   r-   ÚKCCFailedObject.__init__œ  s   € àŒ	Ø*ÔØ"4ÔØ&ÔØ Žr   )r›  rÔ  rÖ  rÕ  rk  N)r   r   r   r   r-   r   rd   re   s   @r   rÒ  rÒ  ›  s   ø‡ € ÷!ð !r   rÒ  c                 ó°   € V P                   P                  4        F  pVP                  4       '       g   K  Vu # 	  \        R V P                  ,          4      h)z)Unable to find config NC replica for (%s))rú   rV  rT   r   rj   )rv   r9  s   & r   r3  r3  ©  sK   € à×&Ñ&×-Ñ-Ö/ˆØ�?‰?×ÔØŠLñ 0ô Ð>Ø—=‘=õ!ó "ð "r   c                 ó  € \         P                  ! 4       p ^¼V n        ^ V n        ^V n        \         P
                  ! 4       p^ Vn        ^Vn        V.V n        \         P                  ! 4       p^.^¨,          Vn
        V.V n        V # )z¼Create a default schedule for an NTDSConnection or Sitelink. This
is packed differently from the repltimes schedule used elsewhere
in KCC (where the 168 nibbles are packed into 84 bytes).
)r   rr  rŽ  r�  r�  ÚscheduleHeaderr“  r”  r’  ÚscheduleSlotsr–  r•  )rr  r˜  Údatas      r   rs  rs  ³  sy   € ô × Ò Ó"€Hà€H„MØ€HÔØ!"€HÔä×$Ò$Ó&€FØ€F„KØ€F„Mà"˜8€HÔä×!Ò!Ó#€DØ�˜#•€D„Jà˜€HÔØ€Or   c           
     óp  € . pV P                  V P                  4       \        P                  RR7      pV P                  V P                  4       \        P                  RR7      p\	        4       p^ pV F‰  pVP
                  P                  4       P                  4       pWXP                  4       ;;,          ^,          uu&   VP                  4       P                  4       VP                  4       8X  g   K€  V^,          pK‹  	  \        V4      \        V4      8w  EdŸ   . p	V F5  pVP
                  P                  4       V9  g   K$  V	P                  V4       K7  	  RP                  \        P                  ! V4      \        P                  ! \        V P                  4       4      4      4      p
V	 EF	  p\        P                  ! \        VP
                  4      4      pV P                  V P                  4       \        P                  R.RP                  V4      R.R7      pV P                  V P                  4       \        P                  RR	.R
P                  V
V4      R.R7      p\        V4      ^ 8”  g   KÇ  \        V4      ^ 8”  g   KÙ  \        V^ ,          R,          ^ ,          4      p\        V^ ,          R,          ^ ,          4      pVV8w  d   EK#  RpV^ ,          R	,           FŒ  p\        P                   ! V \        V4      4      pVP                  4       pVP                  4       P                  4       pVV,          V8”  d   Rp M-VV,          V8X  g   Ks  VVP                  4       8  g   KŠ  Rp M	  V'       g   EKÐ  VP
                  P                  4       pVP                  VP                  4       4       EK  	  V# )aÍ  
Discover which sites have no DCs and whose lowest single-hop cost
distance for any link attached to that site is linked to the site supplied.

We compare the lowest cost of your single-hop link to this site to all of
those available (if it exists). This means that a lower ranked siteLink
with only the uncovered site can trump any available links (but this can
only be done with specific, poorly enacted user configuration).

If the site is connected to more than one other site with the same
siteLink, only the largest site (failing that sorted alphabetically)
creates the DNS records.

:param samdb database
:param site_name origin site (with a DC)

:return a list of sites this site should be covering (for DNS)
z*(&(objectClass=server)(serverReference=*))r?  z(objectClass=site)zCN={},CN=Sites,{}rÁ  z&(&(objectClass=siteLink)(siteList={}))zserver_sort:1:0:cost)r?   r@   rA   r@  rÌ  rË  z3(&(objectClass=siteLink)(siteList={})(siteList={}))TF)rC   rX   rD   rB  r
   r¸   ÚparentÚcanonical_strÚget_rdn_valueÚlowerr1  r©   ÚformatÚbinary_encoder5   r(  r·   )rJ   Ú	site_nameÚsites_to_coverÚ
server_resÚsite_resÚsites_in_useÚdc_countrO   Úsite_dnÚsites_uncoveredÚown_site_dnÚsiteÚ
encoded_dnÚ	link_res1Ú	link_res2Úcost1Úcost2Úto_coverÚsite_valÚsite_dn_strÚsite_rdnÚsite_cover_rdns   &&                    r   Úuncovered_sites_to_coverrø  Ô  s,  € ð& €Nà—‘ 5×#:Ñ#:Ó#<Ü$'×$5Ñ$5ð*5ð ó 6€Jð
 �|‰| ×!8Ñ!8Ó!:Ü"%×"3Ñ"3Ø';ð ó =€Hô “9€LØ€Hó ˆØ—&‘&—-‘-“/×(Ñ(Ó*ˆØ×*Ñ*Ó,×-°Õ2Ó-à× Ñ Ó"×(Ñ(Ó*¨i¯o©oÓ.?Ö?Ø˜�MŠHñ ô ˆ<ÓœC ›MÕ)àˆãˆCØ�v‰v×#Ñ#Ó%¨\Ö9Ø×&Ñ& sÖ+ñ ð *×0Ñ0Ü×Ò˜iÓ(Ü×Òœc %×"9Ñ"9Ó";Ó<Ó=ó
ˆô
 $ˆDÜ×*Ò*¬3¨t¯w©w«<Ó8ˆJð Ÿ™¨%×*AÑ*AÓ*CÜ+.×+<Ñ+<ÀVÀHð16ß6<±f¸ZÓ6HØ/EÐ.Fð	 %ó HˆIð Ÿ™¨%×*AÑ*AÓ*CÜ+.×+<Ñ+<Ø,2°JÐ+?ð1CßCIÁ6Ø)4Ø)3óD5ð 0FÐ.Fð %ó HˆIô �9‹~ Ö!¤c¨)£n°qÖ&8Ü˜I a�L¨Õ0°Õ3Ó4�Ü˜I a�L¨Õ0°Õ3Ó4�ð ˜E”>Úð
  �Ø )¨!¥¨Z× 8Ð 8�HÜ!Ÿfšf U¬C°«MÓ:�GØ")×"7Ñ"7Ó"9�KØ&×4Ñ4Ó6×<Ñ<Ó>�HØ# KÕ0°8Ô;Ø#(˜ÙØ& {Õ3°xÖ?Ø" Y§_¡_Ó%6Ö6Ø#(˜Ùñ !9÷ ’8Ø%)§W¡W×%:Ñ%:Ó%<�NØ"×)Ñ)¨.×*>Ñ*>Ó*@×Aña $ðd Ðr   )&r¦   rD   rk  Úsambar   Úsamba.dcerpcr   r   r   Úsamba.samdbr   Ú	samba.ndrr   r	   Úcollectionsr
   Ú	Exceptionr   Úobjectr   Údictr™  rI  r6   r%   rh   rò   rC  rò  r  rb  r€  r¨   r¿  rÒ  r3  rs  rø  r   r   r   Ú<module>r     s  ðó, Û 
Û å ÷ñ õ
  ß *Ý ô	ˆyô 	ôAˆVô Añ
 ÑN V§_¡_×%:Ñ%:Ô%<ÓNÓN€
ôn+�Fô n+ôb|2�ô |2ô~[˜Fô [ô|
_�Vô _ôDQ�ô Qôhpˆ6ô pôf	f�ô fôR=7�ô =7ô@n,�ô n,ôbV6ˆvô V6ôr!�fô !ò"òôBhr   