I have to connect to an ssh-server, wich is not under my control.
The protocol-version that is used is '5'.
I get following exception, when processing supported features:
java.io.IOException: Unexpected length of 1936744803 bytes exceeds available data of 72 bytes
at com.sshtools.common.util.ByteArrayReader.checkLength(ByteArrayReader.java:99)
at com.sshtools.common.util.ByteArrayReader.readString(ByteArrayReader.java:232)
at com.sshtools.common.util.ByteArrayReader.readString(ByteArrayReader.java:220)
at com.sshtools.client.sftp.SftpChannel.processSupported(SftpChannel.java:424)
at com.sshtools.client.sftp.SftpChannel.initializeSftp(SftpChannel.java:285)
... 19 more
I've checked the sftp-documentation and it states that the supported-structure is as follows:
if(supportedStructure.available() >= 4) {
int count = (int) supportedStructure.readInt();
for (int i = 0; i < count; i++) {
String ext = supportedStructure.readString();
if(Log.isTraceEnabled()) {
Log.trace("Server supports '" + ext
+ "' extension");
}
supportedExtensions.add(ext);
}
}
So if there is data available it determines the number of extension an than reads as many strings.
i don't know, if this is correct, but it doesn't work.
i think the documentation has to be read as follows: as long as data is available read string.
Processed extension 'supported'
Server supports 'space-available' extension
Server supports 'statvfs@openssh.com' extension
Server supports 'fstatvfs@openssh.com' extension
I'm fixing this in the develop branch (3.1.0-SNAPSHOT). It looks like an over-eager copy/paste as the supported2 structure in V6 does have an int count preceding the extension names.
I have to connect to an ssh-server, wich is not under my control. The protocol-version that is used is '5'.
I get following exception, when processing supported features:
I've checked the sftp-documentation and it states that the supported-structure is as follows:
in SftpChannel the data is processed in this way:
So if there is data available it determines the number of extension an than reads as many strings. i don't know, if this is correct, but it doesn't work. i think the documentation has to be read as follows: as long as data is available read string.
if changing the if-block quoted above to
it works fine.
In the log following messages show up:
wich seems to make sense...
Greetz, Karsten