
    g4                         S SK r S SKJr  S SKJr  S SKJr  S SKJ	r	J
r
JrJr   " S S\	5      r " S S\	5      r " S	 S
\5      r " S S\5      r " S S\5      r " S S\5      rg)    N)system_session)SamDB)CommandCommandErrorSuperCommandOptionc            	           \ rS rSrSrSr\R                  \R                  \R                  S.r
\" SSS\SS	S
9/rSS jrSrg)cmd_forest_show   zDisplay forest settings.

These settings control the behaviour of all domain controllers in this
forest. This displays those settings from the replicated configuration
partition.
z%prog [options]	sambaoptsversionoptscredopts-H--URL%LDB URL for database or target serverURLHhelptypemetavardestNc                     UR                  5       nUR                  U5      n[        U[        5       XeS9nUR	                  5       nU R
                  < SU< 3n	UR                  U	[        R                  U R                  S9n
U
S   nU R                  R                  SU	-  5        U R                   H,  n U R                  R                  U< SX   S   < S35        M.     g ! [         a"    U R                  R                  SU-  5         M\  f = f)	Nurlsession_infocredentialslp,)basescopeattrsr   zSettings for %s
: 
z%s: <NO VALUE>
)get_loadparmget_credentialsr   r   	domain_dnobjectdnsearchldb
SCOPE_BASE
attributesoutfwriteKeyError)selfr   r   r   r   r   credssamdbr(   	object_dnres
res_objectattrs                5/usr/lib/python3/dist-packages/samba/netcmd/forest.pyruncmd_forest_show.run4   s    ##%((,!.*:"'0 OO%	#}}i8	 ll	!%  2 V
		+i78OOD;		dJ4DQ4G HI $  ;		 2T 9:;s   4(C!!(DD NNNN)__name__
__module____qualname____firstlineno____doc__synopsisoptionsSambaOptionsVersionOptionsCredentialsOptionstakes_optiongroupsr   strtakes_optionsr9   __static_attributes__r;       r8   r
   r
      sW     !H ))--.. 	tW#JS	2M
;rK   r
   c            	           \ rS rSrSrSrSrSr\R                  \R                  \R                  S.r\" SSS\S	S
S9/rS/rSS jrSrg)cmd_forest_setO   zIModify forest settings.

This will alter the setting specified to value.
Nz%prog value [options]r   r   r   r   r   r   r   valuec                    UR                  5       nUR                  U5      n[        U[        5       XvS9nUR	                  5       n	U R
                  < SU	< 3n
[        R                  " 5       n[        R                  " X5      Ul	        [        R                  " U[        R                  U R                  5      XR                  '   UR                  U5        U R                  R                  SU R                  < SU< S35        g )Nr   r    zset r$   r%   )r&   r'   r   r   r(   r)   r+   MessageDndnMessageElementFLAG_MOD_REPLACE	attributemodifyr.   r/   )r1   rO   r   r   r   r   r   r2   r3   r(   r4   ms               r8   r9   cmd_forest_set.rung   s    ##%((,!.*:"'0 OO%	#}}i8	 KKMvve'..3''9.. 	Q		$..%@ArK   r;   r<   )r=   r>   r?   r@   rA   rV   r)   rB   rC   rD   rE   rF   rG   r   rH   rI   
takes_argsr9   rJ   r;   rK   r8   rM   rM   O   sk    
 IH&H ))--.. 	tW#JS	2M
 JBrK   rM   c                   "    \ rS rSrSrSrS/rSrg)!cmd_forest_show_directory_service}   zDisplay Directory Service settings for the forest.

These settings control how the Directory Service behaves on all domain
controllers in the forest.
?CN=Directory Service,CN=Windows NT,CN=Services,CN=Configurationdsheuristicsr;   N)r=   r>   r?   r@   rA   r)   r-   rJ   r;   rK   r8   r\   r\   }   s    
 QH !JrK   r\   c                        \ rS rSrSrSrSrSrg)-cmd_forest_set_directory_service_dsheuristics   aQ  Set the value of dsheuristics on the Directory Service.

This value alters the behaviour of the Directory Service on all domain
controllers in the forest. Documentation related to this parameter can be
found here: https://msdn.microsoft.com/en-us/library/cc223560.aspx

In summary each "character" of the number-string, controls a setting.
A common setting is to set the value "2" in the 7th character. This controls
anonymous search behaviour.

Example: dsheuristics 0000002

This would allow anonymous LDAP searches to the domain (you may still need
to alter access controls to allow this).
r^   r_   r;   N)r=   r>   r?   r@   rA   r)   rV   rJ   r;   rK   r8   ra   ra      s     QHIrK   ra   c                   D    \ rS rSrSr0 r\" 5       \S'   \" 5       \S'   Srg)cmd_forest_directory_service   z*Forest configuration partition management.showr_   r;   N)	r=   r>   r?   r@   rA   subcommandsr\   ra   rJ   r;   rK   r8   rd   rd      s$    4K;=K"O"QKrK   rd   c                   0    \ rS rSrSr0 r\" 5       \S'   Srg)
cmd_forest   zForest management.directory_servicer;   N)r=   r>   r?   r@   rA   rg   rd   rJ   r;   rK   r8   ri   ri      s    K'C'EK#$rK   ri   )r+   samba.getoptgetoptrC   
samba.authr   samba.samdbr   samba.netcmdr   r   r   r   r
   rM   r\   ra   rd   ri   r;   rK   r8   <module>rq      sm   &   %  -;g -;`)BW )B\" "N (R< RF FrK   