From 0ce976a80215cfa811a4f6e83030b34ecc1074b6 Mon Sep 17 00:00:00 2001 From: JacobBarthelmeh Date: Thu, 25 Aug 2022 15:59:30 -0700 Subject: [PATCH] fix for connecting to servers that only offer public key --- src/internal.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/internal.c b/src/internal.c index a7263d9d..5dc8d656 100644 --- a/src/internal.c +++ b/src/internal.c @@ -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) {