[jira] [Commented] (SSHD-814) enrich the SftpEventListener
[ https://issues.apache.org/jira/browse/SSHD-814?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17268037#comment-17268037 ] Lyor Goldstein commented on SSHD-814: - {{SftpEventListener}} is not the same as {{SftpErrorStatusDataHandler}} - 2 separate interfaces for 2 different purposes > enrich the SftpEventListener > > > Key: SSHD-814 > URL: https://issues.apache.org/jira/browse/SSHD-814 > Project: MINA SSHD > Issue Type: Improvement >Affects Versions: 1.7.0 >Reporter: Zhenliang Su >Assignee: Lyor Goldstein >Priority: Minor > Labels: EventListener, sftp > Fix For: 2.0.0 > > > In practice, I found that, the callback function provided by > SftpEventListener is not enough. For example, the following situation is not > easy to be notified in a elegant way: > {code:java} > download files that you do not have access to > download a file that no longer exists > upload files to a directory without permissions > create a new file in a directory that you do not have access to > download or upload a file complete > upload a zero size file > ...{code} -- This message was sent by Atlassian Jira (v8.3.4#803005) - To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org For additional commands, e-mail: dev-h...@mina.apache.org
[jira] [Commented] (SSHD-814) enrich the SftpEventListener
[ https://issues.apache.org/jira/browse/SSHD-814?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17267740#comment-17267740 ] Susmit Sarkar commented on SSHD-814: [~smoking] did you faced this kind of issue? https://issues.apache.org/jira/browse/SSHD-1119 > enrich the SftpEventListener > > > Key: SSHD-814 > URL: https://issues.apache.org/jira/browse/SSHD-814 > Project: MINA SSHD > Issue Type: Improvement >Affects Versions: 1.7.0 >Reporter: Zhenliang Su >Assignee: Lyor Goldstein >Priority: Minor > Labels: EventListener, sftp > Fix For: 2.0.0 > > > In practice, I found that, the callback function provided by > SftpEventListener is not enough. For example, the following situation is not > easy to be notified in a elegant way: > {code:java} > download files that you do not have access to > download a file that no longer exists > upload files to a directory without permissions > create a new file in a directory that you do not have access to > download or upload a file complete > upload a zero size file > ...{code} -- This message was sent by Atlassian Jira (v8.3.4#803005) - To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org For additional commands, e-mail: dev-h...@mina.apache.org
[jira] [Commented] (SSHD-814) enrich the SftpEventListener
[ https://issues.apache.org/jira/browse/SSHD-814?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16447628#comment-16447628 ] Zhenliang Su commented on SSHD-814: --- Thank you > enrich the SftpEventListener > > > Key: SSHD-814 > URL: https://issues.apache.org/jira/browse/SSHD-814 > Project: MINA SSHD > Issue Type: Improvement >Affects Versions: 1.7.0 >Reporter: Zhenliang Su >Assignee: Goldstein Lyor >Priority: Minor > Labels: EventListener, sftp > > In practice, I found that, the callback function provided by > SftpEventListener is not enough. For example, the following situation is not > easy to be notified in a elegant way: > {code:java} > download files that you do not have access to > download a file that no longer exists > upload files to a directory without permissions > create a new file in a directory that you do not have access to > download or upload a file complete > upload a zero size file > ...{code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SSHD-814) enrich the SftpEventListener
[ https://issues.apache.org/jira/browse/SSHD-814?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16447563#comment-16447563 ] Goldstein Lyor commented on SSHD-814: - {quote}1. ... Is there some else way to do this?{quote} I don't think so, if you want to know what happened to a file, then you have to track it via the {{open, read/write, close}} callbacks {quote}2. ... When do a delete or rename or other action to a non-exist file or directory. For now, it just open failed, and not call any callback function in `SftpEventListener`.{quote} True - this is what I meant by {quote}there are a few cases where the listener might not be called, which I will fix{quote} > enrich the SftpEventListener > > > Key: SSHD-814 > URL: https://issues.apache.org/jira/browse/SSHD-814 > Project: MINA SSHD > Issue Type: Improvement >Affects Versions: 1.7.0 >Reporter: Zhenliang Su >Assignee: Goldstein Lyor >Priority: Minor > Labels: EventListener, sftp > > In practice, I found that, the callback function provided by > SftpEventListener is not enough. For example, the following situation is not > easy to be notified in a elegant way: > {code:java} > download files that you do not have access to > download a file that no longer exists > upload files to a directory without permissions > create a new file in a directory that you do not have access to > download or upload a file complete > upload a zero size file > ...{code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SSHD-814) enrich the SftpEventListener
[ https://issues.apache.org/jira/browse/SSHD-814?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16447459#comment-16447459 ] Zhenliang Su commented on SSHD-814: --- Thanks. 1. Yes, there are no such SFTP command 'upload/download'. There are some situation that do something after downloading or uploading. For now, my way to approach this is doing something in `close` callback function and judge whether the file which closing is called `read/written` callback function. Is there some else way to do this? 2. When do a delete or rename or other action to a non-exist file or directory. For now, it just open failed, and not call any callback function in `SftpEventListener`. My testing code is the middleman code in https://issues.apache.org/jira/browse/SSHD-812 . My steps are: 1. Use filezilla sftp to the middleman, and see a list of file of the target server. 2. Ssh to the target server, delete a file. 3. Not refresh a filezilla, now you can still see the file which deleted just now. 4. Download that file. > enrich the SftpEventListener > > > Key: SSHD-814 > URL: https://issues.apache.org/jira/browse/SSHD-814 > Project: MINA SSHD > Issue Type: Improvement >Affects Versions: 1.7.0 >Reporter: Zhenliang Su >Assignee: Goldstein Lyor >Priority: Minor > Labels: EventListener, sftp > > In practice, I found that, the callback function provided by > SftpEventListener is not enough. For example, the following situation is not > easy to be notified in a elegant way: > {code:java} > download files that you do not have access to > download a file that no longer exists > upload files to a directory without permissions > create a new file in a directory that you do not have access to > download or upload a file complete > upload a zero size file > ...{code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SSHD-814) enrich the SftpEventListener
[ https://issues.apache.org/jira/browse/SSHD-814?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16445826#comment-16445826 ] Goldstein Lyor commented on SSHD-814: - Specifically about removal, there are a few cases where the listener might not be called, which I will fix, but there is definitely a call to inform about removal failing. > enrich the SftpEventListener > > > Key: SSHD-814 > URL: https://issues.apache.org/jira/browse/SSHD-814 > Project: MINA SSHD > Issue Type: Improvement >Affects Versions: 1.7.0 >Reporter: Zhenliang Su >Assignee: Goldstein Lyor >Priority: Minor > Labels: EventListener, sftp > > In practice, I found that, the callback function provided by > SftpEventListener is not enough. For example, the following situation is not > easy to be notified in a elegant way: > {code:java} > download files that you do not have access to > download a file that no longer exists > upload files to a directory without permissions > create a new file in a directory that you do not have access to > download or upload a file complete > upload a zero size file > ...{code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SSHD-814) enrich the SftpEventListener
[ https://issues.apache.org/jira/browse/SSHD-814?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16445768#comment-16445768 ] Goldstein Lyor commented on SSHD-814: - I don't understand the requirements: {quote} When upload/download a file complete {quote} There is no such SFTP command 'upload/download' a file - are you sure you are referring to SFTP and not SCP. {quote} When do a delete or rename or other action to a non-exist file or directory, there should has a callback function indicating which action failed. {quote} There are such callbacks: {code:java} /** * Called after a file / directory has been removed * * @param session The {@link ServerSession} through which the request was handled * @param pathThe {@link Path} to be removed * @param thrown If not-{@code null} then the reason for the failure to execute * @throws IOException If failed to handle the call */ default void removed(ServerSession session, Path path, Throwable thrown) throws IOException { // ignored } /** * Called after renaming a file / directory * * @param session The {@link ServerSession} through which the request was handled * @param srcPath The source {@link Path} * @param dstPath The target {@link Path} * @param optsThe resolved renaming options * @param thrown If not-{@code null} then the reason for the failure to execute * @throws IOException If failed to handle the call */ default void moved(ServerSession session, Path srcPath, Path dstPath, Collection opts, Throwable thrown) throws IOException { // ignored } {code} Again, I may be missing something but I don't see what "enrichment" is necessary - are you sure you are looking at version 1.7 ? > enrich the SftpEventListener > > > Key: SSHD-814 > URL: https://issues.apache.org/jira/browse/SSHD-814 > Project: MINA SSHD > Issue Type: Improvement >Affects Versions: 1.7.0 >Reporter: Zhenliang Su >Assignee: Goldstein Lyor >Priority: Minor > Labels: EventListener, sftp > > In practice, I found that, the callback function provided by > SftpEventListener is not enough. For example, the following situation is not > easy to be notified in a elegant way: > {code:java} > download files that you do not have access to > download a file that no longer exists > upload files to a directory without permissions > create a new file in a directory that you do not have access to > download or upload a file complete > upload a zero size file > ...{code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SSHD-814) enrich the SftpEventListener
[ https://issues.apache.org/jira/browse/SSHD-814?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16445232#comment-16445232 ] Zhenliang Su commented on SSHD-814: --- 1. When upload a file complete, there should has a callback function like uploadComplete(ServerSession session, Path path, Throwable thrown). 2. When download a file complete, there should has a callback function like downloadComplete(ServerSession session, Path path, Throwable thrown). 3. When do a delete or rename or other action to a non-exist file or directory, there should has a callback function indicating which action failed. > enrich the SftpEventListener > > > Key: SSHD-814 > URL: https://issues.apache.org/jira/browse/SSHD-814 > Project: MINA SSHD > Issue Type: Improvement >Affects Versions: 1.7.0 >Reporter: Zhenliang Su >Assignee: Goldstein Lyor >Priority: Minor > Labels: EventListener, sftp > > In practice, I found that, the callback function provided by > SftpEventListener is not enough. For example, the following situation is not > easy to be notified in a elegant way: > {code:java} > download files that you do not have access to > download a file that no longer exists > upload files to a directory without permissions > create a new file in a directory that you do not have access to > download or upload a file complete > upload a zero size file > ...{code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SSHD-814) enrich the SftpEventListener
[ https://issues.apache.org/jira/browse/SSHD-814?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16433905#comment-16433905 ] Goldstein Lyor commented on SSHD-814: - I agree with you on that - although _open_ and _openDir_ are slightly different than the rest of the indications. This is certainly an important improvement. However, before I start working on it, I would appreciate it if you could make a list of your suggestions so we can discuss them and implement all at once. No hurry - some time within the next 2-3 weeks. *Note:* that before we can start on this issue we need to resolve SSHD-812 since it references the same code. > enrich the SftpEventListener > > > Key: SSHD-814 > URL: https://issues.apache.org/jira/browse/SSHD-814 > Project: MINA SSHD > Issue Type: Improvement >Affects Versions: 1.7.0 >Reporter: Zhenliang Su >Priority: Minor > Labels: EventListener, sftp > > In practice, I found that, the callback function provided by > SftpEventListener is not enough. For example, the following situation is not > easy to be notified in a elegant way: > {code:java} > download files that you do not have access to > download a file that no longer exists > upload files to a directory without permissions > create a new file in a directory that you do not have access to > download or upload a file complete > upload a zero size file > ...{code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SSHD-814) enrich the SftpEventListener
[ https://issues.apache.org/jira/browse/SSHD-814?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16433289#comment-16433289 ] Zhenliang Su commented on SSHD-814: --- like other functions in SftpEventListener, the `open` function may should has an extra parameter `Throwable thrown`, indicating whether open failed or not. > enrich the SftpEventListener > > > Key: SSHD-814 > URL: https://issues.apache.org/jira/browse/SSHD-814 > Project: MINA SSHD > Issue Type: Improvement >Affects Versions: 1.7.0 >Reporter: Zhenliang Su >Priority: Minor > Labels: EventListener, sftp > > In practice, I found that, the callback function provided by > SftpEventListener is not enough. For example, the following situation is not > easy to be notified in a elegant way: > {code:java} > download files that you do not have access to > download a file that no longer exists > upload files to a directory without permissions > create a new file in a directory that you do not have access to > download or upload a file complete > upload a zero size file > ...{code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SSHD-814) enrich the SftpEventListener
[ https://issues.apache.org/jira/browse/SSHD-814?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16431942#comment-16431942 ] Goldstein Lyor commented on SSHD-814: - Not clear how you propose to enrich - please provide a description of the API you think is missing in the listener and how it can be used to provide the notifications you seek {quote} in an elegant way {quote} For my part I don't see that anything is missing - e.g. {quote} download files that you do not have access to {quote} {code:java} /** * Specified file / directory is being opened * * @param session The {@link ServerSession} through which the request was handled * @param remoteHandle The (opaque) assigned handle for the file / directory * @param localHandle The associated file / directory {@link Handle} * @throws IOException If failed to handle the call */ @Override public void opening(ServerSession session, String remoteHandle, Handle localHandle) throws IOException { Path path = localHandle.getFilePath(); if (!okToAccess(path)) { throw new AccessDeniedException(); } } {code} However, if you are talking about *client side* notification, then that is another issue altogether - the SFTP protocol does not provide standard indicators as to why an access request failed - we do out best to translate exceptions into relevant numerical codes, but that;s the best we can do: {code:java|title=SftpHelper} public static int resolveSubstatus(Throwable t) { if ((t instanceof NoSuchFileException) || (t instanceof FileNotFoundException)) { return SftpConstants.SSH_FX_NO_SUCH_FILE; } else if (t instanceof InvalidHandleException) { return SftpConstants.SSH_FX_INVALID_HANDLE; } else if (t instanceof FileAlreadyExistsException) { return SftpConstants.SSH_FX_FILE_ALREADY_EXISTS; } else if (t instanceof DirectoryNotEmptyException) { return SftpConstants.SSH_FX_DIR_NOT_EMPTY; } else if (t instanceof NotDirectoryException) { return SftpConstants.SSH_FX_NOT_A_DIRECTORY; } else if (t instanceof AccessDeniedException) { return SftpConstants.SSH_FX_PERMISSION_DENIED; } else if (t instanceof EOFException) { return SftpConstants.SSH_FX_EOF; } else if (t instanceof OverlappingFileLockException) { return SftpConstants.SSH_FX_LOCK_CONFLICT; } else if ((t instanceof UnsupportedOperationException) || (t instanceof UnknownServiceException)) { return SftpConstants.SSH_FX_OP_UNSUPPORTED; } else if (t instanceof InvalidPathException) { return SftpConstants.SSH_FX_INVALID_FILENAME; } else if (t instanceof IllegalArgumentException) { return SftpConstants.SSH_FX_INVALID_PARAMETER; } else if (t instanceof UserPrincipalNotFoundException) { return SftpConstants.SSH_FX_UNKNOWN_PRINCIPAL; } else if (t instanceof FileSystemLoopException) { return SftpConstants.SSH_FX_LINK_LOOP; } else if (t instanceof SftpException) { return ((SftpException) t).getStatus(); } else { return SftpConstants.SSH_FX_FAILURE; } } {code} Note that you can provide your own {{SftpErrorStatusDataHandler}} that can do other things - but that's between you and your client - other (standard) clients might not "understand" what you did. > enrich the SftpEventListener > > > Key: SSHD-814 > URL: https://issues.apache.org/jira/browse/SSHD-814 > Project: MINA SSHD > Issue Type: Improvement >Affects Versions: 1.7.0 >Reporter: Zhenliang Su >Priority: Minor > Labels: EventListener, sftp > > In practice, I found that, the callback function provided by > SftpEventListener is not enough. For example, the following situation is not > easy to be notified in a elegant way: > {code:java} > download files that you do not have access to > download a file that no longer exists > upload files to a directory without permissions > create a new file in a directory that you do not have access to > download or upload a file complete > upload a zero size file > ...{code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)