HEX
Server: LiteSpeed
System: Linux s1049.use1.mysecurecloudhost.com 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: xedaptot (3356)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: //proc/self/root/lib64/python3.6/site-packages/ldap/__pycache__/asyncsearch.cpython-36.pyc
3

�`a��@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||_||_tj|�dS)N)�receivedResultType�expectedResultTypes�	Exception�__init__)�selfrr�r	�#/usr/lib64/python3.6/asyncsearch.pyrszWrongResultType.__init__cCsd|jdj|j�fS)Nz3Received wrong result type %s (expected one of %s).z, )r�joinr)rr	r	r
�__str__ szWrongResultType.__str__N)�__name__�
__module__�__qualname__rrr	r	r	r
rsrc@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	r
r1szAsyncSearchHandler.__init__Nrrc


Cs(|jj|||||||	||�	|_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)
rZ
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,|j�d}||}d}d}d|_||_z�d\}}	x�|�r�x@|dkrz|	rz|jj|jd|�\}}	}
}|jr<|j�d|_q<W|	s�P|tkr�t	|t��xR|	D]J}||kr�|jd|_n(|dks�||kr�|j
||�n
d}d}P|d}q�Wd\}}	||_q4WWd|�r|jdk�r|jj|j�X|j�|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()
    rrN)NN)NN)
rZbeginResultsDroppedZendResultBreakrZresult3rrr�SEARCH_RESULT_TYPESr�_processSingleResultZabandonr)
rZignoreResultsNumberZprocessResultsCountrZresult_counterZend_result_counterZgo_ahead�partialZresult_typeZresult_listZresult_msgidZresult_serverctrlsZresult_itemr	r	r
�processResultsosD



z!AsyncSearchHandler.processResultscCsdS)zv
    Process single entry

    resultType
        result type
    resultItem
        Single item of a result list
    Nr	)r�
resultType�
resultItemr	r	r
r�s	z'AsyncSearchHandler._processSingleResult���)Nrr!rNNr!)rrr!)r
rr�__doc__rrrrrrrr	r	r	r
r'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.
  cCstj||�g|_dS)N)rr�
allResults)rrr	r	r
r�sz
List.__init__cCs|jj||f�dS)N)r$�append)rrr r	r	r
r�szList._processSingleResultN)r
rrr"rrr	r	r	r
r#�sr#c@s eZdZdZdd�Zdd�ZdS)�DictzJ
  Class for collecting all search results into a dictionary {dn:entry}
  cCstj||�i|_dS)N)rr�
allEntries)rrr	r	r
r�sz
Dict.__init__cCs|tkr|\}}||j|<dS)N)�ENTRY_RESULT_TYPESr')rrr �dn�entryr	r	r
r�szDict._processSingleResultN)r
rrr"rrr	r	r	r
r&�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*tj||�|pf|_ij|ji�|_dS)N)r&r�
indexed_attrs�fromkeys�index)rrr,r	r	r
r�s
zIndexedDict.__init__c
Cs�|tkr�|\}}||j|<xf|jD]\}||kr"xN||D]B}y|j||j|�Wq8tk
rx|g|j||<Yq8Xq8Wq"WdS)N)r(r'r,r.r%�KeyError)rrr r)r*�a�vr	r	r
r�s
z IndexedDict._processSingleResult)N)r
rrr"rrr	r	r	r
r+�s
r+c@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"tj||�||_||_||_dS)N)rr�_f�	headerStr�	footerStr)rr�fr5r6r	r	r
r�szFileWriter.__init__cCs|jj|j�dS)zs
    The headerStr is written to output after starting search but
    before receiving and processing results.
    N)r4�writer5)rr	r	r
r�szFileWriter.preProcessingcCs|jj|j�dS)zX
    The footerStr is written to output after receiving and
    processing results.
    N)r4r8r6)rr	r	r
r�szFileWriter.postProcessingN)r3r3)r
rrr"rrrr	r	r	r
r2�s	
r2c@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
  r3cCs:t|tj�r||_ntj|�|_tj|||jj||�dS)N)�
isinstance�ldifr9�_ldif_writerr2rZ_output_file)rrZ
writer_objr5r6r	r	r
rszLDIFWriter.__init__cCs"|tkr|\}}|jj||�dS)N)r(r<Zunparse)rrr r)r*r	r	r
rszLDIFWriter._processSingleResultN)r3r3)r
rrr"rrr	r	r	r
r9s

r9)r"Zldaprr;ZRES_SEARCH_ENTRYZRES_SEARCH_RESULTZRES_SEARCH_REFERENCErr(rrrr#r&r+r2r9r	r	r	r
�<module>s