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 2015/12/08 09:06:57 UTC

mina-sshd git commit: Fixed parsing of "break" channel request according to rfc4335

Repository: mina-sshd
Updated Branches:
  refs/heads/master 567a6af73 -> 28faad412


Fixed parsing of "break" channel request according to rfc4335


Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/28faad41
Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/28faad41
Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/28faad41

Branch: refs/heads/master
Commit: 28faad4120a439a9df36b653e517308032bc117e
Parents: 567a6af
Author: Lyor Goldstein <lg...@vmware.com>
Authored: Tue Dec 8 10:06:47 2015 +0200
Committer: Lyor Goldstein <lg...@vmware.com>
Committed: Tue Dec 8 10:06:47 2015 +0200

----------------------------------------------------------------------
 .../apache/sshd/server/channel/ChannelSession.java | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/28faad41/sshd-core/src/main/java/org/apache/sshd/server/channel/ChannelSession.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/channel/ChannelSession.java b/sshd-core/src/main/java/org/apache/sshd/server/channel/ChannelSession.java
index e3b422e..03ae7cd 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/channel/ChannelSession.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/channel/ChannelSession.java
@@ -277,6 +277,9 @@ public class ChannelSession extends AbstractServerChannel {
             case "x11-req":
                 return handleX11Forwarding(buffer);
             default:
+                if (log.isDebugEnabled()) {
+                    log.debug("handleRequest({}) unknown type: {}", this, type);
+                }
                 return null;
         }
     }
@@ -304,9 +307,10 @@ public class ChannelSession extends AbstractServerChannel {
         for (int i = 0; i < modes.length && (modes[i] != PtyMode.TTY_OP_END);) {
             int opcode = modes[i++] & 0x00FF;
             PtyMode mode = PtyMode.fromInt(opcode);
-            /**
+            /*
              * According to section 8 of RFC 4254:
-             * "Opcodes 160 to 255 are not yet defined, and cause parsing to stop"
+             *
+             *      "Opcodes 160 to 255 are not yet defined, and cause parsing to stop"
              */
             if (mode == null) {
                 log.warn("handlePtyReq({}) unknown pty opcode value: {}", this, opcode);
@@ -362,10 +366,11 @@ public class ChannelSession extends AbstractServerChannel {
         return true;
     }
 
+    // see rfc4335
     protected boolean handleBreak(Buffer buffer) throws IOException {
-        String name = buffer.getString();
+        long breakLength = buffer.getUInt();
         if (log.isDebugEnabled()) {
-            log.debug("handleBreak({}) {}", this, name);
+            log.debug("handleBreak({}) length={}", this, breakLength);
         }
 
         getEnvironment().signal(Signal.INT);
@@ -607,6 +612,10 @@ public class ChannelSession extends AbstractServerChannel {
     }
 
     protected void closeShell(int exitValue) throws IOException {
+        if (log.isDebugEnabled()) {
+            log.debug("closeShell({}) exit code={}", this, exitValue);
+        }
+
         if (!isClosing()) {
             sendEof();
             sendExitStatus(exitValue);