
    b4                         d dl Z d dlmZ d dlmZ d dlmZ d dlm	Z	m
Z
mZmZ  G d de	          Z G d de	          Z G d	 d
e          Z G d de          Z G d de          Z G d de          ZdS )    N)system_session)SamDB)CommandCommandErrorSuperCommandOptionc                   l    e Zd ZdZdZej        ej        ej        dZ	 e
dddedd	          gZddZd
S )cmd_forest_showzDisplay 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                 6   |                                 }|                    |          }t          |t                      ||          }|                                }| j        d|}	|                    |	t          j        | j	                  }
|
d         }| j
                            d|	z             | j	        D ]\}	 | j
                            |d||         d         d           0# t          $ r  | j
                            d|z             Y Yw xY wd S )	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runzcmd_forest_show.run4   sA   ##%%((,,!.*:*:"'B0 0 0 OO%%	#}}}ii8	 ll	!%  2 2 V
	+i7888O 	; 	;D;	dddJt4DQ4G4G4G HIIII ; ; ;	 2T 9:::::;	; 	;s   ?,C,,'DDNNNN)__name__
__module____qualname____doc__synopsisoptionsSambaOptionsVersionOptionsCredentialsOptionstakes_optiongroupsr   strtakes_optionsr8        r7   r
   r
      s          !H )-.  	tW#JS	2 	2 	2M
; ; ; ; ; ;rG   r
   c                   z    e Zd ZdZdZdZdZej        ej	        ej
        dZ edddedd	
          gZdgZddZdS )cmd_forest_setzQModify forest settings.

    This will alter the setting specified to value.
    Nz%prog value [options]r   r   r   r   r   r   r   valuec                     |                                 }|                    |          }t          |t                      ||          }|                                }	| j        d|	}
t          j                    }t          j        ||
          |_	        t          j
        |t          j        | j                  || j        <   |                    |           | j                            d| j        d|d           d S )Nr   r   zset r#   r$   )r%   r&   r   r   r'   r(   r*   MessageDndnMessageElementFLAG_MOD_REPLACE	attributemodifyr-   r.   )r0   rJ   r   r   r   r   r   r1   r2   r'   r3   ms               r7   r8   zcmd_forest_set.rung   s    ##%%((,,!.*:*:"'B0 0 0 OO%%	#}}}ii8	 KMMveY''.3'9 9$. 	Q	$...%%%@AAAAArG   r9   )r:   r;   r<   r=   rQ   r(   r>   r?   r@   rA   rB   rC   r   rD   rE   
takes_argsr8   rF   rG   r7   rI   rI   O   s         
 IH&H )-.  	tW#JS	2 	2 	2M
 JB B B B B BrG   rI   c                       e Zd ZdZdZdgZdS )!cmd_forest_show_directory_servicezDisplay 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dsheuristicsN)r:   r;   r<   r=   r(   r,   rF   rG   r7   rV   rV   }   s(         
 QH !JJJrG   rV   c                       e Zd ZdZdZdZdS )-cmd_forest_set_directory_service_dsheuristicsay  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).
    rW   rX   N)r:   r;   r<   r=   r(   rQ   rF   rG   r7   rZ   rZ      s%          QHIIIrG   rZ   c                   J    e Zd ZdZi Z e            ed<    e            ed<   dS )cmd_forest_directory_servicez*Forest configuration partition management.showrX   N)r:   r;   r<   r=   subcommandsrV   rZ   rF   rG   r7   r\   r\      sA        44K;;==K"O"O"Q"QKrG   r\   c                   0    e Zd ZdZi Z e            ed<   dS )
cmd_forestzForest management.directory_serviceN)r:   r;   r<   r=   r^   r\   rF   rG   r7   r`   r`      s/        K'C'C'E'EK#$$$rG   r`   )r*   samba.getoptgetoptr?   
samba.authr   samba.samdbr   samba.netcmdr   r   r   r   r
   rI   rV   rZ   r\   r`   rF   rG   r7   <module>rg      s  & 


       % % % % % %                 -; -; -; -; -;g -; -; -;`)B )B )B )B )BW )B )B )B\" " " " " " " "    N   (R R R R R< R R RF F F F F F F F F FrG   