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__/functions.cpython-36.pyc
3

�`aR
�
@s�dZddlmZddddddd	d
ddg
Zdd
lZdd
lZdd
lZdd
lZdd
lZddlm	Z	ddlm
Z
ddlmZm
Z
ddlmZdd
lZdZdd�Zdejd
d
d
fdd�Zdd�Zdd	�Zdd
�Zdd�Zdd�Zd
S)z_
functions.py - wraps functions of module _ldap

See https://www.python-ldap.org/ for details.
�)�__version__�open�
initializeZinit�
explode_dn�explode_rdn�
get_option�
set_option�
escape_str�	strf_secs�	strp_secsN)�timegm)�	LDAPError)rr)�
LDAPObjectTcOs�|r|j�tjdkrTtjjdd|jtj||f�f�tjdkrTtj	tj
tjd�y"z|||�}Wd|rr|j�XWnFtk
r�}z*dr�tjdkr�tjjd	t
|���WYdd}~XnXdr�tjdkr�tjjd
tj|��|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
*** %s.%s %s
�_ldap�	)�limit�fileNT�z=> LDAPError: %s
z=> result:
%s
)�acquire�ldapZ_trace_levelZ_trace_file�write�__name__�pprintZpformat�	traceback�print_stackZ_trace_stack_limit�releaser
�str)�lock�func�args�kwargs�result�e�r$�!/usr/lib64/python3.6/functions.py�_ldap_function_call"s(	

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``.
  �fileno)r)ZuriZtrace_levelZ
trace_fileZtrace_stack_limitZ
bytes_moder'r!r$r$r%rDscCstdtj|�S)zJ
  get_option(name) -> value

  Get the value of an LDAP global option.
  N)r&rr)�optionr$r$r%rdscCstdtj||�S)zH
  set_option(name, value)

  Set the value of an LDAP global option.
  N)r&rr)r(Zinvaluer$r$r%rmscs|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>{szescape_str.<locals>.<genexpr>)�tuple)r+�sr r$)r+r%r	vscCstjdtj|��S)zZ
    Convert seconds since epoch to a string compliant to LDAP syntax GeneralizedTime
    z
%Y%m%d%H%M%SZ)�timeZstrftimeZgmtime)Zsecsr$r$r%r
~scCsttj|d��S)zD
    Convert LDAP syntax GeneralizedTime to seconds since epoch
    z
%Y%m%d%H%M%SZ)rr/Zstrptime)Zdt_strr$r$r%r�s)�__doc__rr�__all__�sysrr/rZcalendarrr
Zldap.dnrrZldap.ldapobjectrrZ_LDAP_WARN_SKIP_FRAMEr&�stdoutrrrr	r
rr$r$r$r%�<module>s*(#