
    qZh                         d Z ddlmZ 	 ddlmZmZ dZdZdZdZd	Z	d
Z
dZ G d d          Z G d de          Z G d de          Z G d de          Z G d de          ZdS )a  
sasl.py - support for SASL mechanism

See https://www.python-ldap.org/ for details.

Description:
The ldap.sasl module provides SASL authentication classes.
Each class provides support for one SASL mechanism. This is done by
implementing a callback() - method, which will be called by the
LDAPObject's sasl_bind_s() method
Implementing support for new sasl mechanism is very easy --- see
the examples of digest_md5 and gssapi.
    )__version__T)_trace_level_trace_filei@  i@  i@  i@  i@  i@  i@  c                       e Zd ZdZd Zd ZdS )sasla  
    This class handles SASL interactions for authentication.
    If an instance of this class is passed to ldap's sasl_bind_s()
    method, the library will call its callback() method. For
    specific SASL authentication mechanisms, this method can be
    overridden
    c                 z    |pi | _         t          |t                    s|                    d          }|| _        dS )a  
        The (generic) base class takes a cb_value_dictionary of
        question-answer pairs. Questions are specified by the respective
        SASL callback id's. The mech argument is a string that specifies
        the SASL mechaninsm to be uesd.
        utf-8N)cb_value_dict
isinstancebytesencodemech)selfr
   r   s      U/var/www/lab.imftr.de/alumni/alumnizer_venv/lib/python3.11/site-packages/ldap/sasl.py__init__zsasl.__init__)   s?     +0b$&& 	(;;w''D			    c                 H   | j                             ||          pd}	 t          dk    rNt          j        d|||t          |          t          | j                             |                    fz             t          |t                    s|                    d          }|S )a  
        The callback method will be called by the sasl_bind_s()
        method several times. Each time it will provide the id, which
        tells us what kind of information is requested (the CB_*
        constants above). The challenge might be a short (English) text
        or some binary string, from which the return value is calculated.
        The prompt argument is always a human-readable description string;
        The defresult is a default value provided by the sasl library

        Currently, we do not use the challenge and prompt information, and
        return only information which is stored in the self.cb_value_dict
        cb_value_dictionary. Note that the current callback interface is not very
        useful for writing generic sasl GUIs, which would need to know all
        the questions to ask, before the answers are returned to the sasl
        lib (in contrast to one question at a time).

        Unicode strings are always converted to bytes.
         T   z7*** id=%d, challenge=%s, prompt=%s, defresult=%s
-> %s
r	   )	r
   getr   r   writereprr   r   r   )r   cb_id	challengeprompt	defresult	cb_results         r   callbackzsasl.callback5   s    , &**5)<<B		q  !"]OO+//	::;;a #    )U++ 	2!((11Ir   N)__name__
__module____qualname____doc__r   r    r   r   r   r       s<         
 
 
" " " " "r   r   c                       e Zd ZdZddZdS )cram_md5z:
    This class handles SASL CRAM-MD5 authentication.
    r   c                 l    t           |t          |t          |i}t                              | |d           d S )NzCRAM-MD5CB_AUTHNAMECB_PASSCB_USERr   r   r   authc_idpasswordauthz_id	auth_dicts        r   r   zcram_md5.__init___   s6    XX
	
 	dIz22222r   Nr   r   r    r!   r"   r   r#   r   r   r%   r%   Z   s2         3 3 3 3 3 3r   r%   c                       e Zd ZdZddZdS )
digest_md5z<
    This class handles SASL DIGEST-MD5 authentication.
    r   c                 l    t           |t          |t          |i}t                              | |d           d S )Nz
DIGEST-MD5r'   r+   s        r   r   zdigest_md5.__init__m   s6    XX
	
 	dI|44444r   Nr0   r1   r#   r   r   r3   r3   h   s2         5 5 5 5 5 5r   r3   c                       e Zd ZdZddZdS )gssapizJ
    This class handles SASL GSSAPI (i.e. Kerberos V) authentication.
    r   c                 L    t                               | t          |id           d S )NGSSAPIr   r   r*   r   r.   s     r   r   zgssapi.__init__{   s#    dWh/:::::r   Nr0   r1   r#   r   r   r6   r6   v   s2         ; ; ; ; ; ;r   r6   c                       e Zd ZdZddZdS )externalz]
    This class handles SASL EXTERNAL authentication
    (i.e. X.509 client certificate)
    r   c                 L    t                               | t          |id           d S )NEXTERNALr9   r:   s     r   r   zexternal.__init__   s#    dWh/<<<<<r   Nr0   r1   r#   r   r   r<   r<      s2         
= = = = = =r   r<   N)r"   ldapr   r   r   r*   r(   CB_LANGUAGEr)   CB_ECHOPROMPTCB_NOECHOPROMPTCB_GETREALMr   r%   r3   r6   r<   r#   r   r   <module>rD      s@         /........ 
7 7 7 7 7 7 7 7t3 3 3 3 3t 3 3 35 5 5 5 5 5 5 5; ; ; ; ;T ; ; ;= = = = =t = = = = =r   