def __init__(self, entry, ava, tag=None): LDAPProtocolRequest.__init__(self) BERSequence.__init__(self, [], tag=tag) assert entry is not None assert ava is not None self.entry = entry self.ava = ava
def __init__(self, baseObject=None, scope=None, derefAliases=None, sizeLimit=None, timeLimit=None, typesOnly=None, filter=None, attributes=None, tag=None): LDAPProtocolRequest.__init__(self) BERSequence.__init__(self, [], tag=tag) if baseObject is not None: self.baseObject = baseObject if scope is not None: self.scope = scope if derefAliases is not None: self.derefAliases = derefAliases if sizeLimit is not None: self.sizeLimit = sizeLimit if timeLimit is not None: self.timeLimit = timeLimit if typesOnly is not None: self.typesOnly = typesOnly if filter is not None: self.filter = filter if attributes is not None: self.attributes = attributes
def __init__(self, objectName, attributes, tag=None): LDAPProtocolResponse.__init__(self) BERSequence.__init__(self, [], tag=tag) assert objectName is not None assert attributes is not None self.objectName = objectName self.attributes = attributes
def __init__(self, value=None, controls=None, id=None, tag=None): BERSequence.__init__(self, value=[], tag=tag) assert value is not None self.id = id if self.id is None: self.id = alloc_ldap_message_id() self.value = value self.controls = controls
def __init__(self, controlType, criticality=None, controlValue=None, id=None, tag=None): BERSequence.__init__(self, value=[], tag=tag) assert controlType is not None self.controlType = controlType self.criticality = criticality self.controlValue = controlValue
def __init__(self, requestName=None, requestValue=None, tag=None): LDAPProtocolRequest.__init__(self) BERSequence.__init__(self, [], tag=tag) assert requestName is not None assert isinstance(requestName, six.string_types) assert requestValue is None or isinstance( requestValue, six.string_types) self.requestName = requestName self.requestValue = requestValue
def __init__(self, resultCode=None, matchedDN=None, errorMessage=None, referral=None, serverSaslCreds=None, tag=None): LDAPProtocolResponse.__init__(self) BERSequence.__init__(self, value=[], tag=tag) assert resultCode is not None self.resultCode = resultCode if matchedDN is None: matchedDN = '' self.matchedDN = matchedDN if errorMessage is None: errorMessage = '' self.errorMessage = errorMessage self.referral = referral self.serverSaslCreds = serverSaslCreds
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)
def __init__(self, version=None, dn=None, auth=None, tag=None, sasl=False): """Constructor for LDAP Bind Request For sasl=False, pass a string password for 'auth' For sasl=True, pass a tuple of (mechanism, credentials) for 'auth'""" LDAPProtocolRequest.__init__(self) BERSequence.__init__(self, [], tag=tag) self.version = version if self.version is None: self.version = 3 self.dn = dn if self.dn is None: self.dn = '' self.auth = auth if self.auth is None: self.auth = '' assert (not sasl) self.sasl = sasl
def __init__(self, object=None, modification=None, tag=None): """ Initialize the object Example usage:: l = LDAPModifyRequest( object='cn=foo,dc=example,dc=com', modification=[ BERSequence([ BEREnumerated(0), BERSequence([ LDAPAttributeDescription('attr1'), BERSet([ LDAPString('value1'), LDAPString('value2'), ]), ]), ]), BERSequence([ BEREnumerated(1), BERSequence([ LDAPAttributeDescription('attr2'), ]), ]), ]) But more likely you just want to say:: mod = delta.ModifyOp('cn=foo,dc=example,dc=com', [delta.Add('attr1', ['value1', 'value2']), delta.Delete('attr1', ['value1', 'value2'])]) l = mod.asLDAP() """ LDAPProtocolRequest.__init__(self) BERSequence.__init__(self, [], tag=tag) self.object = object self.modification = modification
def __init__(self, matchingRule=None, type=None, matchValue=None, dnAttributes=None, tag=None): BERSequence.__init__(self, value=[], tag=tag) assert matchValue is not None if isinstance(matchingRule, six.string_types): matchingRule = LDAPMatchingRuleAssertion_matchingRule(matchingRule) if isinstance(type, six.string_types): type = LDAPMatchingRuleAssertion_type(type) if isinstance(matchValue, six.string_types): matchValue = LDAPMatchingRuleAssertion_matchValue(matchValue) if isinstance(dnAttributes, bool): dnAttributes = LDAPMatchingRuleAssertion_dnAttributes(dnAttributes) self.matchingRule = matchingRule self.type = type self.matchValue = matchValue self.dnAttributes = dnAttributes if not self.dnAttributes: self.dnAttributes = None
def __init__(self, entry, newrdn, deleteoldrdn, newSuperior=None, tag=None): """ Initialize the object Example usage:: l=LDAPModifyDNRequest(entry='cn=foo,dc=example,dc=com', newrdn='someAttr=value', deleteoldrdn=0) """ LDAPProtocolRequest.__init__(self) BERSequence.__init__(self, [], tag=tag) assert entry is not None assert newrdn is not None assert deleteoldrdn is not None self.entry = entry self.newrdn = newrdn self.deleteoldrdn = deleteoldrdn self.newSuperior = newSuperior
def __init__(self, entry=None, attributes=None, tag=None): """ Initialize the object Example usage:: l=LDAPAddRequest(entry='cn=foo,dc=example,dc=com', attributes=[(LDAPAttributeDescription("attrFoo"), BERSet(value=( LDAPAttributeValue("value1"), LDAPAttributeValue("value2"), ))), (LDAPAttributeDescription("attrBar"), BERSet(value=( LDAPAttributeValue("value1"), LDAPAttributeValue("value2"), ))), ]) """ LDAPProtocolRequest.__init__(self) BERSequence.__init__(self, [], tag=tag) self.entry = entry self.attributes = attributes
def __init__(self, type=None, substrings=None, tag=None): BERSequence.__init__(self, value=[], tag=tag) assert type is not None assert substrings is not None self.type = type self.substrings = substrings
def __init__(self, attributeDesc=None, assertionValue=None, tag=None, escaper=escape): BERSequence.__init__(self, value=[], tag=tag) assert attributeDesc is not None self.attributeDesc = attributeDesc self.assertionValue = assertionValue self.escaper = escaper
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()
def toWire(self): return BERSequence([self.attributeDesc, self.assertionValue], tag=self.tag).toWire()
def toWire(self): return BERSequence([ LDAPString(self.type), BERSequence(self.substrings)], tag=self.tag).toWire()
def __str__(self): return str(BERSequence([ LDAPString(self.type), BERSequence(self.substrings)], tag=self.tag))
def toWire(self): return BERSequence([ LDAPString(self.entry), BERSequence(map(BERSequence, self.attributes)), ], tag=self.tag).toWire()
def __str__(self): return str(BERSequence([ LDAPString(self.entry), BERSequence(map(BERSequence, self.attributes)), ], tag=self.tag))
def toWire(self): l = [LDAPString(self.object)] if self.modification is not None: l.append(BERSequence(self.modification)) return BERSequence(l, tag=self.tag).toWire()
def __init__(self, attributeDesc=None, assertionValue=None, tag=None, escaper=escape): BERSequence.__init__(self, value=[], tag=tag) assert attributeDesc is not None self.attributeDesc = attributeDesc self.assertionValue = assertionValue self.escaper = escaper
def __str__(self): l = [LDAPString(self.entry), self.ava] return str(BERSequence(l, tag=self.tag))
def __str__(self): l = [LDAPString(self.object)] if self.modification is not None: l.append(BERSequence(self.modification)) return str(BERSequence(l, tag=self.tag))
def __str__(self): return str(BERSequence( filter(lambda x: x is not None, [self.matchingRule, self.type, self.matchValue, self.dnAttributes]), tag=self.tag))
def toWire(self): l = [LDAPString(self.entry), self.ava] return BERSequence(l, tag=self.tag).toWire()
def toWire(self): return BERSequence( filter(lambda x: x is not None, [self.matchingRule, self.type, self.matchValue, self.dnAttributes]), tag=self.tag).toWire()
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))
def __init__(self, type=None, substrings=None, tag=None): BERSequence.__init__(self, value=[], tag=tag) assert type is not None assert substrings is not None self.type = type self.substrings = substrings
def __str__(self): return str( BERSequence([self.attributeDesc, self.assertionValue], tag=self.tag))
def __init__(self, uris=None, tag=None): LDAPProtocolResponse.__init__(self) BERSequence.__init__(self, value=[], tag=tag) assert uris is not None self.uris = uris