Author: gnodet
Date: Wed May 5 14:21:42 2010
New Revision: 941304
URL: http://svn.apache.org/viewvc?rev=941304&view=rev
Log:
[sshd] fix sftp a bit
Modified:
mina/sshd/trunk/sshd-core/src/main/java/org/apache/sshd/server/sftp/SftpSubsystem.java
mina/sshd/trunk/sshd-core/src/test/java/org/apache/sshd/SftpTest.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=941304&r1=941303&r2=941304&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 14:21:42 2010
@@ -26,6 +26,8 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.RandomAccessFile;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
@@ -740,8 +742,13 @@ public class SftpSubsystem implements Co
buffer.putByte((byte) SSH_FXP_NAME);
buffer.putInt(id);
buffer.putInt(1);
- buffer.putString(file.getPath());
- buffer.putString(file.getPath());
+ String name = file.getPath();
+ name = name.replace('\\', '/');
+ if (!name.startsWith("/")) {
+ name = "/" + name;
+ }
+ buffer.putString(name);
+ buffer.putString(name);
writeAttrs(buffer, file);
send(buffer);
}
@@ -796,7 +803,8 @@ public class SftpSubsystem implements Co
sb.append(" ");
sb.append(lengthString);
sb.append(" ");
- sb.append("Jan 01 00:00 ");
+ sb.append(new SimpleDateFormat("MMM dd
hh:mm").format(f.lastModified()));
+ sb.append(" ");
sb.append(f.getName());
return sb.toString();
Modified: mina/sshd/trunk/sshd-core/src/test/java/org/apache/sshd/SftpTest.java
URL:
http://svn.apache.org/viewvc/mina/sshd/trunk/sshd-core/src/test/java/org/apache/sshd/SftpTest.java?rev=941304&r1=941303&r2=941304&view=diff
==============================================================================
--- mina/sshd/trunk/sshd-core/src/test/java/org/apache/sshd/SftpTest.java
(original)
+++ mina/sshd/trunk/sshd-core/src/test/java/org/apache/sshd/SftpTest.java Wed
May 5 14:21:42 2010
@@ -108,7 +108,7 @@ public class SftpTest {
}
@Test
- @Ignore
+// @Ignore
public void testExternal() throws Exception {
System.out.println("SFTP subsystem available on port " + port);
Thread.sleep(5 * 60000);