1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 """LDAP protocol message conversion; no application logic here."""
18
19 from pureber import *
20
21 next_ldap_message_id=1
27
29 s = s.replace('\\', r'\5c')
30 s = s.replace('*', r'\2a')
31 s = s.replace('(', r'\28')
32 s = s.replace(')', r'\29')
33 s = s.replace('\0', r'\00')
34 return s
35
38
41
43 id = None
44 value = None
45
46 - def fromBER(klass, tag, content, berdecoder=None):
68 fromBER = classmethod(fromBER)
69
70 - def __init__(self, value=None, controls=None, id=None, tag=None):
78
84
86 l=[]
87 l.append('id=%r' % self.id)
88 l.append('value=%r' % self.value)
89 if self.tag!=self.__class__.tag:
90 l.append('tag=%d' % self.tag)
91 return self.__class__.__name__+'('+', '.join(l)+')'
92
96
98 raise NotImplementedError
99
103
106
111
113 tag=CLASS_APPLICATION|0x00
114
115 - def fromBER(klass, tag, content, berdecoder=None):
125 fromBER = classmethod(fromBER)
126
127 - def __init__(self, version=None, dn=None, auth=None, tag=None):
139
146
148 l=[]
149 l.append('version=%d' % self.version)
150 l.append('dn=%s' % repr(self.dn))
151 l.append('auth=%s' % repr(self.auth))
152 if self.tag!=self.__class__.tag:
153 l.append('tag=%d' % self.tag)
154 return self.__class__.__name__+'('+', '.join(l)+')'
155
156
157
160
161 -class LDAPResult(LDAPProtocolResponse, BERSequence):
162 - def fromBER(klass, tag, content, berdecoder=None):
179 fromBER = classmethod(fromBER)
180
181 - def __init__(self, resultCode=None, matchedDN=None, errorMessage=None, referral=None, serverSaslCreds=None, tag=None):
194
203
216
221
226
276
287
290
292 - def fromBER(klass, tag, content, berdecoder=None):
300 fromBER = classmethod(fromBER)
301
302 - def __init__(self, attributeDesc=None, assertionValue=None, tag=None):
303 BERSequence.__init__(self, value=[], tag=tag)
304 assert attributeDesc is not None
305 self.attributeDesc=attributeDesc
306 self.assertionValue=assertionValue
307
309 return str(BERSequence([self.attributeDesc,
310 self.assertionValue],
311 tag=self.tag))
312
314 if self.tag==self.__class__.tag:
315 return self.__class__.__name__+"(attributeDesc=%s, assertionValue=%s)"\
316 %(repr(self.attributeDesc), repr(self.assertionValue))
317 else:
318 return self.__class__.__name__+"(attributeDesc=%s, assertionValue=%s, tag=%d)"\
319 %(repr(self.attributeDesc), repr(self.assertionValue), self.tag)
320
321
325
332
338
344
378
385
391
392
398
404
411
413 tag = CLASS_CONTEXT|0x04
414
415 - def fromBER(klass, tag, content, berdecoder=None):
424 fromBER = classmethod(fromBER)
425
426 - def __init__(self, type=None, substrings=None, tag=None):
432
437
439 if self.tag==self.__class__.tag:
440 return self.__class__.__name__\
441 +"(type=%s, substrings=%s)"\
442 %(repr(self.type), repr(self.substrings))
443 else:
444 return self.__class__.__name__\
445 +"(type=%s, substrings=%s, tag=%d)"\
446 %(repr(self.type), repr(self.substrings), self.tag)
447
449 initial=None
450 final=None
451 any=[]
452
453 for s in self.substrings:
454 assert s is not None
455 if isinstance(s, LDAPFilter_substrings_initial):
456 assert initial is None
457 assert not any
458 assert final is None
459 initial=s.asText()
460 elif isinstance(s, LDAPFilter_substrings_final):
461 assert final is None
462 final=s.asText()
463 elif isinstance(s, LDAPFilter_substrings_any):
464 assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert final is None
465 any.append(s.asText())
466 else:
467 raise NotImple assert