You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by gn...@apache.org on 2010/05/10 07:22:01 UTC
svn commit: r942662 -
/mina/sshd/trunk/sshd-core/src/main/java/org/apache/sshd/server/sftp/SftpSubsystem.java
Author: gnodet
Date: Mon May 10 05:22:01 2010
New Revision: 942662
URL: http://svn.apache.org/viewvc?rev=942662&view=rev
Log:
[sshd] send dummy attributes when replying to a SSH_FXP_REALPATH with version <= 3
Modified:
mina/sshd/trunk/sshd-core/src/main/java/org/apache/sshd/server/sftp/SftpSubsystem.java
Modified: mina/sshd/trunk/sshd-core/src/main/java/org/apache/sshd/server/sftp/SftpSubsystem.java
URL: http://svn.apache.org/viewvc/mina/sshd/trunk/sshd-core/src/main/java/org/apache/sshd/server/sftp/SftpSubsystem.java?rev=942662&r1=942661&r2=942662&view=diff
==============================================================================
--- mina/sshd/trunk/sshd-core/src/main/java/org/apache/sshd/server/sftp/SftpSubsystem.java (original)
+++ mina/sshd/trunk/sshd-core/src/main/java/org/apache/sshd/server/sftp/SftpSubsystem.java Mon May 10 05:22:01 2010
@@ -73,7 +73,9 @@ public class SftpSubsystem implements Co
}
}
- public static final int HIGHEST_SFTP_IMPL = 3; // Working implementation up to v3, v4 and v5 are work in progress
+ public static final int LOWER_SFTP_IMPL = 3; // Working implementation from v3
+ public static final int HIGHER_SFTP_IMPL = 3; // .. up to
+ public static final String ALL_SFTP_IMPL = "3";
public static final int SSH_FXP_INIT = 1;
@@ -378,15 +380,14 @@ public class SftpSubsystem implements Co
throw new IllegalArgumentException();
}
version = id;
- if (version >= HIGHEST_SFTP_IMPL) {
+ if (version >= LOWER_SFTP_IMPL && version <= HIGHER_SFTP_IMPL) {
buffer.clear();
buffer.putByte((byte) SSH_FXP_VERSION);
- buffer.putInt(HIGHEST_SFTP_IMPL);
+ buffer.putInt(version);
send(buffer);
- version = HIGHEST_SFTP_IMPL;
} else {
// We only support version 3 (Version 1 and 2 are not common)
- sendStatus(id, SSH_FX_OP_UNSUPPORTED, "SFTP server only support SFTP up to version " + HIGHEST_SFTP_IMPL);
+ sendStatus(id, SSH_FX_OP_UNSUPPORTED, "SFTP server only support versions " + ALL_SFTP_IMPL);
}
break;
@@ -793,10 +794,11 @@ public class SftpSubsystem implements Co
}
if (version <= 3) {
buffer.putString(getLongName(f)); // Format specified in the specs
+ buffer.putInt(0);
} else {
buffer.putString(f.getName()); // Supposed to be UTF-8
+ writeAttrs(buffer, f);
}
- writeAttrs(buffer, f);
send(buffer);
}