Implementation of LDAPControls
michael at stroeder.com
Tue Feb 22 09:57:05 CET 2005
Deepak Giridharagopal wrote:
> My approach has been to model the OpenLDAP LDAPControl struct as a
> (OID <string>, Criticality Flag <boolean>, Value <string/list of bytes>)
I'd prefer to have a dedicated class hierachy for this in a separate
sub-module ldap.controls. I will provide something for it which is
compatible with your modifications to LDAPObject.c.
> The "Value" field needs to be an ASN.1 encoded list of bytes.
> # Here's where I actually construct the payload. The payload for this
> # AD control needs to be an ASN.1 sequence with a single int inside.
> payload = asn1.Sequence()
> # Ta da, here is the control
> control = ( oid, criticality, payload.encode() )
I think we could move the invocation of .encode() for all controls in a
list into the wrapper classldap.ldapobject.LDAPObject. Together with a
well-defined control class possible type conflicts would clash early in
the Python wrapper code. This makes debugging easier.
More information about the python-ldap