Re: [PATCH] Allocate ldap_conncb on heap
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
Re: [PATCH] Allocate ldap_conncb on heap
- From: Arthur de Jong <arthur [at] arthurdejong.org>
- To: nss-pam-ldapd-users [at] lists.arthurdejong.org
- Subject: Re: [PATCH] Allocate ldap_conncb on heap
- Date: Sat, 27 Aug 2011 17:11:52 +0200
On Fri, 2011-08-26 at 20:49 +0200, Jakub Hrozek wrote:
> ldap_set_option does not do a deep-copy of the "invalue" parameter,
> it just copies the pointer when LDAP_OPT_CONNECT_CB is used. But the
> "struct ldap_conncb" variable was allocated on the stack which resulted
> in openldap's ll_data pointer to point to garbage and nslcd crashed.
>
> The attached patch allocates struct ldap_conncb on the heap as a struct
> ldap_session member.
I prefer to make struct ldap_conncb cb static. That should also solve
the problem. Committed here:
http://arthurdejong.org/viewvc/nss-pam-ldapd?view=rev&revision=1522
This means that the structure is now shared between all connections (the
API suggests that this shouldn't be a problem).
Another alternative would be to set the option globally (set ld to NULL
with ldap_set_option()), however, that doesn't always seem to work for
all options.
Thanks for finding and reporting this.
--
-- arthur - arthur@arthurdejong.org - http://arthurdejong.org --
--
To unsubscribe send an email to
nss-pam-ldapd-users-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-users