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.
pull/1051/head
John Safranek 2026-06-26 13:58:37 -07:00 committed by Aidan Garske
parent a2a78da28a
commit ac762368ac
1 changed files with 7 additions and 1 deletions

View File

@ -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