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: //proc/thread-self/root/lib64/python3.9/site-packages/ldap/__pycache__/functions.cpython-39.pyc
a

�.d

�@s�dZddlmZgd�ZddlZddlZddlZddlZddlZddlm	Z	ddlm
Z
ddlmZm
Z
ddlmZddlZd	d
�Zdejdddfdd�Zd
d�Zdd�Zdd�Zdd�Zdd�ZdS)z_
functions.py - wraps functions of module _ldap

See https://www.python-ldap.org/ for details.
�)�__version__)
�open�
initialize�init�
explode_dn�explode_rdn�
get_option�
set_option�
escape_str�	strf_secs�	strp_secsN)�timegm)�	LDAPError)rr��
LDAPObjectc
Os�|r|��tjdkrTtj�d�d|jt�||f���tjdkrTt	j
tjtjd�z2z||i|��}W|r�|��n|r�|��0WnDt
y�}z,tjdkr�tj�dt|���WYd	}~n
d	}~00tjdkr�tj�d
t�|��|S)z�
  Wrapper function which locks and logs calls to function

  lock
      Instance of threading.Lock or compatible
  func
      Function to call with arguments passed in via *args and **kwargs
  �z
*** {}.{} {}
�_ldap�	)�limit�fileT�z=> LDAPError: %s
Nz=> result:
%s
)�acquire�ldapZ_trace_levelZ_trace_file�write�format�__name__�pprintZpformat�	traceback�print_stackZ_trace_stack_limit�releaser�str)�lock�func�args�kwargs�result�e�r'�4/usr/lib64/python3.9/site-packages/ldap/functions.py�_ldap_function_calls.	

�

�

r)cKst|||||fd|i|��S)a�
  Return LDAPObject instance by opening LDAP connection to
  LDAP host specified by LDAP URL

  Parameters:
  uri
        LDAP URL containing at least connection scheme and hostport,
        e.g. ldap://localhost:389
  trace_level
        If non-zero a trace output of LDAP calls is generated.
  trace_file
        File object where to write the trace output to.
        Default is to use stdout.
  bytes_mode
        Whether to enable :ref:`bytes_mode` for backwards compatibility under Py2.
  fileno
        If not None the socket file descriptor is used to connect to an
        LDAP server.

  Additional keyword arguments (such as ``bytes_strictness``) are
  passed to ``LDAPObject``.
  �filenor)ZuriZtrace_levelZ
trace_fileZtrace_stack_limitZ
bytes_moder*r$r'r'r(rAs
���rcCstdtj|�S)zJ
  get_option(name) -> value

  Get the value of an LDAP global option.
  N)r)rr)�optionr'r'r(rasrcCstdtj||�S)zH
  set_option(name, value)

  Set the value of an LDAP global option.
  N)r)rr	)r+Zinvaluer'r'r(r	jsr	cs|t�fdd�|D��S)ze
  Applies escape_func() to all items of `args' and returns a string based
  on format string `s'.
  c3s|]}�|�VqdS)Nr')�.0�v��escape_funcr'r(�	<genexpr>x�zescape_str.<locals>.<genexpr>)�tuple)r/�sr#r'r.r(r
ssr
cCst�dt�|��S)zZ
    Convert seconds since epoch to a string compliant to LDAP syntax GeneralizedTime
    �
%Y%m%d%H%M%SZ)�time�strftime�gmtime)Zsecsr'r'r(r{srcCstt�|d��S)zD
    Convert LDAP syntax GeneralizedTime to seconds since epoch
    r4)r
r5�strptime)Zdt_strr'r'r(r�sr)�__doc__rr�__all__�sysrr5rZcalendarr
rZldap.dnrrZldap.ldapobjectrrr)�stdoutrrr	r
rrr'r'r'r(�<module>s"(#�