From 049e40bb1c5c20ff9bc335ffba07aa44c92735a2 Mon Sep 17 00:00:00 2001 From: JacobBarthelmeh Date: Mon, 26 Jun 2023 22:58:28 -0700 Subject: [PATCH] better handling of window full cases with SFTP --- apps/wolfsshd/wolfsshd.c | 11 ++++++++++- src/internal.c | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/apps/wolfsshd/wolfsshd.c b/apps/wolfsshd/wolfsshd.c index 08a07ee2..cfd552f7 100644 --- a/apps/wolfsshd/wolfsshd.c +++ b/apps/wolfsshd/wolfsshd.c @@ -579,6 +579,14 @@ static int SFTP_Subsystem(WOLFSSHD_CONNECTION* conn, WOLFSSH* ssh, timeout = TEST_SFTP_TIMEOUT; continue; } + + if (error == WS_WANT_READ || error == WS_WANT_WRITE || + error == WS_WINDOW_FULL) { + timeout = TEST_SFTP_TIMEOUT; + ret = error; + continue; + } + if (error == WS_EOF) { break; } @@ -598,8 +606,9 @@ static int SFTP_Subsystem(WOLFSSHD_CONNECTION* conn, WOLFSSH* ssh, error == WS_CHAN_RXD || error == WS_REKEYING || error == WS_WINDOW_FULL) ret = error; - if (error == WS_EOF) + if (error == WS_EOF) { break; + } continue; } diff --git a/src/internal.c b/src/internal.c index bca2c4a7..be2c5d83 100644 --- a/src/internal.c +++ b/src/internal.c @@ -12421,6 +12421,7 @@ int SendChannelData(WOLFSSH* ssh, word32 channelId, if (ret == WS_SUCCESS) { if (channel->peerWindowSz == 0) { WLOG(WS_LOG_DEBUG, "channel window is full"); + ssh->error = WS_WINDOW_FULL; ret = WS_WINDOW_FULL; } }