Updated Branches: refs/heads/master f549a71bc -> 728903aea
[SSHD-245] Support Break Extension (RFC 4335) Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/728903ae Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/728903ae Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/728903ae Branch: refs/heads/master Commit: 728903aea55e8d755636c02940d27760f8244e4f Parents: f549a71 Author: Guillaume Nodet <[email protected]> Authored: Fri Jul 26 10:45:21 2013 +0200 Committer: Guillaume Nodet <[email protected]> Committed: Fri Jul 26 10:45:21 2013 +0200 ---------------------------------------------------------------------- .../apache/sshd/server/channel/ChannelSession.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/728903ae/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 1fcf6d0..31b87d7 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 { if ("signal".equals(type)) { return handleSignal(buffer); } + if ("break".equals(type)) { + return handleBreak(buffer); + } if ("shell".equals(type)) { if (this.type == null && handleShell(buffer)) { this.type = type; @@ -392,6 +395,20 @@ public class ChannelSession extends AbstractServerChannel { log.warn("Unknown signal received: " + name); } + if (wantReply) { + buffer = session.createBuffer(SshConstants.Message.SSH_MSG_CHANNEL_SUCCESS, 0); + buffer.putInt(recipient); + writePacket(buffer); + } + return true; + } + + protected boolean handleBreak(Buffer buffer) throws IOException { + boolean wantReply = buffer.getBoolean(); + String name = buffer.getString(); + log.debug("Break received on channel {}: {}", id, name); + + getEnvironment().signal(Signal.INT); if (wantReply) { buffer = session.createBuffer(SshConstants.Message.SSH_MSG_CHANNEL_SUCCESS, 0);
