LDAP core dump followup
| From: | Rasmus Lerdorf | Date: | Thu, 01 Jan 1970 00:00:00 +0000 |
| Subject: | LDAP core dump followup | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-62@lists.php.net to get a copy of this message | ||
Hrm..
I am not extremely familiar with the LDAP API, but we have something that
doesn't look quite right here. The le_result_entry list type has no
destructor.
php3_ldap_module.le_result = register_list_destructors(_free_ldap_result, NULL);
php3_ldap_module.le_result_entry = register_list_destructors(NULL, NULL);
Yet, there is an user-level ldap_free_entry() function which ends up
calling ldap_msgfree() in the LDAP API. If I call ldap_free_entry() on an
entry and then call ldap_free_result() on the result this entry came from,
then I get the core dump I posted before. If I leave out the
ldap_free_result() call from my script, then I of course just get the core
dump at the end of the script when the destructor for the result list is
called.
It seems to me that a result_entry element either should not be freed or
we are freeing it the wrong way. Looking through RFC 1823 I don't see any
indication that an entry should be freed. A result pointer needs to be
freed and that is documented in the RFC.
I have applied the following change:
RCS file: /repository/php3/functions/ldap.c,v
retrieving revision 1.50
diff -r1.50 ldap.c
815c815
< _free_ldap_result(ldap_result_entry);
---
> /* _free_ldap_result(ldap_result_entry); We shouldn't do this -RL
*/
Please correct me if I am wrong on this.
And if this is the correct patch, should we not remove the
ldap_free_entry() function completely? I don't see what purpose it
serves.
-Rasmus
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net