Implementation of LDAPControls

Ingo Steuwer steuwer at univention.de
Wed Feb 23 07:41:30 CET 2005


Am Dienstag, 22. Februar 2005 09:57 schrieb Michael Ströder:
> Deepak Giridharagopal wrote:
> > My approach has been to model the OpenLDAP LDAPControl struct as a
> > tuple:
> >
> > (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()
> > payload.append(0xf)
> >
> > # 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.

This is prepared in our implementation, we would see the BerVal (or "payload") 
as python-class which internaly saves types and values which should be used 
for encoding. But I don't expect that we will implement this in the near 
future...

Regards
Ingo


> Ciao, Michael.
>
>
> 


More information about the python-ldap mailing list