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 2016/01/04 13:54:49 UTC

[4/5] mina-sshd git commit: Make sure X.11 request buffer data is decoded before filter is consulted

Make sure X.11 request buffer data is decoded before filter is consulted

* In order to make sure request was sent correctly regardless of the filter's result


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

Branch: refs/heads/master
Commit: 64806dce98d4fc95da20f659f75388d9f59925bb
Parents: 54c2cc6
Author: Lyor Goldstein <lg...@vmware.com>
Authored: Mon Jan 4 14:54:11 2016 +0200
Committer: Lyor Goldstein <lg...@vmware.com>
Committed: Mon Jan 4 14:54:11 2016 +0200

----------------------------------------------------------------------
 .../sshd/server/channel/ChannelSession.java     | 21 +++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/64806dce/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 03ae7cd..e3feff6 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
@@ -86,7 +86,7 @@ public class ChannelSession extends AbstractServerChannel {
 
     public ChannelSession() {
         addRequestHandler(new ChannelSessionRequestHandler());
-        addRequestHandler(new PuttyRequestHandler());
+        addRequestHandler(PuttyRequestHandler.INSTANCE);
     }
 
     @Override
@@ -578,24 +578,27 @@ public class ChannelSession extends AbstractServerChannel {
         Session session = getSession();
         ValidateUtils.checkTrue(session instanceof ServerSession, "Session not a server one");
 
+        boolean singleConnection = buffer.getBoolean();
+        String authProtocol = buffer.getString();
+        String authCookie = buffer.getString();
+        int screenId = buffer.getInt();
+
         FactoryManager manager = session.getFactoryManager();
         ForwardingFilter filter = manager.getTcpipForwardingFilter();
         if ((filter == null) || (!filter.canForwardX11(session))) {
             if (log.isDebugEnabled()) {
-                log.debug("handleX11Forwarding(" + this + ")[haveFilter=" + (filter != null) + "] filtered out");
+                log.debug("handleX11Forwarding({}) single={}, protocol={}, cookie={}, screen={}, filter={}: filtered",
+                          this, singleConnection, authProtocol, authCookie, screenId, filter);
             }
             return false;
         }
 
-        boolean singleConnection = buffer.getBoolean();
-        String authProtocol = buffer.getString();
-        String authCookie = buffer.getString();
-        int screenId = buffer.getInt();
         String display = service.createX11Display(singleConnection, authProtocol, authCookie, screenId);
+        if (log.isDebugEnabled()) {
+            log.debug("handleX11Forwarding({}) single={}, protocol={}, cookie={}, screen={} - display='{}'",
+                      this, singleConnection, authProtocol, authCookie, screenId, display);
+        }
         if (GenericUtils.isEmpty(display)) {
-            if (log.isDebugEnabled()) {
-                log.debug("handleX11Forwarding(" + this + ") no X.11 display created");
-            }
             return false;
         }