You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Goldstein Lyor (JIRA)" <ji...@apache.org> on 2015/03/30 16:10:53 UTC

[jira] [Updated] (SSHD-444) Handle correctly inaccessible paths in Scp and Sftp subsystems

     [ https://issues.apache.org/jira/browse/SSHD-444?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Goldstein Lyor updated SSHD-444:
--------------------------------
    Attachment: 0043-SSHD-444-Handle-correctly-inaccessible-paths-in-Scp-.patch

I have run all the tests successfully + tested with _WinSCP_ on some _Windows_ files that were inaccessible and were causing the connection to abort. See screenshot...

> Handle correctly inaccessible paths in Scp and Sftp subsystems
> --------------------------------------------------------------
>
>                 Key: SSHD-444
>                 URL: https://issues.apache.org/jira/browse/SSHD-444
>             Project: MINA SSHD
>          Issue Type: Bug
>    Affects Versions: 1.0.0
>            Reporter: Goldstein Lyor
>         Attachments: 0043-SSHD-444-Handle-correctly-inaccessible-paths-in-Scp-.patch
>
>
> Turns out that just asking _Files.exists(...)_ is not enough - according to the [Java tutorial on checking if a file or directory exists|http://docs.oracle.com/javase/tutorial/essential/io/check.html]:
> {panel}
> The methods in the _Path_ class are syntactic, meaning that they operate on the _Path_ instance. But eventually you must access the file system to verify that a particular _Path_ exists, or does not exist. You can do so with the _exists(Path, LinkOption...)_ and the _notExists(Path, LinkOption...)_ methods. *Note* that _!Files.exists(path)_ is *not( equivalent to _Files.notExists(path)_. When you are testing a file's existence, three results are possible:
> - The file is verified to exist.
> - The file is verified to not exist.
> - The file's status is unknown. This result can occur when the program does not have access to the file.
> If *both* _exists_ and *notExists* return false, the existence of the file cannot be verified.
> {panel}
> I have therefore implemented _IOUtils#checkFileExistence_ method that serves as a *central* method for such checks, and then added the relevant logic in SCP/SFTP. *Note*: specifically for SFTP, whenever the existence cannot be determined (i.e., _null_ is returned) the _unsupportedAttributePolicy_ is consulted. The default behavior is geared towards being *lenient* - i.e., provide as much information as possible even for inaccessible files (e.g., their name and permissions) knowing that if the client tries to read/write/delete them it will be blocked anyway.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)