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: //lib64/python3.6/site-packages/ldap/__pycache__/dn.cpython-36.opt-1.pyc
3

�`a��@sddZddlZddlmZddlZddlZdd�Zddd�Zdd	�Z	ddd�Z
dd
d�Zddd�ZdS)zs
dn.py - misc stuff for handling distinguished names (see RFC 4514)

See https://www.python-ldap.org/ for details.
�N)�__version__cCs�|r�|jdd�}|jdd�}|jdd�}|jdd�}|jd	d
�}|jdd�}|jd
d�}|jdd�}|jdd�}|ddkr�dj|dd�df�}|ddks�|ddkr�djd|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�#���r)�replace�join)�s�r�/usr/lib64/python3.6/dn.py�escape_dn_charssrcCs>|sgStjddkr*t|t�r*|jd�}tjjdtj	||�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)
  r�zutf-8N)
�sys�version_info�
isinstanceZunicode�encode�ldapZ	functionsZ_ldap_function_call�_ldap�str2dn)�dn�flagsrrrr's
	
rcCsdjdd�|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|]}djdd�|D���qS)rcSs(g|] \}}}dj|t|pd�f��qS)r
r)rr)�.0�atype�avalue�dummyrrr�
<listcomp>?sz%dn2str.<locals>.<listcomp>.<listcomp>)r)r!�rdnrrrr%>szdn2str.<locals>.<listcomp>)r)rrrr�dn2str7sr'FcCsb|sgSt||�}g}xF|D]>}|r@|jdjdd�|D���q|jdjdd�|D���qW|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)r)r!r"r#r$rrrr%Sszexplode_dn.<locals>.<listcomp>cSs(g|] \}}}dj|t|pd�f��qS)r
r)rr)r!r"r#r$rrrr%Xs)r�appendr)r�notypesr Z	dn_decompZrdn_listr&rrr�
explode_dnDs

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�qS)rr)r!r"r#r$rrrr%kszexplode_rdn.<locals>.<listcomp>cSs(g|] \}}}dj|t|pd�f��qS)r
r)rr)r!r"r#r$rrrr%msN)r)r&r)r Z
rdn_decomprrr�explode_rdn^s	r+cCs,yt||�Wntk
r"dSXdSdS)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)rr rrr�is_dnps
r-)r)Fr)Fr)r)
�__doc__rZldap.pkginforrZldap.functionsrrrr'r*r+r-rrrr�<module>s