Skip to content

Commit

Permalink
Merge pull request #559 from JacobBarthelmeh/sftp-fix
Browse files Browse the repository at this point in the history
fix for SFTP interop
  • Loading branch information
SparkiDev authored Aug 22, 2023
2 parents 1015a8b + c651fc7 commit 601682c
Showing 1 changed file with 31 additions and 9 deletions.
40 changes: 31 additions & 9 deletions src/internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -5838,17 +5838,39 @@ static int DoUserAuthRequestPublicKey(WOLFSSH* ssh, WS_UserAuthData* authData,
ret = ssh->ctx->userAuthCb(WOLFSSH_USERAUTH_PUBLICKEY,
authData, ssh->userAuthCtx);
WLOG(WS_LOG_DEBUG, "DUARPK: callback result = %d", ret);
if (ret == WOLFSSH_USERAUTH_SUCCESS) {
ret = WS_SUCCESS;
}
else if (ret == WOLFSSH_USERAUTH_INVALID_PUBLICKEY) {
WLOG(WS_LOG_DEBUG, "DUARPK: client key rejected");
authFailure = 1;
ret = WS_SUCCESS;
#ifdef DEBUG_WOLFSSH
switch (ret) {
case WOLFSSH_USERAUTH_INVALID_PUBLICKEY:
WLOG(WS_LOG_DEBUG, "DUARPK: client key invalid");
break;

case WOLFSSH_USERAUTH_INVALID_USER:
WLOG(WS_LOG_DEBUG, "DUARPK: public key user rejected");
break;


case WOLFSSH_USERAUTH_FAILURE:
WLOG(WS_LOG_DEBUG, "DUARPK: public key general failure");
break;

case WOLFSSH_USERAUTH_INVALID_AUTHTYPE:
WLOG(WS_LOG_DEBUG, "DUARPK: public key invalid auth type");
break;

case WOLFSSH_USERAUTH_REJECTED:
WLOG(WS_LOG_DEBUG, "DUARPK: public key rejected");
break;

default:
WLOG(WS_LOG_DEBUG,
"Unexpected return value from Auth callback");
}
else {
#endif

if (ret != WOLFSSH_USERAUTH_SUCCESS) {
authFailure = 1;
}
ret = WS_SUCCESS;
}
else {
WLOG(WS_LOG_DEBUG, "DUARPK: no userauth callback set");
Expand Down Expand Up @@ -7660,7 +7682,7 @@ int DoReceive(WOLFSSH* ssh)
+ peerBlockSz,
ssh->inputBuffer.buffer + ssh->inputBuffer.idx
+ peerBlockSz,
ssh->curSz - peerBlockSz);
UINT32_SZ + ssh->curSz - peerBlockSz);
}
else {
/* Entire packet fit in one block, don't need
Expand Down

0 comments on commit 601682c

Please sign in to comment.