mirror of https://github.com/wolfSSL/wolfssh.git
Receive Window
1. Fix bug when setting the receive window to 2048 bytes and the LS would fail. The OpenSSH server is splitting a single full names message across mulitple SSH data records. Needed to treat partial reads at the LS level as a would-block.pull/165/head
parent
150ad93a07
commit
2547a213e3
|
@ -4730,13 +4730,25 @@ static WS_SFTPNAME* wolfSSH_SFTP_DoName(WOLFSSH* ssh)
|
||||||
|
|
||||||
case SFTP_NAME_GET_PACKET:
|
case SFTP_NAME_GET_PACKET:
|
||||||
/* get number of files */
|
/* get number of files */
|
||||||
ret = wolfSSH_stream_read(ssh, state->data, state->sz);
|
/* using idx as an offset for partial reads */
|
||||||
if (ret < 0) {
|
ret = wolfSSH_stream_read(ssh,
|
||||||
|
state->data + state->idx, state->sz - state->idx);
|
||||||
|
if (ret <= 0) {
|
||||||
if (ssh->error != WS_WANT_READ) {
|
if (ssh->error != WS_WANT_READ) {
|
||||||
wolfSSH_SFTP_ClearState(ssh, STATE_ID_NAME);
|
wolfSSH_SFTP_ClearState(ssh, STATE_ID_NAME);
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
if ((word32)ret < state->sz - state->idx) {
|
||||||
|
/* Partial read, treat like a want-read. */
|
||||||
|
state->idx += ret;
|
||||||
|
ssh->error = WS_WANT_READ;
|
||||||
|
state->state = SFTP_NAME_GET_PACKET;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Reset idx back to 0 for parsing the buffer. */
|
||||||
|
state->idx = 0;
|
||||||
|
|
||||||
if (state->idx + UINT32_SZ > (word32)state->sz) {
|
if (state->idx + UINT32_SZ > (word32)state->sz) {
|
||||||
ssh->error = WS_BUFFER_E;
|
ssh->error = WS_BUFFER_E;
|
||||||
|
|
Loading…
Reference in New Issue