You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by lg...@apache.org on 2019/12/05 17:44:35 UTC

[mina-sshd] 05/09: Moved current cipher/MAC/compression information getters from Session to SessionContext

This is an automated email from the ASF dual-hosted git repository.

lgoldstein pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mina-sshd.git

commit 6211fc3a0a26ed48612bbd57906a8a72ac0b9045
Author: Lyor Goldstein <lg...@apache.org>
AuthorDate: Thu Nov 28 20:29:49 2019 +0200

    Moved current cipher/MAC/compression information getters from Session to SessionContext
---
 CHANGES.md                                         |  2 ++
 .../apache/sshd/common/session/SessionContext.java | 33 ++++++++++++++++++++++
 .../org/apache/sshd/common/session/Session.java    | 33 ----------------------
 3 files changed, 35 insertions(+), 33 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index 2d4c669..340d885 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -71,6 +71,8 @@ the message type=30 (old request).
 
 * Client side `UserAuthKeyboardInteractive` allows configurable detection of plain-text password prompt.
 
+* Moved a few informative getters from `Session` to `SessionContext`.
+
 ## Behavioral changes and enhancements
 
 * [SSHD-926](https://issues.apache.org/jira/browse/SSHD-930) - Add support for OpenSSH 'lsetstat@openssh.com' SFTP protocol extension.
diff --git a/sshd-common/src/main/java/org/apache/sshd/common/session/SessionContext.java b/sshd-common/src/main/java/org/apache/sshd/common/session/SessionContext.java
index e73e4b5..d6b257d 100644
--- a/sshd-common/src/main/java/org/apache/sshd/common/session/SessionContext.java
+++ b/sshd-common/src/main/java/org/apache/sshd/common/session/SessionContext.java
@@ -25,8 +25,11 @@ import org.apache.sshd.common.AttributeStore;
 import org.apache.sshd.common.Closeable;
 import org.apache.sshd.common.auth.UsernameHolder;
 import org.apache.sshd.common.cipher.BuiltinCiphers;
+import org.apache.sshd.common.cipher.CipherInformation;
+import org.apache.sshd.common.compression.CompressionInformation;
 import org.apache.sshd.common.kex.KexProposalOption;
 import org.apache.sshd.common.kex.KexState;
+import org.apache.sshd.common.mac.MacInformation;
 import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.net.ConnectionEndpointsIndicator;
 
@@ -123,6 +126,36 @@ public interface SessionContext
     String getNegotiatedKexParameter(KexProposalOption paramType);
 
     /**
+     * Retrieves current cipher information - <B>Note:</B> may change if
+     * key re-exchange executed
+     *
+     * @param incoming If {@code true} then the cipher for the incoming data,
+     * otherwise for the outgoing data
+     * @return The {@link CipherInformation} - or {@code null} if not negotiated yet.
+     */
+    CipherInformation getCipherInformation(boolean incoming);
+
+    /**
+     * Retrieves current compression information - <B>Note:</B> may change if
+     * key re-exchange executed
+     *
+     * @param incoming If {@code true} then the compression for the incoming data,
+     * otherwise for the outgoing data
+     * @return The {@link CompressionInformation} - or {@code null} if not negotiated yet.
+     */
+    CompressionInformation getCompressionInformation(boolean incoming);
+
+    /**
+     * Retrieves current MAC information - <B>Note:</B> may change if
+     * key re-exchange executed
+     *
+     * @param incoming If {@code true} then the MAC for the incoming data,
+     * otherwise for the outgoing data
+     * @return The {@link MacInformation} - or {@code null} if not negotiated yet.
+     */
+    MacInformation getMacInformation(boolean incoming);
+
+    /**
      * @return {@code true} if session has successfully completed the authentication phase
      */
     boolean isAuthenticated();
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/session/Session.java b/sshd-core/src/main/java/org/apache/sshd/common/session/Session.java
index dc6c00c..a9d59d4 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/session/Session.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/session/Session.java
@@ -30,8 +30,6 @@ import org.apache.sshd.common.Service;
 import org.apache.sshd.common.auth.MutableUserHolder;
 import org.apache.sshd.common.channel.ChannelListenerManager;
 import org.apache.sshd.common.channel.throttle.ChannelStreamPacketWriterResolverManager;
-import org.apache.sshd.common.cipher.CipherInformation;
-import org.apache.sshd.common.compression.CompressionInformation;
 import org.apache.sshd.common.forward.PortForwardingEventListenerManager;
 import org.apache.sshd.common.forward.PortForwardingInformationProvider;
 import org.apache.sshd.common.future.KeyExchangeFuture;
@@ -40,7 +38,6 @@ import org.apache.sshd.common.io.IoWriteFuture;
 import org.apache.sshd.common.io.PacketWriter;
 import org.apache.sshd.common.kex.KexFactoryManager;
 import org.apache.sshd.common.kex.KeyExchange;
-import org.apache.sshd.common.mac.MacInformation;
 import org.apache.sshd.common.session.helpers.TimeoutIndicator;
 import org.apache.sshd.common.util.buffer.Buffer;
 
@@ -66,36 +63,6 @@ public interface Session
                 PacketWriter {
 
     /**
-     * Retrieves current cipher information - <B>Note:</B> may change if
-     * key re-exchange executed
-     *
-     * @param incoming If {@code true} then the cipher for the incoming data,
-     * otherwise for the outgoing data
-     * @return The {@link CipherInformation} - or {@code null} if not negotiated yet.
-     */
-    CipherInformation getCipherInformation(boolean incoming);
-
-    /**
-     * Retrieves current compression information - <B>Note:</B> may change if
-     * key re-exchange executed
-     *
-     * @param incoming If {@code true} then the compression for the incoming data,
-     * otherwise for the outgoing data
-     * @return The {@link CompressionInformation} - or {@code null} if not negotiated yet.
-     */
-    CompressionInformation getCompressionInformation(boolean incoming);
-
-    /**
-     * Retrieves current MAC information - <B>Note:</B> may change if
-     * key re-exchange executed
-     *
-     * @param incoming If {@code true} then the MAC for the incoming data,
-     * otherwise for the outgoing data
-     * @return The {@link MacInformation} - or {@code null} if not negotiated yet.
-     */
-    MacInformation getMacInformation(boolean incoming);
-
-    /**
      * Create a new buffer for the specified SSH packet and reserve the needed space
      * (5 bytes) for the packet header.
      *