Bug #70465 [NEW]: Bug in ldap_search() modifies LDAP_OPT_TIMELIMIT/DEREF's values
| From: | tandre at ifwe dot co | Date: | Wed, 09 Sep 2015 01:58:32 +0000 |
| Subject: | Bug #70465 [NEW]: Bug in ldap_search() modifies LDAP_OPT_TIMELIMIT/DEREF's values | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-195894@lists.php.net to get a copy of this message | ||
From: tandre at ifwe dot co
Operating system: All
PHP version: 5.5.29
Package: LDAP related
Bug Type: Bug
Bug description:Bug in ldap_search() modifies LDAP_OPT_TIMELIMIT/DEREF's values
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 bug report at https://bugs.php.net/bug.php?id=70465&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70465&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70465&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70465&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=70465&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=70465&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=70465&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=70465&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=70465&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=70465&r=support
Expected behavior: https://bugs.php.net/fix.php?id=70465&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=70465&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=70465&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=70465&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70465&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=70465&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=70465&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=70465&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=70465&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=70465&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=70465&r=mysqlcfg