"""
controlValue ::= SEQUENCE OF derefRes DerefRes
DerefRes ::= SEQUENCE {
derefAttr AttributeDescription,
derefVal LDAPDN,
attrVals [0] PartialAttributeList OPTIONAL }
PartialAttributeList ::= SEQUENCE OF
partialAttribute PartialAttribute
"""
class DerefRes(univ.Sequence):
componentType = namedtype.NamedTypes(
namedtype.NamedType('derefAttr', AttributeDescription()),
namedtype.NamedType('derefVal', LDAPDN()),
namedtype.OptionalNamedType('attrVals', PartialAttributeList()),
)
class DerefResultControlValue(univ.SequenceOf):
componentType = DerefRes()
....
def decodeControlValue(self,encodedControlValue):
self.entry = {}
#decodedValue,_ =
decoder.decode(encodedControlValue,asn1Spec=DerefResultControlValue())
# Gets the error: TagSet(Tag(tagClass=0, tagFormat=32, tagId=16),
Tag(tagClass=128, tagFormat=32, tagId=0)) not in asn1Spec:
{TagSet(Tag(tagClass=0, tagFormat=32, tagId=16)): PartialAttributeList()}/{}
decodedValue,_ = decoder.decode(encodedControlValue)
print(decodedValue.prettyPrint())
# Pretty print yields
#Sequence: <-- Sequence of
# <no-name>=Sequence: <-- derefRes
# <no-name>=uniqueMember <-- derefAttr
# <no-name>=uid=test,dc=example,dc=com <-- derefVal
# <no-name>=Sequence: <-- attrVals
# <no-name>=uid
# <no-name>=Set:
# <no-name>=test
# For now, while asn1spec is sad, we'll just rely on it being well
formed
# However, this isn't good, as without the asn1spec, we seem to actually
be dropping values ....
for result in decodedValue:
derefAttr, derefVal, _ = result
self.entry[str(derefAttr)] = str(derefVal)
--
389-devel mailing list
389-devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/389-devel