lists.arthurdejong.org
RSS feed

Re: [PATCH] Allocate ldap_conncb on heap

[Date Prev][Date Next] [Thread Prev][Thread Next]

Re: [PATCH] Allocate ldap_conncb on heap



On Sat, Aug 27, 2011 at 05:11:52PM +0200, Arthur de Jong wrote:
> 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).
> 

Sure, that works as well. The only reason I malloc()-ed the pointer was
that the cb being a "property of session" seemed more natural to me.

Thanks for the commit!
-- 
To unsubscribe send an email to
nss-pam-ldapd-users-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-users