
    ?Dew                        d Z ddlZddlZddlmZmZmZmZ ddlm	Z	 ddl
mZmZ  G d de          Z G d d	e          Z G d
 de          Z G d de          Zeeej        <    G d de          Zeeej        <    G d de          Z G d de          Z G d de          Zeeej        <    G d de          ZdS )zr
ldap.controls.simple - classes for some very simple LDAP controls

See https://www.python-ldap.org/ for details.
    N)RequestControlResponseControlLDAPControlKNOWN_RESPONSE_CONTROLS)univ)encoderdecoderc                        e Zd ZdZddZd ZdS )ValueLessRequestControla!  
  Base class for controls without a controlValue.
  The presence of the control in a LDAPv3 request changes the server's
  behaviour when processing the request simply based on the controlType.

  controlType
    OID of the request control
  criticality
    criticality request control
  NFc                 "    || _         || _        d S N)controlTypecriticality)selfr   r   s      /./ldap/controls/simple.py__init__z ValueLessRequestControl.__init__   s    "D"D    c                     d S r    r   s    r   encodeControlValuez*ValueLessRequestControl.encodeControlValue   s    4r   )NF)__name__
__module____qualname____doc__r   r   r   r   r   r   r      sA        	 	# # # #    r   r   c                   &    e Zd ZdZddZd Zd ZdS )OctetStringIntegerzv
  Base class with controlValue being unsigend integer values

  integerValue
    Integer to be sent as OctetString
  NFc                 0    || _         || _        || _        d S r   )r   r   integerValue)r   r   r   r   s       r   r   zOctetStringInteger.__init__*        "D"D$Dr   c                 6    t          j        d| j                  S )N!Q)structpackr   r   s    r   r   z%OctetStringInteger.encodeControlValue/   s    ;tD-...r   c                 F    t          j        d|          d         | _        d S )Nr"   r   )r#   unpackr   r   encodedControlValues     r   decodeControlValuez%OctetStringInteger.decodeControlValue2   s"    d+>??BDr   )NFNr   r   r   r   r   r   r)   r   r   r   r   r   "   sU         % % % %
/ / /C C C C Cr   r   c                   &    e Zd ZdZddZd Zd ZdS )BooleanControlz
  Base class for simple request controls with boolean control value.

  Constructor argument and class attribute:

  booleanValue
    Boolean (True/False or 1/0) which is the boolean controlValue.
  NFc                 0    || _         || _        || _        d S r   )r   r   booleanValue)r   r   r   r.   s       r   r   zBooleanControl.__init__@   r    r   c                 Z    t          j        | j        t          j                              S N)asn1Spec)r   encoder.   r   Booleanr   s    r   r   z!BooleanControl.encodeControlValueE   s     >$+T\^^DDDDr   c                     t          j        |t          j                              \  }}t	          t          |                    | _        d S r0   )r	   decoder   r3   boolintr.   )r   r(   decodedValue_s       r   r)   z!BooleanControl.decodeControlValueH   s?    ^$7PPPNLS..//Dr   )NFFr*   r   r   r   r,   r,   6   sS         % % % %
E E E0 0 0 0 0r   r,   c                       e Zd ZdZddZdS )ManageDSAITControlz
  Manage DSA IT Control
  Fc                 T    t                               | t          j        d           d S NF)r   )r   r   ldapCONTROL_MANAGEDSAITr   r   s     r   r   zManageDSAITControl.__init__R   s&    $$T$*Bu$UUUUUr   NFr   r   r   r   r   r   r   r   r;   r;   M   s8         V V V V V Vr   r;   c                       e Zd ZdZddZdS )RelaxRulesControlz
  Relax Rules Control
  Fc                 T    t                               | t          j        d           d S r=   )r   r   r>   CONTROL_RELAXr@   s     r   r   zRelaxRulesControl.__init__]   s&    $$T$*<$OOOOOr   NrA   rB   r   r   r   rD   rD   X   s8         P P P P P Pr   rD   c                       e Zd ZdZd ZdS )ProxyAuthzControlz
  Proxy Authorization Control

  authzId
    string containing the authorization ID indicating the identity
    on behalf which the server should process the request
  c                 H    t          j        | t          j        ||           d S r   )r   r   r>   CONTROL_PROXY_AUTHZr   r   authzIds      r   r   zProxyAuthzControl.__init__l   s"    D!9+gNNNNNr   NrB   r   r   r   rH   rH   c   s2         O O O O Or   rH   c                       e Zd ZdZdZd ZdS )#AuthorizationIdentityRequestControlz:
  Authorization Identity Request and Response Controls
  z2.16.840.1.113730.3.4.16c                 H    t                               | | j        |           d S r   )r   r   r   r@   s     r   r   z,AuthorizationIdentityRequestControl.__init__v   s#    $$T$*:;GGGGGr   N)r   r   r   r   r   r   r   r   r   rN   rN   p   s9          ++H H H H Hr   rN   c                       e Zd ZdZdZd ZdS )$AuthorizationIdentityResponseControlz}
  Authorization Identity Request and Response Controls

  Class attributes:

  authzId
    decoded authorization identity
  z2.16.840.1.113730.3.4.15c                     || _         d S r   )rL   r'   s     r   r)   z7AuthorizationIdentityResponseControl.decodeControlValue   s    &DLLLr   N)r   r   r   r   r   r)   r   r   r   rQ   rQ   z   s4          ++' ' ' ' 'r   rQ   c                       e Zd ZdZddZdS )GetEffectiveRightsControlz"
  Get Effective Rights Control
  Nc                 4    t          j        | d||           d S )Nz1.3.6.1.4.1.42.2.27.9.5.2)r   r   rK   s      r   r   z"GetEffectiveRightsControl.__init__   s     D!<[QQQQQr   r   rB   r   r   r   rT   rT      s8         R R R R R Rr   rT   )r   r#   r>   ldap.controlsr   r   r   r   pyasn1.typer   pyasn1.codec.berr   r	   r   r   r,   r;   r?   rD   rF   rH   rN   rQ   r   rT   r   r   r   <module>rY      se            \ \ \ \ \ \ \ \ \ \ \ \       , , , , , , , ,    n   (C C C C C C C C(0 0 0 0 0[ 0 0 0.V V V V V0 V V V 5G 0 1P P P P P/ P P P /@ * +
O 
O 
O 
O 
O 
O 
O 
OH H H H H*A H H H' ' ' ' '? ' ' ' Mq <H IR R R R R R R R R Rr   