php.net |  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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: weston at itdonline dot net
New email:
PHP Version: OS:

 

 [2000-10-28 04:13 UTC] weston at itdonline dot 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-10-28 06:38 UTC] 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 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] sniper@php.net
Could you also provide a gdb backtrace of this crash??

--Jani
 [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: Thu Mar 28 17:01:29 2024 UTC