Hi Julio,
I am glad that you are pursuing to resolve this issue, thanks.
`-Bsymbolic'
When creating a shared library, bind references to global symbols
to the definition within the shared library, if any. Normally, it
is possible for a program linked against a shared library to
override the definition within the shared library. This option is
only meaningful on ELF platforms which support shared libraries.
Taking a clue from the above quote from 'info ld' (on a RedHat 6.2
system), I have built SASL library with '-Wl,-Bsymbolic' flag for
'ld' and rebuilt imap & ldap with no luck.
__
Seva
Julio Sánchez Fernández wrote:
> Seva Adari wrote:
>
> > I guess it is SASL link references to imap and ldap and their own
> > memory management seems to be the reason for the problem.
>
> I have been fighting this on my own without finding a solution. If I
> tell you I am on the OpenLDAP Project my fight will look rather pathetic,
> but I really could not see where the %#%&! problem was.
>
> Until I read your messages. I think your diagnose of the problem is
> right on the mark. Thanks a lot.
>
> > How do I resolve such that SASL goes with either imapd or ldap memroy
> > functions but not both?
>
> The problem seems to be that there is a call in libraries/libldap/cyrus.c
> to sasl_set_alloc that changes all allocation routine pointers to
> OpenLDAP routines. This is done in ldap_int_sasl_init. Usually, this
> is no problem. However, it seems that either cyrus-sasl or pam_ldap
> is unloading the LDAP libraries and, so, those allocator pointers
> become dangling. Or some such.
>
> Now, I don't know what should be done. I seem to remember that
> OpenLDAP changes the allocators because on some platforms not all
> memory is created equal: there are different memory pools and you
> cannot return memory to the wrong pool, nor can you move pointers
> around carelessly. I think NT was one of those cases.
>
> So maybe, ldap_int_sasl_init should remember the old values (but
> how? - there is no sasl_get_alloc!) and restore them at some
> appropriate place such as ldap_int_sasl_close (but the init
> routine is designed to be called multiple times, so it seems
> some housekeeping may be necessary).
>
> Or maybe it should avoid calling sasl_set_alloc in this case, but how
> can libldap know when should it do it? Maybe since this problem
> only appears currently on a handful of Unix systems where memory is
> uniformly allocated, we could remove that call or make it conditionally
> compilable. I did a quick check and removing the sasl_set_alloc call
> seems to fix it and I did not see any adverse effects yet.
>
> I don't know of this is a Cyrus SASL, Cyrus IMAPD or OpenLDAP issue.
> But we should do something about it somewhere :-)
>
> Kurt, should we take this to openldap-devel?
>
> Julio