|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7505 ldap_get_entries causes crash
Submitted: 2000-10-28 04:13 UTC Modified: 2000-10-30 11:03 UTC
From: weston at itdonline dot net Assigned:
Status: Closed Package: LDAP related
PHP Version: 4.0.3pl1 OS: Linux 2.2.12
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
41 + 47 = ?
Subscribe to this entry?

 [2000-10-28 04:13 UTC] weston at itdonline dot net
This script crashes Apache/1.3.12 with OpenLDAP 2.0.6:


$binddn = "uid=$PHP_AUTH_USER,ou=People,dc=itdonline,dc=net";
$r=ldap_bind($ds, $binddn, $PHP_AUTH_PW);
  if (!$r) {
    print ldap_error();
  $sr=ldap_search($ds, "ou=People,dc=itdonline,dc=net",
  if (!$sr) {
    print ldap_error();

  $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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2000-10-28 06:38 UTC]
I can not reproduce this with the latest CVS.
Please include your configure line into this bug report.

 [2000-10-28 13:39 UTC] weston at itdonline dot 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 23:09 UTC]
Could you also provide a gdb backtrace of this crash??

 [2000-10-29 02:05 UTC] weston at itdonline dot net
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.
 [2000-10-30 11:03 UTC] weston at itdonline dot net
Ok, I think I figured it out. I had mod_ldap compiled into Apache. I think mod_ldap was statically linked to an older version of OpenLDAP and was causing problems with the LDAP functions in PHP. I removed my modifications to OpenLDAP, recompiled everything, including Apache, and everything seems to be working at the moment. Thanks for your help.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 19 14:01:32 2024 UTC