php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21643 ldap_search same criteria no results
Submitted: 2003-01-14 18:24 UTC Modified: 2003-01-21 19:00 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: ryanphp at ryanjameson dot com Assigned:
Status: Closed Package: LDAP related
PHP Version: 4.3.0 OS: windows 2000
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:
MUST BE VALID
Solve the problem:
36 - 34 = ?
Subscribe to this entry?

 
 [2003-01-14 18:24 UTC] ryanphp at ryanjameson dot com
Below is a sample of the problem. First is a string of the function call and then the result. Results are not coming back for the extension that came with 4.3.0.


///////// USING EXTENSION FROM 4.2.3
THE QUERY WAS: ldap_search(samecon,'cn=users, dc=IBS, dc=org','name=Susan Lincoln'); 
the result was :[1]
THE QUERY WAS: ldap_search(samecon,'cn=users, dc=IBS, dc=org','name=Bob Johnson');  
the result was :[1]
THE QUERY WAS: ldap_search(samecon,'cn=users, dc=IBS, dc=org','name=Stephen Hyde'); 
the result was :[1]
THE QUERY WAS: ldap_search(samecon,'cn=users, dc=IBS, dc=org','name=Cory Hymn'); 
the result was :[1]
THE QUERY WAS: ldap_search(samecon,'cn=users, dc=IBS, dc=org','name=Stan Kanner'); 
the result was :[1]

///////// USING EXTENSION FROM 4.3.0
THE QUERY WAS: ldap_search(samecon,'cn=users, dc=IBS, dc=org','name=Susan Lincoln'); 
the result was :[]
THE QUERY WAS: ldap_search(samecon,'cn=users, dc=IBS, dc=org','name=Bob Johnson'); 
the result was : []
THE QUERY WAS: ldap_search(samecon,'cn=users, dc=IBS, dc=org','name=Stephen Hyde'); 
the result was :[]
THE QUERY WAS: ldap_search(samecon,'cn=users, dc=IBS, dc=org','name=Cory Hymn'); 
the result was :[]
THE QUERY WAS: ldap_search(samecon,'cn=users, dc=IBS, dc=org','name=Stan Kanner'); 
the result was :[]

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-15 16:00 UTC] sniper@php.net
Are you absolutely sure you updated PHP correctly? All the dlls from the dlls/ folder too?

 [2003-01-15 16:09 UTC] sniper@php.net
And could you come up with a short example script using some
public ldap server so that I can try it myself within Linux?

 [2003-01-16 11:42 UTC] ryanphp at ryanjameson dot com
"Are you absolutely sure you updated PHP correctly? All the dlls from the dlls/ folder too?" - I am positive. I copied the dlls folder to system32 just to check. Same result. 4.3 is completely functional except I have to use the php_ldap.dll file from 4.2.3.

"And could you come up with a short example script using some public ldap server so that I can try it myself within Linux?" - I really can't. The only reason I can't is that our network would go haywire if I set up a temporary Active Directory server.

Is it possible that the changes made cause the search function to look at the criteria differently? Maybe my search string is no longer valid?
 [2003-01-17 21:03 UTC] sniper@php.net
Please don't reply to your own report using 'Add Comment',
use 'Edit Submission' link instead!!!

And yes, it might be possible that your search string is not
valid, please ask on some openldap mailing list.

And I didn't ask for you to make your own ldap server public, but come up with script accessing one of these 
servers:

   http://www.emailman.com/ldap/public.html 


 [2003-01-18 08:18 UTC] ryanphp at ryanjameson dot com
I'm on the edit submission tab but it still says "New Comment" I hope this is the right way to respond to this. Anyway, I will try to build a simple sample on Monday. Thanks!
 [2003-01-19 17:57 UTC] kalowsky@php.net
leaving as feedback until a response comes in...
 [2003-01-20 16:33 UTC] ryanphp at ryanjameson dot com
Ok, I give up. After I actually found one of those servers that worked I couldn't find a single valid attribute to search on. I tried cn, name, ... and other common attribute types. All returned invalid attribute type. So here's a simpler sample of the problem:

<?PHP
$ds=ldap_connect("censored");  
$dn = "cn=censored, ou=censored, dc=ibs, dc=org";
$password = "censored";
$dir = "cn=users, dc=IBS, dc=org";  
$criteria = "'name=Ryan Jameson (USA)'";
if ($ds) { 
    $r=ldap_bind($ds,$dn,$password);    
    $sr=ldap_search($ds,$dir, $criteria);  
    $info = ldap_get_entries($ds, $sr);
    echo count($info) . " records returned.";
}
ldap_close($ds);
?>


PHP 4.2.3 extension returns: 1 records returned.
PHP 4.3.0 extension returns:
Warning: ldap_search(): Search: Bad search filter in R:\WebApps\api\ldapSearcherTest.php on line 9

Warning: ldap_get_entries(): supplied argument is not a valid ldap result resource in R:\WebApps\api\ldapSearcherTest.php on line 10
0 records returned.
 [2003-01-20 16:40 UTC] ryanphp at ryanjameson dot com
Aha... it doesn't like the parens ... also, it seems to not like the single quote. The problem with that is if i don't use the single quotes I get back 2 records. :-\
 [2003-01-20 16:52 UTC] ryanphp at ryanjameson dot com
Sorry, I was counting the wrong thing... the single quotes are not required, but the parens are a problem. Anyway, that seems to be what it boils down to.
 [2003-01-21 13:55 UTC] ryanphp at ryanjameson dot com
Ok, I'll close this. Basically the functionality has been changed a bit, it seems that the new version of php_ldap.dll now requires escape characters on special characters including '(' & ')' ... the old version for win32 did not. It appears that this has been the case on the unix based versions for some time now.
 [2003-01-21 19:00 UTC] sniper@php.net
It's propably due some change in the openldap library version which is used when the win32 binaries are build.
(it now also has sasl support so..)

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 10:01:28 2024 UTC