diff --git a/src/internal.c b/src/internal.c index 29973d722..2cb19060a 100644 --- a/src/internal.c +++ b/src/internal.c @@ -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"); @@ -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