mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Valery Kharseko
16 hours ago 75205ab3995546d54288fcaa1a1fa8e88d9c4526
[#697] Fix global idle-time-limit having no effect on client connections (#684)
2 files modified
21 ■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/server/core/CoreConfigManager.java 4 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/core/IdleTimeLimitTestCase.java 17 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/CoreConfigManager.java
@@ -13,6 +13,7 @@
 *
 * Copyright 2006-2010 Sun Microsystems, Inc.
 * Portions Copyright 2011-2016 ForgeRock AS.
 * Portions Copyright 2026 3A Systems, LLC
 */
package org.opends.server.core;
@@ -212,6 +213,9 @@
    core.disabledPrivileges = convert(globalConfig.getDisabledPrivilege());
    core.returnBindErrorMessages = globalConfig.isReturnBindErrorMessages();
    core.idleTimeLimit = globalConfig.getIdleTimeLimit();
    // New client connections snapshot the limit from DirectoryServer at accept
    // time (see ClientConnection), so the global value must be pushed there too.
    DirectoryServer.setIdleTimeLimit(globalConfig.getIdleTimeLimit());
    core.saveConfigOnSuccessfulStartup = globalConfig.isSaveConfigOnSuccessfulStartup();
    core.useNanoTime= globalConfig.getEtimeResolution() == GlobalCfgDefn.EtimeResolution.NANOSECONDS;
opendj-server-legacy/src/test/java/org/opends/server/core/IdleTimeLimitTestCase.java
@@ -13,11 +13,13 @@
 *
 * Copyright 2008 Sun Microsystems, Inc.
 * Portions Copyright 2011-2016 ForgeRock AS.
 * Portions Copyright 2026 3A Systems, LLC
 */
package org.opends.server.core;
import static org.testng.Assert.*;
import java.io.EOFException;
import java.io.IOException;
import org.opends.server.TestCaseUtils;
@@ -51,7 +53,7 @@
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Test(groups="slow")
  @Test
  public void testServerWideAnonymousIdleTimeLimit()
         throws Exception
  {
@@ -78,7 +80,7 @@
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Test(groups="slow")
  @Test
  public void testServerWideAuthenticatedIdleTimeLimit()
         throws Exception
  {
@@ -123,7 +125,7 @@
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Test(groups="slow")
  @Test
  public void testUserSpecificIdleTimeLimit()
         throws Exception
  {
@@ -156,6 +158,13 @@
    ExtendedResponseProtocolOp extendedResponse = conn.readMessage().getExtendedResponseProtocolOp();
    assertEquals(extendedResponse.getOID(), LDAPConstants.OID_NOTICE_OF_DISCONNECTION);
    assertNull(conn.readMessage());
    try
    {
      fail("Expected the server to close the connection, but read " + conn.readMessage());
    }
    catch (EOFException expected)
    {
      // The server closed the connection after the notice of disconnection.
    }
  }
}