Author: gnodet
Date: Mon May 21 10:06:38 2012
New Revision: 1340954

URL: http://svn.apache.org/viewvc?rev=1340954&view=rev
Log:
[SSHD-160] Standard ScpCommand does not work with pscp

Modified:
    
mina/sshd/trunk/sshd-core/src/main/java/org/apache/sshd/server/channel/ChannelSession.java

Modified: 
mina/sshd/trunk/sshd-core/src/main/java/org/apache/sshd/server/channel/ChannelSession.java
URL: 
http://svn.apache.org/viewvc/mina/sshd/trunk/sshd-core/src/main/java/org/apache/sshd/server/channel/ChannelSession.java?rev=1340954&r1=1340953&r2=1340954&view=diff
==============================================================================
--- 
mina/sshd/trunk/sshd-core/src/main/java/org/apache/sshd/server/channel/ChannelSession.java
 (original)
+++ 
mina/sshd/trunk/sshd-core/src/main/java/org/apache/sshd/server/channel/ChannelSession.java
 Mon May 21 10:06:38 2012
@@ -224,22 +224,25 @@ public class ChannelSession extends Abst
             return handleSignal(buffer);
         }
         if ("shell".equals(type)) {
-            if (checkType(type)) {
-                return handleShell(buffer);
+            if (this.type == null && handleShell(buffer)) {
+                this.type = type;
+                return true;
             } else {
                 return false;
             }
         }
         if ("exec".equals(type)) {
-            if (checkType(type)) {
-                return handleExec(buffer);
+            if (this.type == null && handleExec(buffer)) {
+                this.type = type;
+                return true;
             } else {
                 return false;
             }
         }
         if ("subsystem".equals(type)) {
-            if (checkType(type)) {
-                return handleSubsystem(buffer);
+            if (this.type == null && handleSubsystem(buffer)) {
+                this.type = type;
+                return true;
             } else {
                 return false;
             }
@@ -258,22 +261,6 @@ public class ChannelSession extends Abst
         return false;
     }
 
-    /**
-     * Only one of "shell", "exec" or "subsystem" command
-     * is permitted for a given channel.
-     *
-     * @param type
-     * @return
-     */
-    private boolean checkType(String type) {
-        if (this.type == null) {
-            this.type = type;
-            return true;
-        } else {
-            return false;
-        }
-    }
-
     protected boolean handleEnv(Buffer buffer) throws IOException {
         boolean wantReply = buffer.getBoolean();
         String name = buffer.getString();


Reply via email to