mirror of https://github.com/wolfSSL/wolfssh.git
Update sftpclient
1. Update the example SFTP client with changes made for the echoserver. 2. Better handling of rekeying status.pull/509/head
parent
7e7c5553df
commit
35554745bc
|
|
@ -501,8 +501,14 @@ static int doCmds(func_args* args)
|
|||
if (ret != WS_SUCCESS && ret == WS_FATAL_ERROR) {
|
||||
ret = wolfSSH_get_error(ssh);
|
||||
}
|
||||
while (ret == WS_REKEYING || ssh->error == WS_REKEYING) {
|
||||
ret = wolfSSH_worker(ssh, NULL);
|
||||
if (ret != WS_SUCCESS && ret == WS_FATAL_ERROR) {
|
||||
ret = wolfSSH_get_error(ssh);
|
||||
}
|
||||
}
|
||||
} while (ret == WS_WANT_READ || ret == WS_WANT_WRITE ||
|
||||
ret == WS_CHAN_RXD || ret == WS_REKEYING);
|
||||
ret == WS_CHAN_RXD);
|
||||
|
||||
#ifndef WOLFSSH_NO_TIMESTAMP
|
||||
WMEMSET(currentFile, 0, WOLFSSH_MAX_FILENAME);
|
||||
|
|
|
|||
|
|
@ -7411,7 +7411,8 @@ int DoReceive(WOLFSSH* ssh)
|
|||
ret = DoPacket(ssh);
|
||||
ssh->error = ret;
|
||||
if (ret < 0 && !(ret == WS_CHAN_RXD || ret == WS_EXTDATA ||
|
||||
ret == WS_CHANNEL_CLOSED || ret == WS_WANT_WRITE)) {
|
||||
ret == WS_CHANNEL_CLOSED || ret == WS_WANT_WRITE ||
|
||||
ret == WS_REKEYING)) {
|
||||
return WS_FATAL_ERROR;
|
||||
}
|
||||
WLOG(WS_LOG_DEBUG, "PR3: peerMacSz = %u", peerMacSz);
|
||||
|
|
|
|||
|
|
@ -1104,6 +1104,7 @@ int wolfSSH_stream_send(WOLFSSH* ssh, byte* buf, word32 bufSz)
|
|||
return WS_BAD_ARGUMENT;
|
||||
|
||||
if (ssh->isKeying) {
|
||||
ssh->error = WS_REKEYING;
|
||||
return WS_REKEYING;
|
||||
}
|
||||
|
||||
|
|
@ -1786,11 +1787,16 @@ int wolfSSH_worker(WOLFSSH* ssh, word32* channelId)
|
|||
*channelId = ssh->lastRxId;
|
||||
}
|
||||
|
||||
if (ssh->isKeying) {
|
||||
ssh->error = WS_REKEYING;
|
||||
return WS_REKEYING;
|
||||
}
|
||||
|
||||
if (ret == WS_CHAN_RXD)
|
||||
WLOG(WS_LOG_DEBUG, "Leaving wolfSSH_worker(), "
|
||||
"data received on channel %u", ssh->lastRxId);
|
||||
else {
|
||||
if (ret == WS_SUCCESS && ssh->isKeying) {
|
||||
if (ret != WS_SUCCESS && ssh->isKeying) {
|
||||
ret = WS_REKEYING;
|
||||
}
|
||||
WLOG(WS_LOG_DEBUG, "Leaving wolfSSH_worker(), ret = %d", ret);
|
||||
|
|
|
|||
|
|
@ -404,7 +404,8 @@ static INLINE int NoticeError(WOLFSSH* ssh)
|
|||
{
|
||||
return (ssh->error == WS_WANT_READ ||
|
||||
ssh->error == WS_WANT_WRITE ||
|
||||
ssh->error == WS_CHAN_RXD);
|
||||
ssh->error == WS_CHAN_RXD ||
|
||||
ssh->error == WS_REKEYING);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -6927,6 +6928,9 @@ int wolfSSH_SFTP_SendReadPacket(WOLFSSH* ssh, byte* handle, word32 handleSz,
|
|||
/* send header and type specific data */
|
||||
ret = wolfSSH_SFTP_buffer_send(ssh, &state->buffer);
|
||||
if (ret < 0) {
|
||||
if (ret == WS_REKEYING) {
|
||||
return ret;
|
||||
}
|
||||
if (ssh->error != WS_WANT_READ &&
|
||||
ssh->error != WS_WANT_WRITE) {
|
||||
state->state = STATE_SEND_READ_CLEANUP;
|
||||
|
|
|
|||
Loading…
Reference in New Issue