Ńņ /čźJc@sšdZdZdddddddd gZd d kZd d kZd d kZd d kZd d kZyd d kl Z Wn#e j od d k l Z nXd Z dZ e de Z e de dZeideƒZdeƒZhdd6dd6dd6Zhdd6dd6dd6ZddddgZhZxeD]Zd ee^((dn(:|::) %(dn_pattern)s)|(%(attrtype_pattern)s(:|::) .*)$)+itadditdeleteitreplacetmodifytmodrdncCsA|djodSti|ƒ}|djo|idƒ|jS(s! returns 1 if s is a LDAP DN tiiN(tdn_regextmatchtNonetgroup(tstrm((s*/usr/lib64/python2.6/site-packages/ldif.pytis_dn7s s (^(| | | |:|<)|[ €-’]+|[ ]+$)cCs+tg}|D]}||dfq~ƒS(sN return a dictionary with all items of l being the keys of the dictionary N(tdictR(tlt_[1]ti((s*/usr/lib64/python2.6/site-packages/ldif.pyt list_dictDscBsVeZdZd ddd„Zd„Zd„Zd„Zd„Zd„Z d „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 cCs_||_tg}|pgD]}||iƒq~ƒ|_||_||_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(t _output_fileRtlowert _base64_attrst_colst _line_septrecords_written(tselft output_filet base64_attrstcolstline_sepRta((s*/usr/lib64/python2.6/site-packages/ldif.pyt__init__Rs 7  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(tlenRRtwriteRtmin(R!tlinetline_lentpos((s*/usr/lib64/python2.6/site-packages/ldif.pyt_unfoldLDIFLineds  # +cCs,|ii|iƒƒpti|ƒdj S(s† returns 1 if attr_value has to be base-64 encoded because of special chars or because attr_type is in self._base64_attrs N(Rthas_keyRtsafe_string_retsearchR(R!t attr_typet attr_value((s*/usr/lib64/python2.6/site-packages/ldif.pyt_needs_base64_encodingyscCsh|i||ƒo5|idi|ti|ƒiddƒgƒƒn|idi||gƒƒdS(sƒ Write a single attribute type/value pair attr_type attribute type attr_value attribute value s:: s Rs: N(R5R/tjointbase64t encodestringR (R!R3R4((s*/usr/lib64/python2.6/site-packages/ldif.pyt_unparseAttrTypeandValues 5cCsQ|iƒ}|iƒx3|D]+}x"||D]}|i||ƒq/WqWdS(s3 entry dictionary holding an entry N(tkeystsortR9(R!tentryt attr_typesR3R4((s*/usr/lib64/python2.6/site-packages/ldif.pyt_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|iid |iƒq^q^Wd S( sP modlist list of additions (2-tuple) or modifications (3-tuple) iiR iR smodlist item of wrong lengtht changetypes'Subsequent modlist item of wrong lengtht-N(R)t ValueErrorR9t MOD_OP_STRRR*R( R!tmodlisttmod_lenR?tmodtmod_typetmod_valstmod_optmod_val((s*/usr/lib64/python2.6/site-packages/ldif.pyt_unparseChangeRecordœs*         cCs”|pdS|id|ƒt|tiƒo|i|ƒn.t|tiƒo|i|ƒn td‚|ii |i ƒ|i d|_ 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( R9t isinstancettypestDictTypeR>tListTypeRJRARR*RR (R!RKtrecord((s*/usr/lib64/python2.6/site-packages/ldif.pytunparse·s N( t__name__t __module__t__doc__RR'R/R5R9R>RJRQ(((s*/usr/lib64/python2.6/site-packages/ldif.pyRKs    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 (RRRQtgetvaluetclose(RKRPR#R$tft ldif_writerR((s*/usr/lib64/python2.6/site-packages/ldif.pyRŅs    cBsPeZdZd„Zd dd dd„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 cCs<|ddjo |d S|ddjo |d S|SdS(sI Strip trailing line separators from s, but no other whitespaces iž’’’s i’’’’s N((R!R((s*/usr/lib64/python2.6/site-packages/ldif.pyt _stripLineSepōs   is c Cs–||_||_tg}|pgD]}||iƒq'~ƒ|_tg}|pgD]} || iƒq^~ƒ|_||_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_filet _max_entriesRRt_process_url_schemest_ignored_attr_typesRt records_read( R!t input_filetignored_attr_typest max_entriestprocess_url_schemesR%RRt_[2]R&((s*/usr/lib64/python2.6/site-packages/ldif.pyR'’s   77 cCsdS(sw Process a single content LDIF record. This method should be implemented by applications using LDIFParser. N((R!RKR<((s*/usr/lib64/python2.6/site-packages/ldif.pythandlescCs‰|i|iƒg}|iiƒ|_xR|ioG|iddjo3|i|i|idƒƒ|iiƒ|_q*Wdi|ƒS(sG Unfold several folded lines with trailing space into one line iR(iR(RYt_lineRZtreadlinetappendR6(R!tunfolded_lines((s*/usr/lib64/python2.6/site-packages/ldif.pyR/$sc Cs‰|iƒ}x)|o!|ddjo|iƒ}qW| p|djp |djod Sy|idƒ}Wntj od SX|d|!}|||d!}|djoti||dƒ}n±|djok||diƒ}d }|ioCti|ƒ}|ii |dƒot i |ƒi ƒ}qCqn9|d jp |djo d }n||di ƒ}||fS(s^ Parse a single attribute type and value pair from one or more lines of LDIF data it#s s t:is::s: sJ  <   ‡ž