PHP 4.0 Bug #7505 Updated: ldap_get_entries causes crash
| From: | weston at itdonline dot net | Date: | Sun, 29 Oct 2000 07:05:10 +0000 |
| Subject: | PHP 4.0 Bug #7505 Updated: ldap_get_entries causes crash | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-36333@lists.php.net to get a copy of this message | ||
ID: 7505
User Update by: weston@itdonline.net
Status: Feedback
Bug Type: LDAP related
Description: ldap_get_entries causes crash
I'm not quite sure how to go about getting a correct backtrace, but I believe that the problem
is occurring in getattr.c from OpenLDAP-2.0.6.
It looks like this:
assert( LDAP_VALID( ld ) );
For some reason, this assert fails and causes the Apache process to exit.
It may not be the correct thing to do, but I commented out that line and recompiled OpenLDAP. After
I did that, everything works again. I didn't figure it would make a huge difference, since
LDAP_VALID expands to a comparison of ld->ld_options.ldo_valid with the constant,
LDAP_VALID_SESSION (0x2). I'm guessing that somewhere along the line, this flag isn't
being set properly.
Previous Comments:
---------------------------------------------------------------------------
[2000-10-28 23:09:04] sniper@php.net
Could you also provide a gdb backtrace of this crash??
--Jani
---------------------------------------------------------------------------
[2000-10-28 13:39:46] weston@itdonline.net
Here's the way I ran configure:
./configure --with-apxs=/usr/local/apache/bin/apxs --enable-calendar
--with-gdbm --enable-dbase --with-gd --with-imap --with-ldap
--with-mysql=/usr/local/ --enable-memory-limit
--with-mcal=/usr/local/mcal --with-readline --with-gettext
---------------------------------------------------------------------------
[2000-10-28 06:38:27] sniper@php.net
I can not reproduce this with the latest CVS.
Please include your configure line into this bug report.
--Jani
---------------------------------------------------------------------------
[2000-10-28 04:13:29] weston@itdonline.net
This script crashes Apache/1.3.12 with OpenLDAP 2.0.6:
$PHP_AUTH_USER = <REMOVED>;
$PHP_AUTH_PW = <REMOVED>;
$ds=ldap_connect("localhost");
$binddn = "uid=$PHP_AUTH_USER,ou=People,dc=itdonline,dc=net";
$r=ldap_bind($ds, $binddn, $PHP_AUTH_PW);
if (!$r) {
print ldap_error();
exit();
}
$sr=ldap_search($ds, "ou=People,dc=itdonline,dc=net",
"uid=$PHP_AUTH_USER");
if (!$sr) {
print ldap_error();
exit();
}
$entries = ldap_get_entries($ds, $sr);
?>
In the error log I get:
httpd: getattr.c:36: ldap_first_attribute: Assertion `( ( ld )->ld_options.ldo_valid == 0x2
)' failed.
[Fri Oct 27 15:51:38 2000] [notice] child pid 27065 exit signal Aborted (6)
The ldap_bind() and the ldap_search() complete successfully, but ldap_get_entries() causes the crash
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=7505