Hello,
I'm trying to get the password policy response (password is expiring...,
grace loggin etc.) from OpenLDAP using PHP:
<?php
$address = 'x.x.x.x';
$dn =
'eduPersonPrincipalName=testu...@exam.com,ou=People,ou=Users,dc=exam,dc=com';
$password = 'testuser';
if($link = ldap_connect($address))
{
ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, 3);
$ppolicy_control = array("oid" =>
"1.3.6.1.4.1.42.2.27.8.5.1","iscritical" => true);
if(!ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS,
array($ppolicy_control)))
{
echo "Nepavyko užsetinti SERVER_CONTROLS\n";
}
if(ldap_bind($link, $dn, $password))
{
if($result = ldap_search($link, $dn, '(|(uid=testuser))'))
{
var_dump(ldap_get_entries($link, $result));
$return = ldap_parse_result($link, $result, $errcode,
$matcheddn, $errormsg, $ldapreferrals);
var_dump($return);
var_dump($errcode);
var_dump($matcheddn);
var_dump($errormsg);
var_dump($ldapreferrals);
}
}
else
{
echo 'Bindas nepavyko';
}
}
ldap_unbind($link);
?>
The code above gives me an error: LDAP_Search(): Critical extension is
unavailable.
I managed to solve this problem using C API of OpenLDAP:
http://codeviewer.org/view/code:358c
Is there a way to do the same thing using PHP?
P.S. Would be great to have this functionality in PHP.
------
Regards,
Andrius
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php