+
    4Ssi("                         ^ RI t ^ RI HtHtHt ^RIH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 tR# )    N)FLAG_MOD_ADDFLAG_MOD_REPLACELdbError)SiteNotFoundExceptionc                       ] tR t^tRtRtR# )SubnetExceptionzBase element for Subnet errors N__name__
__module____qualname____firstlineno____doc____static_attributes__r	       //usr/lib/python3/dist-packages/samba/subnets.pyr   r      s    (r   r   c                       ] tR t^!tRtRtR# )SubnetNotFoundz$The subnet requested does not exist.r	   Nr
   r	   r   r   r   r   !   s    .r   r   c                       ] tR t^&tRtRtR# )SubnetAlreadyExistsz&The subnet being added already exists.r	   Nr
   r	   r   r   r   r   &   s    0r   r   c                       ] tR t^+tRtRtR# )SubnetInvalidzThe subnet CIDR is invalid.r	   Nr
   r	   r   r   r   r   +   s    %r   r   c                       ] tR t^0tRtRtR# )SiteNotFoundz2The site to be used for the subnet does not exist.r	   Nr
   r	   r   r   r   r   0   s    <r   r   c                B   V P                  V\        P                  R\        P                  ! V4      ,          R7      p\	        V4      ^8w  d   \        RV,          4      hV^ ,          P                  p\        V\        4      '       g   \        RV,          4      h\        P                  ! V R4      p VP                  V4        TP                  R4       TP                  ^ R	T4        \        P                   ! 4       pYgn        \        P"                  ! R
\$        R4      TR&   \        P"                  ! \        T4      \$        R4      TR&   T P'                  T4       R#   \        P                   d    \        R4      hi ; i  \        P                   d    \        R4      hi ; i  \        P                   dc   pTP(                  w  rT	\        P*                  8X  d   \        T: RT
: 24      hT	\        P,                  8X  d   \/        RT,          4      hh Rp?ii ; i)aN  Create a subnet and associate it with a site.

:param samdb: A samdb connection
:param configDn: The DN of the configuration partition
:param subnet_name: name of the subnet to create (a CIDR range)
:return: None
:raise SubnetAlreadyExists: if the subnet to be created already exists.
:raise SiteNotFound: if the site does not exist.
z(&(objectclass=Site)(cn=%s))basescope
expressionz&A site with the name %s does not existz'%s is not a valid subnet (not a string)CN=Subnets,CN=Sitesdnsubnet.add_base() failedCN=Xdnsubnet.add_child() failedCNsubnetobjectclass
siteObject is not a valid subnet: (A subnet with the CIDR %s already existsN)searchldbSCOPE_SUBTREEbinary_encodelenr   dn
isinstancestrr   Dnadd_baser   r   	add_childset_componentMessageMessageElementr   addargsERR_INVALID_DN_SYNTAXERR_ENTRY_ALREADY_EXISTSr   )samdbconfigDnsubnet_name	site_nameretdn_sitednsubnetmeenumestrs   &&&&       r   create_subnetrG   5   s    ,,HC,=,="@((3#4  5C 3x1}C$% & 	&!fiiGk3''ESTTvve23H<(#=6" 1dK0KKM--h.;=-,,S\<-9;,		! << <:;;< << =;<<= << vv3,,,+t TUUS111 &&P(3'4 5 5 s2   3E F *A3F' !F !F$'H<AHHc                z   \         P                  ! V R4      p VP                  V4        TP                  R4       TP                  ^ RT4        T P                  T\         P                  RR7      p\        T4      ^8w  d   \        RT,          4      h T P                  T4       R	#   \         P                   d    \	        R4      hi ; i  \         P                   d    \	        R4      hi ; i  \         d@   pTP                  w  rgT\         P                  8X  d   \        RT,          4      h R	p?LR	p?ii ; i)
zDelete a subnet.

:param samdb: A samdb connection
:param configDn: The DN of the configuration partition
:param subnet_name: Name of the subnet to delete
:return: None
:raise SubnetNotFound: if the subnet to be deleted does not exist.
r    r!   r"   r#   r$   objectClass=subnetr   Subnet %s does not existN)r+   r2   r3   r   r   r4   r5   r*   
SCOPE_BASEr.   r   r9   ERR_NO_SUCH_OBJECTdelete)r<   r=   r>   rB   r@   e1rE   rF   s   &&&     r   delete_subnetrO   m   s%    vve23H<(#=6" 1dK0Kll&:  <s8q= !;k!IJJ  
LL% << <:;;< << =;<<=  Kww3))) !;k!IJJ *Ks/   B( C AC0 (!C	!C-0D:;5D55D:c                   \         P                  ! V R4      p VP                  V4        TP                  R4       TP                  ^ RT4       \         P                  ! T \        T4      4      pTP                  ^ RT4        T P                  YE4       R	#   \         P                   d    \	        R4      hi ; i  \         P                   d    \	        R4      hi ; i  \         d   pTP                  w  rxT\         P                  8X  d   \        RT,          4      hT\         P                  8X  d   \        RT,          4      hT\         P                  8X  d   \        T: RT: 24      hh R	p?ii ; i)
aV  Rename a subnet.

:param samdb: A samdb connection
:param configDn: The DN of the configuration partition
:param subnet_name: Name of the subnet to rename
:param new_name: New name for the subnet
:return: None
:raise SubnetNotFound: if the subnet to be renamed does not exist.
:raise SubnetExists: if the subnet to be created already exists.
r    r!   r"   r#   r$   rJ   r)   r(   N)r+   r2   r3   r   r   r4   r5   r1   renamer9   rL   r   r;   r   r:   r   )	r<   r=   r>   new_namerB   newdnsubnete2rE   rF   s	   &&&&     r   rename_subnetrU      sU    vve23H<(#=6" 1dK0&&H.Kax0X+ << <:;;< << =;<<=  ww3))) !;h!FGGS111%&P(0'1 2 2S...(BF!H I I s/   B B: C !B7:!CE2)BE--E2c                   \         P                  ! V R4      p VP                  V4        TP                  R4       TP                  ^ RT4        T P                  T\         P                  RR7      p\        T4      ^8w  d   \        RT,          4      h \         P                  ! T R
4      p	 T	P                  T4        T	P                  R4       T	P                  ^ RT4       \         P                  ! T R4      p
T
P                  T	4        T P                  T	\         P                  RR7      p\        T4      ^8w  d   \        RT,          4      h \        X^ ,          P                  4      p\         P                   ! 4       pYMn        \         P"                  ! T\$        R4      TR&   T P'                  T4       R	#   \         P                   d    \	        R4      hi ; i  \         P                   d    \	        R4      hi ; i  \         dA   pTP                  w  rxT\         P                  8X  d   \        RT,          4      h R	p?ELR	p?ii ; i  \         P                   d    \	        R4      hi ; i  \         P                   d    \	        R4      hi ; i  \         dA   pTP                  w  rxT\         P                  8X  d   \        RT,          4      h R	p?ELR	p?ii ; i)ag  Assign a subnet to a site.

This dissociates the subnet from its previous site.

:param samdb: A samdb connection
:param configDn: The DN of the configuration partition
:param subnet_name: Name of the subnet
:param site_name: Name of the site
:return: None
:raise SubnetNotFound: if the subnet does not exist.
:raise SiteNotFound: if the site does not exist.
r    r!   r"   r#   r$   rI   r   rJ   NzCN=Siteszdnsite.add_base() failedzdnsite.add_child() failedz
CN=ServerszobjectClass=sitezSite %s does not existr'   )r+   r2   r3   r   r   r4   r5   r*   rK   r.   r   r9   rL   r   r1   r/   r6   r7   r   modify)r<   r=   r>   r?   rB   r@   e3rE   rF   dnsite	dnserverse4siteDnrC   s   &&&&          r   set_subnet_siter]      s    vve23H<(#=6" 1dK0Kll&:  <s8q= !;k!IJJ  VVE:&F:!;  D),ul+IvNllcnn&8  :s8q='(@9(LMM  Q^FAD((1A)57AlO	LLOa << <:;;< << =;<<=  Kww3))) !;k!IJJ *K << :899: << ;9::;  Nww3)))'(@9(LMM *Ns`   F: G AH -I ?I4 AJ :!G!G?I5II!I14!JK##5KK#)r+   r   r   r   sitesr   	Exceptionr   r   r   r   r   rG   rO   rU   r]   r	   r   r   <module>r`      sg   .  8 8 )	i 	
	_ 	
	/ 	
	O 	
	? 	
5pB%PAr   