[Date Prev][Date Next] [Chronological] [Thread] [Top]

Segmentation fault in s23_clnt.c when used in a library



Hello,

I've been trying to track a segmentation fault for a couple of days but I'm running out of ideas and need some help or suggestion on how to proceed.

Perhaps this is the wrong forum and if so I apologize. It's also worth mentioning that I don't have any knowledge about the openSSL library source code but I've been working with ldap libraries for quite some time (about 10 years).

What I have is shared object (.so) that is loaded from another program (nothing I have control of) using a public API. My library loads openLDAP (libldap_r and liblber) using dlopen/dlsym. After some initialization code I try to bind to a ldap source (ldaps://ldaphost:636) but I get a segmentation fault in s23_clnt.c at line 159:
else if (s->ctx->info_callback != NULL)

For some reason s->ctx is a null pointer. My first thoughts was that I do something I shouldn't prior to ldap_sasl_bind_s which corrupts the LDAP handle but after days with gdb and valgrind I still can't find anything.

openLDAP version used is 2.4.40 built with openSSL 1.0.1i.

If I copy the ldap code to a test executable it works fine.

Is there anything special to consider when loading the libraries from a shared object?

I understand that it is almost impossible to give me any good answers but since I'm a bit frustrated I hope someone can give me some hints.

Best regards,
Tobias