Author: gnodet
Date: Wed May 5 13:02:22 2010
New Revision: 941273
URL: http://svn.apache.org/viewvc?rev=941273&view=rev
Log:
[sshd] fix sftp SSH_FXP_REALPATH command
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=941273&r1=941272&r2=941273&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
Wed May 5 13:02:22 2010
@@ -682,8 +682,8 @@ public class SftpSubsystem implements Co
// TODO: handle optional args
try {
log.info("path=" + path);
- File p = new File(path);
- sendName(id, p);
+ File p = new File(path).getCanonicalFile();
+ sendAbsoluteName(id, p);
} catch (FileNotFoundException e) {
e.printStackTrace();
sendStatus(id, SSH_FX_NO_SUCH_FILE, e.getMessage());
@@ -735,6 +735,17 @@ public class SftpSubsystem implements Co
}
+ protected void sendAbsoluteName(int id, File file) throws IOException {
+ Buffer buffer = new Buffer();
+ buffer.putByte((byte) SSH_FXP_NAME);
+ buffer.putInt(id);
+ buffer.putInt(1);
+ buffer.putString(file.getPath());
+ buffer.putString(file.getPath());
+ writeAttrs(buffer, file);
+ send(buffer);
+ }
+
protected void sendName(int id, File... files) throws IOException {
Buffer buffer = new Buffer();
buffer.putByte((byte) SSH_FXP_NAME);