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

�.d(�@s\dZddlmZddlZddlZdd�Zddd�Zdd	�Zddd�Z	dd
d�Z
ddd�ZdS)zs
dn.py - misc stuff for handling distinguished names (see RFC 4514)

See https://www.python-ldap.org/ for details.
�)�__version__NcCs�|r�|�dd�}|�dd�}|�dd�}|�dd�}|�d	d
�}|�dd�}|�d
d�}|�dd�}|�dd�}|ddkr�d�|dd�df�}|ddks�|ddkr�d�d|f�}|S)za
  Escape all DN special characters found in s
  with a back-slash (see RFC 4514, section 2.4)
  �\z\\�,z\,�+z\+�"z\"�<z\<�>z\>�;z\;�=z\=�z\���� �Nz\ r�#)�replace�join)�s�r�-/usr/lib64/python3.9/site-packages/ldap/dn.py�escape_dn_charssrcCs|sgStj�dtj||�S)z�
  This function takes a DN as string as parameter and returns
  a decomposed DN. It's the inverse to dn2str().

  flags describes the format of the dn

  See also the OpenLDAP man-page ldap_str2dn(3)
  N)�ldapZ	functionsZ_ldap_function_call�_ldap�str2dn)�dn�flagsrrrr%s	rcCsd�dd�|D��S)z�
  This function takes a decomposed DN as parameter and returns
  a single string. It's the inverse to str2dn() but will always
  return a DN in LDAPv3 format compliant to RFC 4514.
  rcSs g|]}d�dd�|D���qS)rcSs(g|] \}}}d�|t|pd�f��qS�r
r�rr��.0ZatypeZavalueZdummyrrr�
<listcomp>:s�z%dn2str.<locals>.<listcomp>.<listcomp>�r)r�rdnrrrr9s�
�zdn2str.<locals>.<listcomp>r )rrrr�dn2str3s
�r"FcCs^|sgSt||�}g}|D]>}|r>|�d�dd�|D���q|�d�dd�|D���q|S)a
  explode_dn(dn [, notypes=False [, flags=0]]) -> list

  This function takes a DN and breaks it up into its component parts.
  The notypes parameter is used to specify that only the component's
  attribute values be returned and not the attribute types.
  rcSsg|]\}}}t|pd��qS�r)rrrrrrNs�zexplode_dn.<locals>.<listcomp>cSs(g|] \}}}d�|t|pd�f��qSrrrrrrrSs�)r�appendr)r�notypesrZ	dn_decompZrdn_listr!rrr�
explode_dn@s
��r&cCs:|sgSt||�d}|r(dd�|D�Sdd�|D�SdS)a
  explode_rdn(rdn [, notypes=0 [, flags=0]]) -> list

  This function takes a RDN and breaks it up into its component parts
  if it is a multi-valued RDN.
  The notypes parameter is used to specify that only the component's
  attribute values be returned and not the attribute types.
  rcSsg|]\}}}|pd�qSr#rrrrrrg�zexplode_rdn.<locals>.<listcomp>cSs(g|] \}}}d�|t|pd�f��qSrrrrrrrir'N)r)r!r%rZ
rdn_decomprrr�explode_rdnZs	r(cCs,zt||�Wnty"YdS0dSdS)z}
  Returns True if `s' can be parsed by ldap.dn.str2dn() as a
  distinguished host_name (DN), otherwise False is returned.
  FTN)r�	Exception)rrrrr�is_dnls
r*)r)Fr)Fr)r)�__doc__Zldap.pkginforrZldap.functionsrrrr"r&r(r*rrrr�<module>s