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__/asyncsearch.cpython-39.opt-1.pyc
a

�.d��@s�dZddlZddlmZddlZejejejhZejejhZGdd�de	�Z
Gdd�d�ZGdd	�d	e�ZGd
d�de�Z
Gdd
�d
e
�ZGdd�de�ZGdd�de�ZdS)zg
ldap.asyncsearch - handle async LDAP search operations

See https://www.python-ldap.org/ for details.
�N)�__version__c@seZdZdd�Zdd�ZdS)�WrongResultTypecCs||_||_t�|�dS�N)�receivedResultType�expectedResultTypes�	Exception�__init__)�selfrr�r
�6/usr/lib64/python3.9/site-packages/ldap/asyncsearch.pyrszWrongResultType.__init__cCsd�|jd�|j��S)Nz3Received wrong result type {} (expected one of {}).z, )�formatr�joinr�r	r
r
r�__str__ s
�zWrongResultType.__str__N)�__name__�
__module__�__qualname__rrr
r
r
rrsrc@sLeZdZdZdd�Zddd�Zd	d
�Zdd�Zd
d�Zddd�Z	dd�Z
dS)�AsyncSearchHandlerz`
  Class for stream-processing LDAP search results

  Arguments:

  l
    LDAPObject instance
  cCs||_d|_d|_dS)N�)�_l�_msgId�_afterFirstResult�r	�lr
r
rr1szAsyncSearchHandler.__init__Nr���c

Cs(|j�|||||||	||�	|_d|_dS)a�
    searchRoot
        See parameter base of method LDAPObject.search()
    searchScope
        See parameter scope of method LDAPObject.search()
    filterStr
        See parameter filter of method LDAPObject.search()
    attrList=None
        See parameter attrlist of method LDAPObject.search()
    attrsOnly
        See parameter attrsonly of method LDAPObject.search()
    timeout
        Maximum time the server shall use for search operation
    sizelimit
        Maximum number of entries a server should return
        (request client-side limit)
    serverctrls
        list of server-side LDAP controls
    clientctrls
        list of client-side LDAP controls
    rN)rZ
search_extrr)
r	Z
searchRootZsearchScopeZ	filterStrZattrListZ	attrsOnly�timeoutZ	sizelimitZserverctrlsZclientctrlsr
r
r�startSearch6s!�zAsyncSearchHandler.startSearchcCsdS)zd
    Do anything you want after starting search but
    before receiving and processing results
    Nr
rr
r
r�
preProcessing^sz AsyncSearchHandler.preProcessingcCsdS)zh
    Do anything you want right after successfully receiving but before
    processing first result
    Nr
rr
r
r�afterFirstResultdsz#AsyncSearchHandler.afterFirstResultcCsdS)zI
    Do anything you want after receiving and processing all results
    Nr
rr
r
r�postProcessingjsz!AsyncSearchHandler.postProcessingc
	Cs>|��d}||}d}d}d|_||_z�d\}}	|r�|durr|	sr|j�|jd|�\}}	}
}|jr6|��d|_q6|	sxq�|tvr�t	|t��|	D]L}||kr�|jd|_n*|dks�||kr�|�
||�nd}d}q�|d}q�d\}}	||_q2W|�r2|jdk�r2|j�|j�n"|�r0|jdk�r0|j�|j�0|��|S)a1
    ignoreResultsNumber
        Don't process the first ignoreResultsNumber results.
    processResultsCount
        If non-zero this parameters indicates the number of results
        processed is limited to processResultsCount.
    timeout
        See parameter timeout of ldap.LDAPObject.result()
    rr)NNN)
rZbeginResultsDroppedZendResultBreakrZresult3rrr�SEARCH_RESULT_TYPESr�_processSingleResultZabandonr)
r	ZignoreResultsNumberZprocessResultsCountrZresult_counterZend_result_counterZgo_ahead�partialZresult_typeZresult_listZresult_msgidZresult_serverctrlsZresult_itemr
r
r�processResultsosH



�z!AsyncSearchHandler.processResultscCsdS)zv
    Process single entry

    resultType
        result type
    resultItem
        Single item of a result list
    Nr
�r	�
resultType�
resultItemr
r
rr!�s	z'AsyncSearchHandler._processSingleResult)NrrrNN)rrr)rrr�__doc__rrrrrr#r!r
r
r
rr's	
�
(
0rc@s eZdZdZdd�Zdd�ZdS)�Listz�
  Class for collecting all search results.

  This does not seem to make sense in the first place but think
  of retrieving exactly a certain portion of the available search
  results.
  cCst�||�g|_dSr)rr�
allResultsrr
r
rr�sz
List.__init__cCs|j�||f�dSr)r)�appendr$r
r
rr!�szList._processSingleResultN�rrrr'rr!r
r
r
rr(�sr(c@s eZdZdZdd�Zdd�ZdS)�DictzJ
  Class for collecting all search results into a dictionary {dn:entry}
  cCst�||�i|_dSr)rr�
allEntriesrr
r
rr�sz
Dict.__init__cCs|tvr|\}}||j|<dSr)�ENTRY_RESULT_TYPESr-�r	r%r&�dn�entryr
r
rr!�szDict._processSingleResultNr+r
r
r
rr,�sr,c@s"eZdZdZddd�Zdd�ZdS)�IndexedDictz�
  Class for collecting all search results into a dictionary {dn:entry}
  and maintain case-sensitive equality indexes to entries
  NcCs*t�||�|pd|_i�|ji�|_dS)Nr
)r,r�
indexed_attrs�fromkeys�index)r	rr3r
r
rr�s
zIndexedDict.__init__c
Cs||tvrx|\}}||j|<|jD]V}||vr ||D]@}z|j||�|�Wq4tyr|g|j||<Yq40q4q dSr)r.r-r3r5r*�KeyError)r	r%r&r0r1�a�vr
r
rr!�s

z IndexedDict._processSingleResult)Nr+r
r
r
rr2�s
r2c@s*eZdZdZd
dd�Zdd�Zdd�Zd	S)�
FileWriterz�
  Class for writing a stream of LDAP search results to a file object

  Arguments:
  l
    LDAPObject instance
  f
    File object instance where the LDIF data is written to
  �cCs"t�||�||_||_||_dSr)rr�_f�	headerStr�	footerStr)r	r�fr<r=r
r
rr�szFileWriter.__init__cCs|j�|j�dS)zs
    The headerStr is written to output after starting search but
    before receiving and processing results.
    N)r;�writer<rr
r
rr�szFileWriter.preProcessingcCs|j�|j�dS)zX
    The footerStr is written to output after receiving and
    processing results.
    N)r;r?r=rr
r
rr�szFileWriter.postProcessingN)r:r:)rrrr'rrrr
r
r
rr9�s

r9c@s"eZdZdZddd�Zdd�ZdS)	�
LDIFWriterz�
  Class for writing a stream LDAP search results to a LDIF file

  Arguments:

  l
    LDAPObject instance
  writer_obj
    Either a file-like object or a ldif.LDIFWriter instance used for output
  r:cCs:t|tj�r||_nt�|�|_t�|||jj||�dSr)�
isinstance�ldifr@�_ldif_writerr9rZ_output_file)r	rZ
writer_objr<r=r
r
rrszLDIFWriter.__init__cCs"|tvr|\}}|j�||�dSr)r.rCZunparser/r
r
rr!szLDIFWriter._processSingleResultN)r:r:r+r
r
r
rr@s
r@)r'ZldaprrBZRES_SEARCH_ENTRYZRES_SEARCH_RESULTZRES_SEARCH_REFERENCEr r.rrrr(r,r2r9r@r
r
r
r�<module>s$��