Commit a9a264cc authored by Côme Chilliet's avatar Côme Chilliet
Browse files

Merge branch '6143-locks-are-kept-forever' into '1.4-dev'

Resolve "Locks are kept forever"

See merge request fusiondirectory/fd!857
Showing with 16 additions and 6 deletions
+16 -6
...@@ -242,13 +242,23 @@ class Lock ...@@ -242,13 +242,23 @@ class Lock
} }
$locks = []; $locks = [];
$sessionLifetime = $config->get_cfg_value('sessionLifetime', 1800);
if ($sessionLifetime > 0) {
$expirationDate = (new DateTime())->sub(new DateInterval('PT'.$sessionLifetime.'S'));
}
while ($attrs = $ldap->fetch()) { while ($attrs = $ldap->fetch()) {
$locks[] = new Lock( $date = LdapGeneralizedTime::fromString($attrs['fdLockTimestamp'][0]);
$attrs['dn'], if (isset($expirationDate) && ($date < $expirationDate)) {
base64_decode($attrs['fdObjectDn'][0]), /* Delete expired locks */
$attrs['fdUserDn'][0], $ldap->rmdir($attrs['dn']);
LdapGeneralizedTime::fromString($attrs['fdLockTimestamp'][0]) } else {
); $locks[] = new Lock(
$attrs['dn'],
base64_decode($attrs['fdObjectDn'][0]),
$attrs['fdUserDn'][0],
$date
);
}
} }
if (!is_array($objects) && (count($locks) > 1)) { if (!is_array($objects) && (count($locks) > 1)) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment