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 2018/02/01 18:00:42 UTC
mina-sshd git commit: [SSHD-800] Numerous SSH_MSG_CHANNEL_FAILURE
messages sent for SSH_MSG_CHANNEL_DATA on unknown channel
Repository: mina-sshd
Updated Branches:
refs/heads/master 92c9ea86d -> 39392f594
[SSHD-800] Numerous SSH_MSG_CHANNEL_FAILURE messages sent for SSH_MSG_CHANNEL_DATA on unknown channel
Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/39392f59
Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/39392f59
Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/39392f59
Branch: refs/heads/master
Commit: 39392f59487515e38ebf35781f3caa0850805418
Parents: 92c9ea8
Author: Lyor Goldstein <ly...@gmail.com>
Authored: Thu Feb 1 20:02:50 2018 +0200
Committer: Lyor Goldstein <ly...@gmail.com>
Committed: Thu Feb 1 20:03:13 2018 +0200
----------------------------------------------------------------------
.../DefaultUnknownChannelReferenceHandler.java | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/39392f59/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/DefaultUnknownChannelReferenceHandler.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/DefaultUnknownChannelReferenceHandler.java b/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/DefaultUnknownChannelReferenceHandler.java
index 42c0617..927460e 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/DefaultUnknownChannelReferenceHandler.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/DefaultUnknownChannelReferenceHandler.java
@@ -21,6 +21,7 @@ package org.apache.sshd.common.session.helpers;
import java.io.IOException;
+import org.apache.sshd.common.PropertyResolverUtils;
import org.apache.sshd.common.SshConstants;
import org.apache.sshd.common.channel.Channel;
import org.apache.sshd.common.io.IoWriteFuture;
@@ -36,6 +37,15 @@ import org.apache.sshd.common.util.logging.AbstractLoggingBean;
public class DefaultUnknownChannelReferenceHandler
extends AbstractLoggingBean
implements UnknownChannelReferenceHandler {
+ /**
+ * RFC4254 does not clearly specify how to handle {@code SSH_MSG_CHANNEL_DATA}
+ * and {@code SSH_MSG_CHANNEL_EXTENDED_DATA} received through an unknown channel.
+ * Therefore, we provide a configurable approach to it with the default set to ignore it.
+ */
+ public static final String SEND_REPLY_FOR_CHANNEL_DATA = "send-unknown-channel-data-reply";
+ // Not sure if entirely compliant with RFC4254, but try to stem the flood
+ public static final boolean DEFAULT_SEND_REPLY_FOR_CHANNEL_DATA = false;
+
public static final DefaultUnknownChannelReferenceHandler INSTANCE = new DefaultUnknownChannelReferenceHandler();
public DefaultUnknownChannelReferenceHandler() {
@@ -74,8 +84,11 @@ public class DefaultUnknownChannelReferenceHandler
case SshConstants.SSH_MSG_CHANNEL_DATA:
case SshConstants.SSH_MSG_CHANNEL_EXTENDED_DATA:
- // Not sure if entirely compliant with RFC4254, but try to stem the flood
- wantReply = true;
+ wantReply = PropertyResolverUtils.getBooleanProperty(session, SEND_REPLY_FOR_CHANNEL_DATA, DEFAULT_SEND_REPLY_FOR_CHANNEL_DATA);
+ // Use TRACE level to avoid log overflow due to invalid messages flood
+ if (log.isTraceEnabled()) {
+ log.trace("handleUnknownChannelCommand({}) received msg channel data (opcode={}) reply={}", session, cmd, wantReply);
+ }
break;
default: // do nothing