Exemplo n.º 1
0
 def __str__(self):
     assert self.referral is None  # TODO
     return str(BERSequence([
         BEREnumerated(self.resultCode),
         BEROctetString(self.matchedDN),
         BEROctetString(self.errorMessage),
         #TODO referral [3] Referral OPTIONAL
         ], tag=self.tag))
Exemplo n.º 2
0
 def __str__(self):
     return str(BERSequence([
         BEROctetString(self.objectName),
         BERSequence([
             BERSequence([
                 BEROctetString(attr_li[0]),
                 BERSet(list(map(BEROctetString, attr_li[1])))])
             for attr_li in self.attributes
             ]),
     ], tag=self.tag))
Exemplo n.º 3
0
 def toWire(self):
     return BERSequence([
         BEROctetString(self.objectName),
         BERSequence([
             BERSequence([
                 BEROctetString(attr_li[0]),
                 BERSet([BEROctetString(x) for x in attr_li[1]])
             ]) for attr_li in self.attributes
         ]),
     ],
                        tag=self.tag).toWire()
Exemplo n.º 4
0
 def __str__(self):
     if not self.sasl:
         auth_ber = BEROctetString(self.auth, tag=CLASS_CONTEXT | 0)
     else:
         auth_ber = BERSequence([BEROctetString(self.auth[0]), BEROctetString(self.auth[1])],
                                tag=CLASS_CONTEXT | 3)
     return str(BERSequence([
         BERInteger(self.version),
         BEROctetString(self.dn),
         auth_ber,
         ], tag=self.tag))
Exemplo n.º 5
0
 def __str__(self):
     assert self.referral is None  # TODO
     l = [BEREnumerated(self.resultCode),
          BEROctetString(self.matchedDN),
          BEROctetString(self.errorMessage),
          # TODO referral [3] Referral OPTIONAL
          ]
     if self.responseName is not None:
         l.append(LDAPOID(self.responseName, tag=CLASS_CONTEXT | 0x0a))
     if self.response is not None:
         l.append(BEROctetString(self.response, tag=CLASS_CONTEXT | 0x0b))
     return str(BERSequence(l, tag=self.tag))
Exemplo n.º 6
0
 def __str__(self):
     self.data = [LDAPOID(self.controlType)]
     if self.criticality is not None:
         self.data.append(BERBoolean(self.criticality))
     if self.controlValue is not None:
         self.data.append(BEROctetString(self.controlValue))
     return BERSequence.__str__(self)
Exemplo n.º 7
0
 def __str__(self):
     return str(BERSequence([
         BEROctetString(self.baseObject),
         BEREnumerated(self.scope),
         BEREnumerated(self.derefAliases),
         BERInteger(self.sizeLimit),
         BERInteger(self.timeLimit),
         BERBoolean(self.typesOnly),
         self.filter,
         BERSequenceOf(map(BEROctetString, self.attributes)),
         ], tag=self.tag))
Exemplo n.º 8
0
 def __str__(self):
     l = [LDAPOID(self.requestName, tag=CLASS_CONTEXT | 0)]
     if self.requestValue is not None:
         l.append(
             BEROctetString(str(self.requestValue), tag=CLASS_CONTEXT | 1))
     return str(BERSequence(l, tag=self.tag))
Exemplo n.º 9
0
 def toWire(self):
     l = [LDAPOID(self.requestName, tag=CLASS_CONTEXT | 0)]
     if self.requestValue is not None:
         value = to_bytes(self.requestValue)
         l.append(BEROctetString(value, tag=CLASS_CONTEXT | 1))
     return BERSequence(l, tag=self.tag).toWire()