php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49404 LDAP search crashes if key not matched
Submitted: 2009-08-28 22:09 UTC Modified: 2009-08-30 19:24 UTC
From: doctor_nett at yahoo dot com Assigned:
Status: Not a bug Package: LDAP related
PHP Version: 5.3.0 OS: linux
Private report: No CVE-ID: None
 [2009-08-28 22:09 UTC] doctor_nett at yahoo dot com
Description:
------------
i am using php, with ldap to search records form active director on linux(webserver)
it work fines if i type uid that exsist in active directory, but if i type some uid that does not exsist in the active directory php script crashes.
note: sorry if i am posting this in wrong place,
but the same code works fine on my windows xp(webserver) system with ADAM ADSI

Reproduce code:
---------------
$chrUid = "mazhar.hassan"; #works fine
$chrUid = "maz.hass"; #crashes the system
$sr=ldap_search($ds, $LDAP_DN, "(uid=$chrUid)");

Expected result:
----------------
it should return nothing, as its doing on my XP system environment, so that i can display a message record not found

Actual result:
--------------
system crashes and have to restart.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-08-28 22:18 UTC] felipe@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.


 [2009-08-29 18:58 UTC] doctor_nett at yahoo dot com
thanks for quick reply i will try to get backtrace of it, thanks
 [2009-08-30 18:12 UTC] doctor_nett at yahoo dot com
Hi,

I have got the solution, infact the LADP uid search was not getting stuck, but it was the displayName, which i used to search for user name, so the code part that was getting stuck was

#$chrName = "Mazhar Hassan"; #works fine, coz exsist in active directory
$chrUid = "M Mazhar"; #crashes the system, not exsist in the active director
$sr=ldap_search($ds, $LDAP_DN, "(displayName=$chrName)");

i have tried few other tools to search it on my linux environment, and similar kind of stuck thing was happing with those tools as well,
then i realized that there no displayName field in active directory of my production environment, instead there is sxdisplayName, but on my XP system environment its displayName,
sorry for mis understanding. as soon as i changed that to sxdisplayName it now works fine, if record not matches it gracefully return the control.

now here is a question, why displayName was working for the the user name that exsist in active directory and getting stuck for those who do not exsist in active dirctory.

i hope so i made my point clear.
in short its not php fault, coz other tools also get stuck.
 [2009-08-30 18:19 UTC] doctor_nett at yahoo dot com
thanks :)
let me rephrase it by code

CASE 1: [Matching field displayName]
#$chrName = "Mazhar Hassan"; #works fine,coz exsist in AD
$chrName = "M Hassan"; #crashes the system, not exsist in the AD
$sr=ldap_search($ds, $LDAP_DN, "(displayName=$chrName)");
Note: on my production environment i cant find displayName Field

CASE 2:[Matching field sxdisplayName]
#$chrName = "Mazhar Hassan"; #works fine,coz exsist in AD
$chrName = "M Hassan"; #Also works fine, but not exsist in the AD
$sr=ldap_search($ds, $LDAP_DN, "(sxdisplayName=$chrName)");

Expected:
i think that case1 must stuck for both user exsist in AD or not, but for one it give result and for other it get stuck, moreover i this displayName field doesnot exsist in AD.

can any one please help me in this.

Thanks in Advance
 [2009-08-30 19:24 UTC] jani@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 01 16:01:31 2024 UTC