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

Valery Kharseko
45 mins ago f82d22de94de20cb44775530e934eb8c26368484
opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/ReplSessionSecurity.java
@@ -267,7 +267,7 @@
   *          The connected socket.
   * @param soTimeout
   *          The socket timeout option to use for the protocol session.
   * @return The new protocol session.
   * @return The new protocol session, or {@code null} if TLS negotiation raised an {@link SSLException}.
   * @throws ConfigException
   *           If the protocol session could not be established due to a
   *           configuration problem.
@@ -278,6 +278,28 @@
  public Session createServerSession(final Socket socket,
      final int soTimeout) throws ConfigException, IOException
  {
    try
    {
      return createServerSessionOrThrow(socket, soTimeout);
    }
    catch (SSLException e)
    {
      // The TLS failure was logged before the socket was closed.
      return null;
    }
  }
  /**
   * Creates a server session and propagates TLS failures to the caller.
   *
   * @param socket the connected socket
   * @param soTimeout the socket read timeout in milliseconds
   * @return the new protocol session
   * @throws ConfigException if the session configuration is invalid
   * @throws IOException if the session cannot be established, including an {@link SSLException} from TLS negotiation
   */
  public Session createServerSessionOrThrow(final Socket socket, final int soTimeout) throws ConfigException, IOException
  {
    boolean hasCompleted = false;
    SSLSocket secureSocket = null;
@@ -307,8 +329,9 @@
      // Force TLS negotiation now.
      secureSocket.startHandshake();
      final Session session = new Session(socket, secureSocket);
      hasCompleted = true;
      return new Session(socket, secureSocket);
      return session;
    }
    catch (final SSLException e)
    {
@@ -316,7 +339,7 @@
      // also how a certificate misconfiguration shows up, so warn the
      // administrator instead of failing silently.
      logHandshakeFailure(socket, e);
      return null;
      throw e;
    }
    finally
    {