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 2014/12/01 18:43:16 UTC

[2/3] mina-sshd git commit: [sftp] Fix exceptions while listing directories with broken links

[sftp] Fix exceptions while listing directories with broken links

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

Branch: refs/heads/master
Commit: 36b224f58192b3cfc2cc112f473661f660931a6b
Parents: 9355e69
Author: Guillaume Nodet <gn...@apache.org>
Authored: Wed Nov 19 23:16:05 2014 +0100
Committer: Guillaume Nodet <gn...@apache.org>
Committed: Wed Nov 19 23:16:05 2014 +0100

----------------------------------------------------------------------
 .../org/apache/sshd/common/file/nativefs/NativeSshFileNio.java  | 5 +++++
 .../main/java/org/apache/sshd/server/sftp/SftpSubsystem.java    | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/36b224f5/sshd-core/src/main/java/org/apache/sshd/common/file/nativefs/NativeSshFileNio.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/file/nativefs/NativeSshFileNio.java b/sshd-core/src/main/java/org/apache/sshd/common/file/nativefs/NativeSshFileNio.java
index 564f7e9..9753ed8 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/file/nativefs/NativeSshFileNio.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/file/nativefs/NativeSshFileNio.java
@@ -53,6 +53,11 @@ import org.apache.sshd.common.file.SshFile;
  */
 public class NativeSshFileNio extends NativeSshFile {
 
+    @Override
+    public boolean doesExist() {
+        return Files.exists(file.toPath(), LinkOption.NOFOLLOW_LINKS);
+    }
+
     /**
      * Constructor, internal do not use directly.
      * @param nativeFileSystemView

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/36b224f5/sshd-core/src/main/java/org/apache/sshd/server/sftp/SftpSubsystem.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/sftp/SftpSubsystem.java b/sshd-core/src/main/java/org/apache/sshd/server/sftp/SftpSubsystem.java
index d19246b..94de3eb 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/sftp/SftpSubsystem.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/sftp/SftpSubsystem.java
@@ -902,7 +902,7 @@ public class SftpSubsystem implements Command, Runnable, SessionAware, FileSyste
     private String getLongName(SshFile f, boolean sendAttrs) throws IOException {
         Map<SshFile.Attribute, Object> attributes;
         if (sendAttrs) {
-            attributes = f.getAttributes(true);
+            attributes = f.getAttributes(false);
         } else {
             attributes = new HashMap<SshFile.Attribute, Object>();
             attributes.put(SshFile.Attribute.Owner, "owner");