Skip to content

Conversation

@ejohnstown
Copy link
Contributor

  1. Snip out some extraneous states from the server handshake tracking for accept.
  2. Change sending the keyboard interactive info response to a reaction to a request.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request refactors the keyboard interactive authentication handling in the server by removing extraneous state entries and modifying how the keyboard interactive response is sent.

  • Remove unnecessary keyboard interactive states from the state machine.
  • Eliminate the repeated while-loop sending keyboard interactive responses in favor of a direct response call.
  • Update internal state transitions to streamline the authentication process.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
wolfssh/internal.h Removed extraneous keyboard interactive state definitions.
src/ssh.c Deleted the while-loop that was managing keyboard interactive responses.
src/internal.c Consolidated state transitions and modified DoUserAuthInfoRequest to call SendUserAuthKeyboardResponse directly.
Comments suppressed due to low confidence (4)

wolfssh/internal.h:1154

  • Removing the extraneous keyboard interactive states simplifies the state machine. Please verify that no other part of the codebase depends on these removed states.
-    SERVER_USERAUTH_ACCEPT_KEYBOARD,

src/ssh.c:890

  • The removal of the loop that repeatedly sends the keyboard interactive response streamlines the connection logic. Ensure that the new triggering mechanism for sending the response adequately covers all required scenarios.
while (ssh->serverState == SERVER_USERAUTH_ACCEPT_KEYBOARD) { ... }

src/internal.c:7898

  • The refactoring to directly assign SERVER_USERAUTH_ACCEPT_DONE simplifies state progression. Please confirm that all necessary cleanup associated with a keyboard interactive session is still handled correctly.
-    if (ssh->serverState == SERVER_USERAUTH_ACCEPT_KEYBOARD)
-        ssh->serverState = SERVER_USERAUTH_ACCEPT_KEYBOARD_DONE;
-    else

src/internal.c:8027

  • Switching to an immediate call to SendUserAuthKeyboardResponse in DoUserAuthInfoRequest clarifies response handling. Make sure that the error handling and subsequent state transitions align with the overall authentication flow.
if (ret == WS_SUCCESS) { ret = SendUserAuthKeyboardResponse(ssh); }

@ejohnstown ejohnstown requested a review from dgarske May 2, 2025 17:17
@dgarske dgarske removed their request for review May 5, 2025 19:38
1. Snip out some extraneous states from the server handshake tracking
   for accept.
2. Change sending the keyboard interactive info response to a reaction
   to a request.
Copy link
Member

@LinuxJedi LinuxJedi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call!

@LinuxJedi LinuxJedi merged commit ee9bc3b into wolfSSL:master May 6, 2025
93 checks passed
@ejohnstown ejohnstown deleted the kb-fix branch May 6, 2025 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants