Bug #70465 [Opn->Csd]: Bug in ldap_search() modifies LDAP_OPT_TIMELIMIT/DEREF's values
| From: | mcmic@php.net | Date: | Wed, 09 Sep 2015 09:34:18 +0000 |
| Subject: | Bug #70465 [Opn->Csd]: Bug in ldap_search() modifies LDAP_OPT_TIMELIMIT/DEREF's values | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-195901@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70465&edit=1
ID: 70465
Updated by: mcmic@php.net
Reported by: tandre at ifwe dot co
Summary: Bug in ldap_search() modifies
LDAP_OPT_TIMELIMIT/DEREF's values
-Status: Open
+Status: Closed
Type: Bug
Package: LDAP related
Operating System: All
PHP Version: 5.5.29
-Assigned To:
+Assigned To: mcmic
Block user comment: N
Private report: N
New Comment:
The fix for this bug has been committed.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
For Windows:
http://windows.php.net/snapshots/
Thank you for the report, and for helping us make PHP better.
Fixed in PHP-5.6 and master (see https://github.com/php/php-src/pull/1512 )
Previous Comments:
------------------------------------------------------------------------
[2015-09-09 01:58:30] tandre at ifwe dot co
Description:
------------
LDAP_OPT_TIMELIMIT and LDAP_OPT_DEREF's original values weren't
saved properly because of a bug introduced when copy and pasting.
This lead to the original timeout being changed
when specifying a temporary override (e.g. for ldap_search(..., $timeout))
(Discovered on PHP-5.6.12 on Centos 6.5, using openLDAP libraries)
(Fixed in https://github.com/php/php-src/pull/1512)
(PHP-5.5 and 5.4 are also affected, but a separate patch would be needed for 5.4 because of merge
conflicts)
Test script:
---------------
https://github.com/TysonAndre/php-src/blob/ldap-fix-saving-timeout-and-dereference/ext/ldap/tests/ldap_search_overrides.phpt
It can be simplified to:
$link = ldap_connect($host);
ldap_set_option($link, LDAP_OPT_DEREF, LDAP_DEREF_SEARCHING);
ldap_set_option($link, LDAP_OPT_SIZELIMIT, 123);
ldap_set_option($link, LDAP_OPT_TIMELIMIT, 33);
ldap_search($link, $base, $filter, array(), null, 111, 222, LDAP_DEREF_NEVER);
var_dump(
ldap_get_option($link, LDAP_OPT_DEREF, $option),
$option,
ldap_get_option($link, LDAP_OPT_SIZELIMIT, $option),
$option,
ldap_get_option($link, LDAP_OPT_TIMELIMIT, $option),
$option
);
Expected result:
----------------
After executing ldap_search with overrides, I expect ldap_get_option to return the original values
of LDAP_OPT_TIMELIMIT and LDAP_OPT_DEREF set by ldap_set_option.
Actual result:
--------------
The value of ldap_get_option($link, LDAP_OPT_DEREF, $option) was clobbered by the $sizelimit
override (111)
The value of ldap_get_option($link, LDAP_OPT_TIMELIMIT, $option) was clobbered by the $sizelimit
override (111).
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70465&edit=1