please review encode_assertion_control()

Michael Ströder michael at stroeder.com
Fri Mar 4 14:37:09 CET 2011


Michael Ströder wrote:
> Rich Megginson wrote:
>> On 03/03/2011 01:28 PM, Michael Ströder wrote:
>>> Could somebody please look what's wrong with
>>> encode_assertion_control() in
>>> Modules/ldapcontrol.c? It seg faults.
>>     err =
>> ldap_create_assertion_control_value(NULL,assertion_filterstr,&ctrl_val);
>> The NULL should be an LDAP* and it must be valid.
>>
>> It needs the LDAP* handle because it calls ldap_alloc_ber_with_options()
>> to allocate the BER for the control value.
> 
> Thanks for the hint. But how can I create a LDAP* handle locally without
> having to pass in the connection object as argument?

Seems calling ldap_create() did the trick:

$ python -c "import ldap;print
repr(ldap.encode_assertion_control('(objectClass=*)'))"
'\x87\x0bobjectClass'

Not sure whether error checking is correct though.

Ciao, Michael.


More information about the python-ldap mailing list