/**
* Returns the win32 AD epoch number of days the password may be unchanged.
*
* @return integer|boolean Number of days or false if no limit.
*/
protected function _getMaxPasswd()
{
$dn = Horde_Ldap_Util::explodeDN($this->_params['basedn']);
$domaindn = array();
foreach ($dn as $rdn) {
$attribute = Horde_Ldap_Util::splitAttributeString($rdn);
if ($attribute[0] == 'DC') {
$domaindn[] = $rdn;
}
}
$dn = Horde_Ldap_Util::canonicalDN($domaindn);
$search = $this->_ldap->search($domaindn, 'objectClass=*');
$entry = $search->shiftEntry();
try {
return $entry->getValue('maxPwdAge', 'single');
} catch (Horde_Ldap_Exception $e) {
return false;
}
}