Segfault in LDAPerror() when errnum is out of bounds

Michael Ströder michael at stroeder.com
Fri Mar 20 21:38:53 CET 2009


Sean,

many thanks for digging through this. Does that mean your issues with
syncrepl controls and l_ldap_result3() are fixed?

Any particular reason why you're using python-ldap 2.3.1 which is almost
two years old?

Sean Burford wrote:
> When LDAPError receives an errnum from ldap_get_option(l,
> LDAP_OPT_ERROR_NUMBER, &errnum) that is out of bounds it causes a
> segfault.  I have attached a script that triggers it and patch that
> fixes it.

So after applying your patch I get this generic LDAPError exception
below. This is definitely more robust.

ldap.LDAPError: {'info': 'sync cookie is stale', 'desc': 'Content Sync
Refresh Required'}

Anyway I'd see some benefit adding also the syncrepl error codes to let
the application catch specific exceptions. Unfortunately errobjects in
Modules/errors.c is a simple array. Bumping up LDAP_ERROR_MAX to
LDAP_SYNC_REFRESH_REQUIRED would be pretty naively waste a lot of space.

Ciao, Michael.




More information about the python-ldap mailing list