Bug #64392 [Fbk->NoF]: ldap_search() fails on base64-encoded entries
Edit report at https://bugs.php.net/bug.php?id=64392&edit=1
ID: 64392
Updated by: php-bugs@lists.php.net
Reported by: russ at bluecows dot com
Summary: ldap_search() fails on base64-encoded entries
-Status: Feedback
+Status: No Feedback
Type: Bug
Package: LDAP related
Operating System: Linux
PHP Version: Irrelevant
Private report: N
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2013-09-30 09:49:31] mike@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php
If you can provide more information, feel free to add it
to this bug and change the status back to "Open".
Thank you for your interest in PHP.
------------------------------------------------------------------------
[2013-03-08 15:53:22] russ at bluecows dot com
Description:
------------
When using the ldap_search() function to query data from an LDAP database, it would appear that
base64-encoded attributes are not decoded before running the search pattern against them.
Based on the code snippets below, if the first search is run, no results are returned, even if a DN
in the search tree has a postalAddress attribute which matches the given search string. If the
second search is run, results are returned, indicating the search can check to see if the attribute
exists at all, but the text-based search string is being checked against a base64-encoded attribute.
It would appear that ldap_get_entries() decodes base64-encoded attributes, because the output of
$entries, when it is not NULL, will show postalAddress as text. In order for ldap_search() to work
properly, it should decode base64-encoded attributes before attempting to run the search against
them.
Test script:
---------------
Failed test:
$search = ldap_search( $ldapHandle, $ldapBaseDn, "(postaladdress=*165 Main*)" );
$entries = ldap_get_entries( $ldapHandle, $search );
Successful test:
$search = ldap_search( $ldapHandle, $ldapBaseDn, "(postaladdress=*)" );
$entries = ldap_get_entries( $ldapHandle, $search );
Expected result:
----------------
In the failed test example, I would expect $entries to contain a list of LDAP DNs and associated
attributes where the postalAddress attribute matches the search parameter. Currently, it does not.
Searches against non-base64-encoded attributes such as mail or telephoneNumber work as expected.
Actual result:
--------------
When the failed test example is run, $entries is empty because no matches are returned from the
ldap_search().
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=64392&edit=1
Thread (3 messages)