fix for connecting to servers that only offer public key

pull/450/head
JacobBarthelmeh 2022-08-25 15:59:30 -07:00
parent 67878bbec2
commit 0ce976a802
1 changed files with 3 additions and 1 deletions

View File

@ -10382,7 +10382,9 @@ int SendUserAuthRequest(WOLFSSH* ssh, byte authId, int addSig)
}
}
/* fall into public key case if password case was not successful */
if ((ret == WS_FATAL_ERROR) && (authId & WOLFSSH_USERAUTH_PUBLICKEY)) {
if ((ret == WS_FATAL_ERROR ||
!(authId & WOLFSSH_USERAUTH_PASSWORD)) &&
(authId & WOLFSSH_USERAUTH_PUBLICKEY)) {
ret = ssh->ctx->userAuthCb(WOLFSSH_USERAUTH_PUBLICKEY,
&authData, ssh->userAuthCtx);
if (ret != WOLFSSH_USERAUTH_SUCCESS) {