ó
    cÛ–i("  ã                   ó²   • S SK r S SK JrJrJr  SSKJr   " S S\5      r " S S\5      r " S	 S
\5      r	 " S S\5      r
 " S S\5      rS rS rS rS rg)é    N)ÚFLAG_MOD_ADDÚFLAG_MOD_REPLACEÚLdbErroré   )ÚSiteNotFoundExceptionc                   ó   • \ rS rSrSrSrg)ÚSubnetExceptioné   z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                   ó   • \ rS rSrSrSrg)ÚSubnetNotFoundé!   z$The subnet requested does not exist.r   Nr   r   r   r   r   r   !   s   † Ù.Úr   r   c                   ó   • \ rS rSrSrSrg)ÚSubnetAlreadyExistsé&   z&The subnet being added already exists.r   Nr   r   r   r   r   r   &   s   † Ù0Úr   r   c                   ó   • \ rS rSrSrSrg)ÚSubnetInvalidé+   zThe subnet CIDR is invalid.r   Nr   r   r   r   r   r   +   s   † Ù%Úr   r   c                   ó   • \ rS rSrSrSrg)ÚSiteNotFoundé0   z2The site to be used for the subnet does not exist.r   Nr   r   r   r   r   r   0   s   † Ù<Úr   r   c                 ó  • U R                  U[        R                  S[        R                  " U5      -  S9n[	        U5      S:w  a  [        SU-  5      eUS   R                  n[        U[        5      (       d  [        SU-  5      e[        R                  " U S5      n UR                  U5         UR                  S	5        UR                  SSU5         [        R                   " 5       nXgl        [        R"                  " S[$        S5      US'   [        R"                  " [        U5      [$        S5      US'   U R'                  U5        g! [        R                   a    [        S5      ef = f! [        R                   a    [        S
5      ef = f! [        R                   a\  nUR(                  u  pšU	[        R*                  :X  a  [        U< SU
< 35      eU	[        R,                  :X  a  [/        SU-  5      ee SnAff = f)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Ú
expressionr   z&A site with the name %s does not existr   z'%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_subnetrM   5   sÙ  € ð �,‰,˜H¬C×,=Ñ,=Ø"@Ü×(Ò(¨Ó3ñ#4ð ð 5€Cô ˆ3ƒx�1ƒ}ÜÐCØ$ñ%ó &ð 	&à�!‰f�i‰i€Gä�k¤3×'Ñ'ÜÐEÈÑSÓTÐTä�vŠv�eÐ2Ó3€Hð<Ø×Ñ˜(Ô#ð=Ø×Ñ˜6Ô"ð ×Ñ˜1˜d KÔ0ðÜ�KŠK‹MˆØŒÜ×-Ò-¨h¼Ø.;ó=ˆˆ-Ñä×,Ò,¬S°«\¼<Ø-9ó;ˆˆ,‰à�	‰	�!�øô �<‰<ó <ÜÐ:Ó;Ð;ð<ûô �<‰<ó =ÜÐ;Ó<Ð<ð=ûô �<‰<ó Ø—v‘v‰ˆØ”3×,Ñ,Ó,ÜÃ+ÊtÐ TÓUÐUØ”S×1Ñ1Ó1ô &Ð&PØ(3ñ'4ó 5ð 5ð ûðús2   ÂE	 Â0E, ÃA3F Å	 E)Å, FÆG?Æ#AG:Ç:G?c                 óX  • [         R                  " U S5      n UR                  U5         UR                  S5        UR                  SSU5         U R                  U[         R                  SS9n[        U5      S	:w  a  [        S
U-  5      e U R                  U5        g! [         R                   a    [	        S5      ef = f! [         R                   a    [	        S5      ef = f! [         a:  nUR                  u  pgU[         R                  :X  a  [        S
U-  5      e SnAN—SnAff = f)zìDelete 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   r*   úobjectClass=subnetr"   r   úSubnet %s does not existN)r1   r8   r9   r   r	   r:   r;   r0   Ú
SCOPE_BASEr4   r   r?   ÚERR_NO_SUCH_OBJECTÚdelete)rB   rC   rD   rH   rF   Úe1rK   rL   s           r   Údelete_subnetrU   m   s%  € ô �vŠv�eÐ2Ó3€Hð<Ø×Ñ˜(Ô#ð=Ø×Ñ˜6Ô"ð ×Ñ˜1˜d KÔ0ðKØ�l‰l ´·±Ø&:ð ð <ˆäˆs‹8�q‹=Ü Ð!;¸kÑ!IÓJÐJð ð 
‡L�L�Õøô% �<‰<ó <ÜÐ:Ó;Ð;ð<ûô �<‰<ó =ÜÐ;Ó<Ð<ð=ûô ó KØ—w‘w‰ˆØ”3×)Ñ)Ó)Ü Ð!;¸kÑ!IÓJÐJô *ûðKús.   ™B «C Á<C% Â B?Ã C"Ã%
D)Ã/0D$Ä$D)c                 óÌ  • [         R                  " U S5      n UR                  U5         UR                  S5        UR                  SSU5        [         R                  " U [        U5      5      nUR                  SSU5         U R                  XE5        g
! [         R                   a    [	        S5      ef = f! [         R                   a    [	        S5      ef = f! [         a~  nUR                  u  pxU[         R                  :X  a  [        SU-  5      eU[         R                  :X  a  [        SU-  5      eU[         R                  :X  a  [        U< S	U< 35      ee S
nAff = f)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   r*   rP   r/   r.   N)r1   r8   r9   r   r	   r:   r;   r7   Úrenamer?   rR   r   rA   r   r@   r   )	rB   rC   rD   Únew_namerH   ÚnewdnsubnetÚe2rK   rL   s	            r   Úrename_subnetr[   Ž   sU  € ô �vŠv�eÐ2Ó3€Hð<Ø×Ñ˜(Ô#ð=Ø×Ñ˜6Ô"ð ×Ñ˜1˜d KÔ0ä—&’&˜¤ H£Ó.€KØ×Ñ˜a  xÔ0ðØ�‰�XÕ+øô �<‰<ó <ÜÐ:Ó;Ð;ð<ûô �<‰<ó =ÜÐ;Ó<Ð<ð=ûô ó Ø—w‘w‰ˆØ”3×)Ñ)Ó)Ü Ð!;¸hÑ!FÓGÐGØ”S×1Ñ1Ó1Ü%Ð&PØ(0ñ'1ó 2ð 2à”S×.Ñ.Ó.ÜÃ(ÚBFð!Hó Ið Ið ûðús/   ™B «B8 ÂC Â B5Â8 CÃ
E#Ã%A9EÅE#c                 ó‚  • [         R                  " U S5      n UR                  U5         UR                  S5        UR                  SSU5         U R                  U[         R                  SS9n[        U5      S	:w  a  [        S
U-  5      e [         R                  " U S5      n	 U	R                  U5         U	R                  S5        U	R                  SSU5        [         R                  " U S5      n
U
R                  U	5         U R                  U	[         R                  SS9n[        U5      S	:w  a  [        SU-  5      e [        WS   R                  5      n[         R                   " 5       nXMl        [         R"                  " U[$        S5      US'   U R'                  U5        g! [         R                   a    [	        S5      ef = f! [         R                   a    [	        S5      ef = f! [         a;  nUR                  u  pxU[         R                  :X  a  [        S
U-  5      e SnAGNžSnAff = f! [         R                   a    [	        S5      ef = f! [         R                   a    [	        S5      ef = f! [         a;  nUR                  u  pxU[         R                  :X  a  [        SU-  5      e SnAGNxSnAff = f)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   r*   rO   r"   r   rP   NzCN=Siteszdnsite.add_base() failedzdnsite.add_child() failedz
CN=ServerszobjectClass=sitezSite %s does not existr-   )r1   r8   r9   r   r	   r:   r;   r0   rQ   r4   r   r?   rR   r   r7   r5   r<   r=   r   Úmodify)rB   rC   rD   rE   rH   rF   Úe3rK   rL   ÚdnsiteÚ	dnserversÚe4ÚsiteDnrI   s                 r   Úset_subnet_siterc   ¶   s‘  € ô �vŠv�eÐ2Ó3€Hð<Ø×Ñ˜(Ô#ð=Ø×Ñ˜6Ô"ð ×Ñ˜1˜d KÔ0ðKØ�l‰l ´·±Ø&:ð ð <ˆäˆs‹8�q‹=Ü Ð!;¸kÑ!IÓJÐJð ô �VŠV�E˜:Ó&€Fð:Ø�‰˜Ô!ð;Ø×Ñ˜Ô ð ×Ñ˜˜D )Ô,ä—’�u˜lÓ+€IØ×Ñ�vÔðNØ�l‰l ¬c¯n©nØ&8ð ð :ˆäˆs‹8�q‹=Ü'Ð(@À9Ñ(LÓMÐMð ô ��Q‘—‘‹^€Fä�Š‹€AØ„DÜ×(Ò(¨Ô1AØ)5ó7€A€l�Oà	‡L�L�…Oøôa �<‰<ó <ÜÐ:Ó;Ð;ð<ûô �<‰<ó =ÜÐ;Ó<Ð<ð=ûô ó KØ—w‘w‰ˆØ”3×)Ñ)Ó)Ü Ð!;¸kÑ!IÓJÐJõ *ûðKûô �<‰<ó :ÜÐ8Ó9Ð9ð:ûô �<‰<ó ;ÜÐ9Ó:Ð:ð;ûô ó NØ—w‘w‰ˆØ”3×)Ñ)Ó)Ü'Ð(@À9Ñ(LÓMÐMõ *ûðNús^   ™F% «G Á<G+ Â%H3 Â7I Ä<I9 Æ% GÇ G(Ç+
H0Ç50H+È+H0È3 IÉ I6É9
J>Ê0J9Ê9J>)r1   r   r   r   Úsitesr   Ú	Exceptionr	   r   r   r   r   rM   rU   r[   rc   r   r   r   Ú<module>rf      sg   ðó. ß 8Ñ 8Ý )ô	�iô 	ô
	�_ô 	ô
	˜/ô 	ô
	�Oô 	ô
	�?ô 	ò
5òpòB%óPAr   