KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17
System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64
User : nobody ( 99)
PHP Version : 5.2.17
Disable Function : NONE
Directory :  /proc/21571/root/usr/lib64/python2.4/site-packages/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/21571/root/usr/lib64/python2.4/site-packages/ldif.pyc
mò
»>oCc@sùdZdZdddddddd	gZd
kZd
kZd
kZd
kZd
kZd
kZydk	l
Z
Wn ej
odk
l
Z
nXdZd
Z
ede
ZededZeideƒZdeƒZhdd<dd<dd<Zhdd<dd<dd<ZddddgZhZxeD]Zd
ee<qAWdZeieƒZd„Zd„Zd„Zdfd„ƒYZd
d d!„Z dfd"„ƒYZ!de!fd#„ƒYZ"d	e!fd$„ƒYZ#d
dd%„Z$d
S(&s+
ldif - generate and parse LDIF data (see RFC 2849)
written by Michael Stroeder <michael@stroeder.com>

See http://python-ldap.sourceforge.net for details.

$Id: ldif.py,v 1.38 2005/11/07 11:44:48 stroeder Exp $

Python compability note:
Tested with Python 2.0+, but should work with Python 1.5.2+.
s0.5.3tldif_patterntAttrTypeandValueLDIFt
CreateLDIFt	ParseLDIFt
LDIFWritert
LDIFParsertLDIFRecordListtLDIFCopyN(sStringIOs[\w;.]+(;[\w_-]+)*s(([^,]|\\,)+|".*?")s	[ ]*=[ ]*s
([ ]*,[ ]*s)*[ ]*s^%s$s>^((dn(:|::) %(dn_pattern)s)|(%(attrtype_pattern)s(:|::) .*)$)+tadditdeleteitreplaceitmodifytmodrdns (^(|
|
| |:|<)|[

€-ÿ]+|[ ]+$)cCsD|djodSnti|ƒ}|djo|idƒ|jS(s!
  returns 1 if s is a LDAP DN
  tiiN(tstdn_regextmatchtrmtNonetgroup(RR((t*/usr/lib64/python2.4/site-packages/ldif.pytis_dn;s

cCsti|ƒdj	S(sG
  returns 1 if s has to be base-64 encoded because of special chars
  N(tsafe_string_retsearchRR(R((Rtneeds_base64EscCs%h}x|D]}d||<q
W|S(sN
  return a dictionary with all items of l being the keys of the dictionary
  N(tdtltiR(RRR((Rt	list_dictLscBsMtZdZeddd„Zd„Zd„Zd„Zd„Zd„Z	RS(	sŠ
  Write LDIF entry or change records to file object
  Copy LDIF input to a file output object containing all data retrieved
  via URLs
  iLs
cCsJ||_ttti|pgƒƒ|_||_
||_d|_
dS(s!
    output_file
        file object for output
    base64_attrs
        list of attribute types to be base64-encoded in any case
    cols
        Specifies how many columns a line may have before it's
        folded into many lines.
    line_sep
        String used as line separator
    iN(toutput_filetselft_output_fileRtmaptstringtlowertbase64_attrst
_base64_attrstcolst_colstline_sept	_line_septrecords_written(RRR#R%R'((Rt__init__]s	"		cCsút|ƒ}||ijo'|ii|ƒ|ii|iƒn´|i}|ii|dt	||iƒ!ƒ|ii|iƒxq||joc|iidƒ|ii||t	|||idƒ!ƒ|ii|iƒ||id}q…WdS(s7
    Write string line as one or more folded lines
    it iN(
tlentlinetline_lenRR&RtwriteR(tpostmin(RR-R.R0((Rt_unfoldLDIFLineos	#
+cCs‡|iiti|ƒƒp
t|ƒo;|iti	|ti
ti|ƒddƒgdƒƒn |iti	||gdƒƒdS(sƒ
    Write a single attribute type/value pair

    attr_type
          attribute type
    attr_value
          attribute value
    s
R
s:: s: N(
RR$thas_keyR!R"t	attr_typeRt
attr_valueR2tjoinR
tbase64tencodestring(RR4R5((Rt_unparseAttrTypeandValue„s
);cCsQ|iƒ}|iƒx3|D]+}x"||D]}|i||ƒq/WqWdS(s3
    entry
        dictionary holding an entry
    N(tentrytkeyst
attr_typestsortR4R5RR9(RR:R5R<R4((Rt_unparseEntryRecord™s

c	Cst|dƒ}|djo
d}n!|djo
d}n
td‚|id|ƒx¼|D]´}|djo|\}}n>|djo'|\}}}|it||ƒn
td‚|o%x"|D]}|i||ƒqÌWn|djo|i
id	|iƒq^q^Wd
S(sP
    modlist
        list of additions (2-tuple) or modifications (3-tuple)
    iiRiRsmodlist item of wrong lengtht
changetypes'Subsequent modlist item of wrong lengtht-N(R,tmodlisttmod_lenR?t
ValueErrorRR9tmodtmod_typetmod_valstmod_opt
MOD_OP_STRtmod_valRR/R((	RRARIRERBR?RFRGRD((Rt_unparseChangeRecord¤s,



	

	
cCs|pdSn|id|ƒt|ƒtijo|i|ƒn1t|ƒtijo|i	|ƒn
t
d‚|ii|i
ƒ|id|_dS(sÙ
    dn
          string-representation of distinguished name
    record
          Either a dictionary holding the LDAP entry {attrtype:record}
          or a list with a modify list like for LDAPObject.modify().
    Ntdns*Argument record must be dictionary or listi(trecordRR9RKttypettypestDictTypeR>tListTypeRJRCRR/R(R)(RRKRL((Rtunparse¿s	(
t__name__t
__module__t__doc__RR*R2R9R>RJRQ(((RRVs				iLcCsHtƒ}t|||dƒ}|i||ƒ|i	ƒ}|iƒ|S(sþ
  Create LDIF single formatted record including trailing empty line.
  This is a compability function. Use is deprecated!

  dn
        string-representation of distinguished name
  record
        Either a dictionary holding the LDAP entry {attrtype:record}
        or a list with a modify list like for LDAPObject.modify().
  base64_attrs
        list of attribute types to be base64-encoded in any case
  cols
        Specifies how many columns a line may have before it's
        folded into many lines.
  s
N(tStringIOtfRR#R%tldif_writerRQRKRLtgetvalueRtclose(RKRLR#R%RVRWR((RRÚs	
cBsPtZdZd„Zededd„Zd„Zd„Zd„Zd„Z	RS(	sæ
  Base class for a LDIF parser. Applications should sub-class this
  class and override method handle() to implement something meaningful.

  Public class attributes:
  records_read
        Counter for records processed so far
  cCsQ|p|Sn?|ddjo|d Sn"|ddjo|d Sn|SdS(sI
    Strip trailing line separators from s, but no other whitespaces
    iþÿÿÿs
iÿÿÿÿs
N(R(RR((Rt
_stripLineSepüsis
cCsl||_||_ttti|pgƒƒ|_
ttti|pgƒƒ|_||_d|_dS(s
    Parameters:
    input_file
        File-object to read the LDIF input from
    ignored_attr_types
        Attributes with these attribute type names will be ignored.
    max_entries
        If non-zero specifies the maximum number of entries to be
        read from f.
    process_url_schemes
        List containing strings with URLs schemes to process with urllib.
        An empty list turns off all URL processing and the attribute
        is ignored completely.
    line_sep
        String used as line separator
    iN(t
input_fileRt_input_filetmax_entriest_max_entriesRR R!R"tprocess_url_schemest_process_url_schemestignored_attr_typest_ignored_attr_typesR'R(trecords_read(RR[RaR]R_R'((RR*	s		""	cCsdS(sw
    Process a single content LDIF record. This method should be
    implemented by applications using LDIFParser.
    N((RRKR:((Rthandle(scCsz|i|iƒ}|iiƒ|_xO|ioD|iddjo0||i|idƒ}|iiƒ|_q'W|S(sG
    Unfold several folded lines with trailing space into one line
    iR+iN(RRZt_linet
unfolded_lineR\treadline(RRf((RR2.scCs˜|iƒ}x)|o!|ddjo|iƒ}qW|p|djp
|djodSnyti|dƒ}Wntj
od
SnX|d|!}|||d!}|djot
i||dƒ}n·|djonti
||dƒ}d}|ioCti|ƒ}|ii|dƒoti|ƒiƒ}qOqŽn<|d	jp
|djo
d
}nti||dƒ}||fS(s^
    Parse a single attribute type and value pair from one or
    more lines of LDIF data
    it#s
s
t:is::s:<s:
R
N(NN(NN(RR2RfRR!tindext	colon_posRCR4t
value_specR7tdecodestringR5tstripturlR`turlparsetuR3turllibturlopentreadtlstrip(RRkR5RoR4RqRfRl((Rt_parseAttrTypeandValue9s4"	



!
cCs |iiƒ|_x|ioü|ip|i|ijoÞd
}d
}d
}d
}h}|iƒ\}}x||d
jon|d
joa|djoH|d
jo
td‚nt|ƒptdt|ƒ‚n|}n÷|djo|d
jo
d}nÓ|djoe|d
jo
td‚n|d
jo
td‚nti|ƒptd	t|ƒ‚n|}na|d
joS|iiti|ƒƒo6|i|ƒo||i|ƒqÕ|g||<n|iƒ\}}qpW|o$|i||ƒ|id|_qqWd
S(s1
    Continously read and parse LDIF records
    RKs*Two lines starting with dn: in one record.s8No valid string-representation of distinguished name %s.tversioniR?s/Read changetype: before getting valid dn: line.s2Two lines starting with changetype: in one record.schangetype value %s is invalid.N(RR\RgReR^RcRRwRKR?tmodopR:RvR4R5RCRtreprtvalid_changetype_dictR3RbR!R"tappendRd(RRKRxR?R4RwR5R:((Rtparse^sB(











*(
RRRSRTRZRR*RdR2RvR|(((RRòs	
			%cBs)tZdZeded„Zd„ZRS(sm
  Collect all records of LDIF input into a single list.
  of 2-tuples (dn,entry). It can be a memory hog!
  icCs&ti|||||ƒg|_dS(s€
    See LDIFParser.__init__()

    Additional Parameters:
    all_records
        List instance for storing parsed records
    N(RR*RR[RaR]R_tall_records(RR[RaR]R_((RR*˜scCs|ii||fƒdS(s<
    Append single record to dictionary of all records.
    N(RR}R{RKR:(RRKR:((RRd§s(RRRSRTRR*Rd(((RR’scBs2tZdZedeeddd„Zd„ZRS(sM
  Copy LDIF input to LDIF output containing all data retrieved
  via URLs
  iiLs
c		Cs5ti|||||ƒt||||ƒ|_dS(s=
    See LDIFParser.__init__() and LDIFWriter.__init__()
    N(
RR*RR[RaR]R_RRR#R%R't_output_ldif(	RR[RRaR]R_R#R%R'((RR*´scCs|ii||ƒdS(s2
    Write single LDIF record to output file.
    N(RR~RQRKR:(RRKR:((RRdÀs(RRRSRTRR*Rd(((RR®scCs/t|d|d|ddƒ}|iƒ|iS(s]
  Parse LDIF records read from file.
  This is a compability function. Use is deprecated!
  RaR]R_iN(RRVtignore_attrst
maxentriestldif_parserR|R}(RVRR€R((RRÇs
(%RTt__version__t__all__R!RpRrR7treRNt	cStringIORUtImportErrortattrtype_patterntattrvalue_patterntrdn_patternt
dn_patterntcompileRtvarsRtMOD_OP_INTEGERRHtCHANGE_TYPESRztcRtSAFE_STRING_PATTERNRRRRRRRRRR(RRRŠRRHRƒR7RRrRR„RŽRRR‚R!RRRzRRNRRRRUR‰R‡RpRRRˆ((Rt?s>6
!!	
		
„ 

Anon7 - 2021