Skip to content

Commit 4862400

Browse files
fix spelling issues and SFTP send state
1 parent cc17941 commit 4862400

File tree

5 files changed

+17
-13
lines changed

5 files changed

+17
-13
lines changed

.github/workflows/sshd-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
wolfssl: ${{ fromJson(needs.create_matrix.outputs['versions']) }}
6767
name: Build and test wolfsshd
6868
runs-on: ${{ matrix.os }}
69-
timeout-minutes: 15
69+
timeout-minutes: 10
7070
steps:
7171
- name: Checking cache for wolfssl
7272
uses: actions/cache@v4

examples/client/client.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,10 +481,10 @@ static THREAD_RET readPeer(void* in)
481481
}
482482
}
483483
else if (ret != WS_EOF) {
484-
if (ret == 0) {
484+
if (ret == 0) {
485485
bytes = 0;
486486
continue;
487-
}
487+
}
488488
err_sys("Stream read failed.");
489489
}
490490
}

examples/sftpclient/sftpclient.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,7 +1184,7 @@ static int doAutopilot(int cmd, char* local, char* remote)
11841184
}
11851185

11861186
do {
1187-
if (err == WS_REKEYING) { /* handle rekeying state */
1187+
if (err == WS_REKEYING || err == WS_WINDOW_FULL) { /* handle rekeying state */
11881188
do {
11891189
ret = wolfSSH_worker(ssh, NULL);
11901190
} while (ret == WS_REKEYING);
@@ -1198,7 +1198,8 @@ static int doAutopilot(int cmd, char* local, char* remote)
11981198
}
11991199
err = wolfSSH_get_error(ssh);
12001200
} while ((err == WS_WANT_READ || err == WS_WANT_WRITE ||
1201-
err == WS_CHAN_RXD || err == WS_REKEYING) &&
1201+
err == WS_CHAN_RXD || err == WS_REKEYING ||
1202+
err == WS_WINDOW_FULL) &&
12021203
ret == WS_FATAL_ERROR);
12031204

12041205
if (ret != WS_SUCCESS) {
@@ -1504,7 +1505,7 @@ THREAD_RETURN WOLFSSH_THREAD sftpclient_test(void* args)
15041505
ret = wolfSSH_worker(ssh, NULL);
15051506
err = wolfSSH_get_error(ssh);
15061507

1507-
/* peer succesfully closed down gracefully */
1508+
/* peer successfully closed down gracefully */
15081509
if (ret == WS_CHANNEL_CLOSED) {
15091510
ret = 0;
15101511
break;

src/internal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ INLINE static int IsMessageAllowedKeying(WOLFSSH *ssh, byte msg)
605605
return 1;
606606
}
607607

608-
/* case of servie request or accept in 1-19 */
608+
/* case of service request or accept in 1-19 */
609609
if (msg == MSGID_SERVICE_REQUEST || msg == MSGID_SERVICE_ACCEPT) {
610610
WLOG(WS_LOG_DEBUG, "Message ID %u not allowed by during rekeying", msg);
611611
ssh->error = WS_REKEYING;

src/wolfsftp.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,7 @@ static INLINE int NoticeError(WOLFSSH* ssh)
416416
return (ssh->error == WS_WANT_READ ||
417417
ssh->error == WS_WANT_WRITE ||
418418
ssh->error == WS_CHAN_RXD ||
419+
ssh->error == WS_WINDOW_FULL ||
419420
ssh->error == WS_REKEYING);
420421
}
421422

@@ -865,7 +866,6 @@ static int SFTP_GetHeader(WOLFSSH* ssh, word32* reqId, byte* type,
865866
*/
866867
static int SFTP_SetHeader(WOLFSSH* ssh, word32 reqId, byte type, word32 len,
867868
byte* buf) {
868-
869869
c32toa(len + LENGTH_SZ + MSG_ID_SZ, buf);
870870
buf[LENGTH_SZ] = type;
871871
c32toa(reqId, buf + LENGTH_SZ + MSG_ID_SZ);
@@ -7471,12 +7471,15 @@ int wolfSSH_SFTP_SendWritePacket(WOLFSSH* ssh, byte* handle, word32 handleSz,
74717471
case STATE_SEND_WRITE_SEND_BODY:
74727472
WLOG(WS_LOG_SFTP, "SFTP SEND_WRITE STATE: SEND_BODY");
74737473
state->sentSz = wolfSSH_stream_send(ssh, in, inSz);
7474-
if (NoticeError(ssh)) {
7475-
return WS_FATAL_ERROR;
7476-
}
74777474
if (state->sentSz <= 0) {
7478-
ssh->error = state->sentSz;
74797475
ret = WS_FATAL_ERROR;
7476+
if (NoticeError(ssh)) {
7477+
ret = wolfSSH_worker(ssh,NULL);
7478+
continue;
7479+
}
7480+
7481+
/* if it was not a notice error then clean up the state and
7482+
* exit out */
74807483
state->state = STATE_SEND_WRITE_CLEANUP;
74817484
continue;
74827485
}
@@ -9170,7 +9173,7 @@ int wolfSSH_SFTP_Put(WOLFSSH* ssh, char* from, char* to, byte resume,
91709173
if (sz <= 0) {
91719174
if (NoticeError(ssh)) {
91729175
return WS_FATAL_ERROR;
9173-
}
9176+
}
91749177
}
91759178
else {
91769179
AddAssign64(state->pOfst, sz);

0 commit comments

Comments
 (0)