From ac762368acb11e1cf226e9329611a2ba66fd0643 Mon Sep 17 00:00:00 2001 From: John Safranek Date: Fri, 26 Jun 2026 13:58:37 -0700 Subject: [PATCH] Fix keyboard-interactive without TERM Keyboard-interactive was unusable in builds with WOLFSSH_KEYBOARD_INTERACTIVE but no WOLFSSH_TERM, in two ways. - ClientFreeBuffers declared 'entry' under TERM && KBI but used it under KBI alone, so KBI-without-TERM failed to compile; widen the declaration guard to match the use - ClientUserAuth's keyboard-interactive branch is guarded on TERM && KBI, so without TERM a keyboard-interactive request fell past every branch and returned the initial WOLFSSH_USERAUTH_SUCCESS with no responses populated. There is no terminal to prompt on, so answer WOLFSSH_USERAUTH_FAILURE instead of claiming success. --- examples/client/common.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/examples/client/common.c b/examples/client/common.c index ed7e33d7..0bc01973 100644 --- a/examples/client/common.c +++ b/examples/client/common.c @@ -606,6 +606,12 @@ int ClientUserAuth(byte authType, } } } +#elif defined(WOLFSSH_KEYBOARD_INTERACTIVE) + else if (authType == WOLFSSH_USERAUTH_KEYBOARD) { + /* Without a terminal there is nowhere to prompt for the responses, so + * this build cannot answer a keyboard-interactive request. */ + ret = WOLFSSH_USERAUTH_FAILURE; + } #endif return ret; } @@ -1118,7 +1124,7 @@ int ClientLoadCA(WOLFSSH_CTX* ctx, const char* caCert) void ClientFreeBuffers(const char* pubKeyName, const char* privKeyName, void* heap) { -#if defined(WOLFSSH_TERM) && defined(WOLFSSH_KEYBOARD_INTERACTIVE) +#ifdef WOLFSSH_KEYBOARD_INTERACTIVE word32 entry; #endif #ifdef WOLFSSH_TPM