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

Work on CAMEL-27118 started by Federico Mariani.
------------------------------------------------
> camel-sftp - a refused request does not give the SFTP status or the current 
> directory, and preferredAuthentications is case-sensitive
> -------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-27118
>                 URL: https://issues.apache.org/jira/browse/CAMEL-27118
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-ftp, camel-sftp
>            Reporter: Federico Mariani
>            Assignee: Federico Mariani
>            Priority: Minor
>             Fix For: 4.24.0
>
>
> When the SFTP server refuses a request, the 
> {{GenericFileOperationFailedException}} of the {{sftp}} component does not 
> give the status of the server. The message is only {{Cannot change directory 
> to: inbox}}, {{Cannot list directory: inbox}}, {{Cannot store file: ...}} and 
> so on, {{getCode()}} is {{0}} and {{getReason()}} is {{null}}. The status 
> ({{SSH_FX_NO_SUCH_FILE}}, {{SSH_FX_PERMISSION_DENIED}}, ...) is only in the 
> {{SftpException}} cause. The {{ftp}} component gives the reply code and the 
> reply of the server.
> {code:java}
> from("direct:start")
>     .to("sftp://admin@host/inbox?password=secret&autoCreate=false";);
> // GenericFileOperationFailedException: Cannot change directory to: inbox
> // getCode() == 0, getReason() == null
> {code}
> A failed change of directory does not say which directory a relative path 
> starts from, with {{sftp}} and {{ftp}}. The directory of the endpoint is 
> relative to the login directory, so {{inbox}} fails when the user expects 
> {{/inbox}}, and the message does not name the directory the server looked in.
> The {{preferredAuthentications}} option is passed to JSch as is. JSch 
> compares the names with the lower-case names of the methods the server 
> offers, so {{preferredAuthentications=Password}}, or {{publickey, password}} 
> with a space, skips the method without a log, and the login fails with {{Auth 
> fail for methods '...'}}. A misspelled name is skipped the same way.
> Expected:
> * the message ends with the SFTP status, such as {{Cannot change directory 
> to: inbox: SSH_FX_NO_SUCH_FILE: No such file}}, and {{getCode()}} and 
> {{getReason()}} return the status code and its text, as for {{ftp}};
> * a failed change to a relative directory gives the current directory, with 
> {{sftp}} and {{ftp}};
> * the names of {{preferredAuthentications}} are compared in lower case, 
> without the spaces around them, and a name that JSch does not know is logged 
> at WARN.
> _Claude Code on behalf of Federico Mariani_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to