Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/Ltb/Directory/OpenLDAP.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ public function isLocked($entry, $pwdPolicyConfiguration) : bool {
return true;
}

if ( $this->getLockDate($entry, $pwdPolicyConfiguration)->getTimestamp() > time() ) {
return false;
}

$unlockDate = $this->getUnlockDate($entry, $pwdPolicyConfiguration);

if (!$unlockDate) {
Expand Down
13 changes: 13 additions & 0 deletions tests/Ltb/DirectoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,19 @@ public function test_openldap_islocked_lockout_disabled(): void
$this->assertFalse($isLocked, "Account should not be locked");
}

public function test_openldap_islocked_lockdate_in_future(): void
{
$entry = [
'pwdaccountlockedtime' => [
'count' => 1,
0 => (new DateTime)->modify("+10 days")->format("Ymdhis\Z")
]
];

$isLocked = (new Ltb\Directory\OpenLDAP)->isLocked($entry, array('lockout_duration' => 86400, 'lockout_enabled' => true));
$this->assertFalse($isLocked, "Account should not be locked");
}

public function test_openldap_getlockdate_empty(): void
{
$entry = [
Expand Down