nimantha-lakshan opened a new issue, #509:
URL: https://github.com/apache/mina-sshd/issues/509
### Version
2.12.1
### Bug description
```java
Caused by: org.apache.sshd.common.util.buffer.BufferException: Underflow:
requested=1668243314, available=39
at
org.apache.sshd.common.util.buffer.Buffer.ensureAvailable(Buffer.java:661)
~[sshd-common-2.12.1.jar:2.12.1]
at
org.apache.sshd.common.util.buffer.ByteArrayBuffer.getString(ByteArrayBuffer.java:241)
~[sshd-common-2.12.1.jar:2.12.1]
at org.apache.sshd.common.util.buffer.Buffer.getString(Buffer.java:332)
~[sshd-common-2.12.1.jar:2.12.1]
at
org.apache.sshd.sftp.client.impl.AbstractSftpClient.readAttributes(AbstractSftpClient.java:439)
~[sshd-sftp-2.12.1.jar:2.12.1]
at
org.apache.sshd.sftp.client.impl.AbstractSftpClient.checkAttributesResponse(AbstractSftpClient.java:331)
~[sshd-sftp-2.12.1.jar:2.12.1]
at
org.apache.sshd.sftp.client.impl.AbstractSftpClient.checkAttributes(AbstractSftpClient.java:325)
~[sshd-sftp-2.12.1.jar:2.12.1]
at
org.apache.sshd.sftp.client.impl.AbstractSftpClient.stat(AbstractSftpClient.java:990)
~[sshd-sftp-2.12.1.jar:2.12.1]
at
org.apache.sshd.sftp.client.fs.SftpClientDirectoryScanner.scan(SftpClientDirectoryScanner.java:125)
~[sshd-sftp-2.12.1.jar:2.12.1]
at
org.apache.sshd.sftp.client.fs.SftpClientDirectoryScanner.scan(SftpClientDirectoryScanner.java:115)
~[sshd-sftp-2.12.1.jar:2.12.1]
```
code example:
```java
private void process(String host, int port, String username, String
password, String homePath) throws IOException {
try (SshClient sshClient = SshClient.setUpDefaultClient()) {
sshClient.setServerKeyVerifier(AcceptAllServerKeyVerifier.INSTANCE);
sshClient.setHostConfigEntryResolver(HostConfigEntryResolver.EMPTY);
sshClient.setKeyIdentityProvider(KeyIdentityProvider.EMPTY_KEYS_PROVIDER);
sshClient.start();
// Connect to the SFTP server
try (ClientSession session = sshClient.connect(username, host,
port).verify(Duration.ofSeconds(30)).getSession()) {
session.addPasswordIdentity(password);
log.info("Connected to {}:{}. Authenticating...", host,
port);
var verify = session.auth().verify(Duration.ofSeconds(30));
log.info("Authentication {}", verify.isSuccess() ? "success"
: "failure");
try (SftpClient sftpClient =
SftpClientFactory.instance().createSftpClient(session)) {
var directoryScanner = new
SftpClientDirectoryScanner(homePath, "*.csv");
directoryScanner.setCaseSensitive(false);
var scan = directoryScanner.scan(sftpClient); // throws
error from here
}
}
}
}
```
### Actual behavior
SFTP client not working as expected.
I'm receiving this error
`org.apache.sshd.common.util.buffer.BufferException: Underflow:
requested=1668243314, available=39`
This happens only with some SFTP servers.
### Expected behavior
To resolve this issue
### Relevant log output
_No response_
### Other information
_No response_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]