camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CAMEL-6514) SFTP: NPE if no private key file is supplied
Date Wed, 10 Jul 2013 16:21:49 GMT

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

Claus Ibsen updated CAMEL-6514:
-------------------------------

    Affects Version/s: 2.11.0
        Fix Version/s: 2.12.0
                       2.11.1
                       2.10.7
    
> SFTP: NPE if no private key file is supplied
> --------------------------------------------
>
>                 Key: CAMEL-6514
>                 URL: https://issues.apache.org/jira/browse/CAMEL-6514
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-ftp
>    Affects Versions: 2.10.4, 2.11.0
>            Reporter: Joerg Kessler
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 2.10.7, 2.11.1, 2.12.0
>
>
> Hi,
> a NPE is thrown if no private key file is supplied in the configuration for SFTP. The
error is
> Caused by: java.lang.NullPointerException: while trying to get the length of an array
loaded from local variable 'foo'
> at com.jcraft.jsch.Buffer.putString(Buffer.java:59)
> I have analysed the code a bit and found that the problem is caused
> by the class SftpOperations. The method createSession sets the userInfo for the seesion
by an inline class. Here the method promptKeyboardInteractive does not work correctly if no
private key file is supplied. In that case JSCH switches to user/pw authorization and this
method is called. But since there is no password maintained the configation object returns
NULL. The present implementation adds it to the string array causing the error in JSCH. JSCH
either wants a NULL string array or an empty string array (I have tested both). So the code
should look e.g. as follows:
>             public String[] promptKeyboardInteractive(String destination, String name,
String instruction, String[] prompt, boolean[] echo) {
>                 String password = configuration.getPassword();
>                 if (password == null) {
>                     return new String[0];
>                 } else {
>                     return new String[] { password };
>                 }
>             }
> With that change JSCH returns
> Caused by: java.io.FileNotFoundException: ./data/ssh/id_rsa (No such file or directory)
> 	at java.io.FileInputStream.open(Native Method)
> and that is the real cause of the error 
> Best Regards,
> Jörg 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message