HEX
Server: LiteSpeed
System: Linux shams.tasjeel.ae 5.14.0-611.5.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Nov 11 08:09:09 EST 2025 x86_64
User: infowars (1469)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: //lib64/python3.9/site-packages/ldap/__pycache__/sasl.cpython-39.opt-1.pyc
a

�.d�@s~dZddlmZdZdZdZdZdZ	dZ
d	ZGd
d�d�ZGdd
�d
e�Z
Gdd�de�ZGdd�de�ZGdd�de�ZdS)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__i@i@i@i@i@i@i@c@s eZdZdZdd�Zdd�ZdS)�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
    cCs(|pi|_t|t�s|�d�}||_dS)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)�selfrr	�r�//usr/lib64/python3.9/site-packages/ldap/sasl.py�__init__)s


z
sasl.__init__cCs*|j�||�pd}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.
        �r)r�get�_trace_level�_trace_file�reprrrr)r
Zcb_idZ	challenge�promptZ	defresultZ	cb_resultrrr�callback5s


z
sasl.callbackN)�__name__�
__module__�__qualname__�__doc__r
rrrrrr src@seZdZdZddd�ZdS)�cram_md5z:
    This class handles SASL CRAM-MD5 authentication.
    rcCs"t|t|t|i}t�||d�dS)NzCRAM-MD5��CB_AUTHNAME�CB_PASS�CB_USERrr
�r
Zauthc_id�password�authz_idZ	auth_dictrrrr
_s
�zcram_md5.__init__N)r�rrrrr
rrrrrZsrc@seZdZdZddd�ZdS)�
digest_md5z<
    This class handles SASL DIGEST-MD5 authentication.
    rcCs"t|t|t|i}t�||d�dS)Nz
DIGEST-MD5rrrrrr
ms
�zdigest_md5.__init__N)rr!rrrrr"hsr"c@seZdZdZddd�ZdS)�gssapizJ
    This class handles SASL GSSAPI (i.e. Kerberos V) authentication.
    rcCst�|t|id�dS)NZGSSAPI�rr
r�r
r rrrr
{szgssapi.__init__N)rr!rrrrr#vsr#c@seZdZdZddd�ZdS)�externalz]
    This class handles SASL EXTERNAL authentication
    (i.e. X.509 client certificate)
    rcCst�|t|id�dS)NZEXTERNALr$r%rrrr
�szexternal.__init__N)rr!rrrrr&sr&N)rZldaprrrrrZCB_LANGUAGErZ
CB_ECHOPROMPTZCB_NOECHOPROMPTZCB_GETREALMrrr"r#r&rrrr�<module>s: