Bug #80820 [NEW]: Using ldap_exop_passwd with ppolicy control do not update $ldap resource
| From: | clement dot oudot at worteks dot com | Date: | Tue, 02 Mar 2021 23:00:19 +0000 |
| Subject: | Bug #80820 [NEW]: Using ldap_exop_passwd with ppolicy control do not update $ldap resource | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-232481@lists.php.net to get a copy of this message | ||
From: clement dot oudot at worteks dot com
Operating system: Linux
PHP version: 7.4.15
Package: LDAP related
Bug Type: Bug
Bug description:Using ldap_exop_passwd with ppolicy control do not update $ldap resource
Description:
------------
I tried to use ldap_exop_passwd with password policy (see my code in
test script)
With this code, the $ldap resource is not updated, so error_code is
still the previous one. There is no issue if not ctrls reference is
passed at latest argument.
Test script:
---------------
$ctrls = array();
$exop_passwd = ldap_exop_passwd($ldap, $dn, $oldpassword,
$password, $ctrls);
$error_code = ldap_errno($ldap);
$error_msg = ldap_error($ldap);
error_log("TEST $error_code / $error_msg / $exop_passwd");
if (!$exop_passwd) {
if (isset($ctrls[LDAP_CONTROL_PASSWORDPOLICYRESPONSE]))
{
$value =
$ctrls[LDAP_CONTROL_PASSWORDPOLICYRESPONSE]['value'];
if (isset($value['error'])) {
$ppolicy_error_code = $value['error'];
error_log("LDAP - Ppolicy error code:
$ppolicy_error_code");
}
}
}
Expected result:
----------------
We should have in $error_code the value "19" when password is refused by
LDAP directory when it is too short
Actual result:
--------------
Here is the current log:
[Tue Mar 02 23:47:30.736095 2021] [php7:warn] [pid 14066] [client
127.0.0.1:48158] PHP Warning: ldap_exop_passwd(): Passwd modify
extended operation failed: Password fails quality checking policy (19)
in /usr/local/ssp/lib/functions.inc.php on line 457, referer:
http://ssp.example.com/index.php?action=change
[Tue Mar 02 23:47:30.736195 2021] [php7:notice] [pid 14066] [client
127.0.0.1:48158] TEST 0 / Success / , referer:
http://ssp.example.com/index.php?action=change
[Tue Mar 02 23:47:30.736228 2021] [php7:notice] [pid 14066] [client
127.0.0.1:48158] LDAP - Ppolicy error code: 6, referer:
http://ssp.example.com/index.php?action=change
--
Edit bug report at https://bugs.php.net/bug.php?id=80820&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80820&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80820&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80820&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80820&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80820&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80820&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80820&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80820&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80820&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80820&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80820&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80820&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80820&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80820&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80820&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80820&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80820&r=mysqlcfg