Skip to content

Return nonzero from s_server when the TLS handshake fails. - #306

Open
kareem-wolfssl wants to merge 2 commits into
wolfSSL:mainfrom
kareem-wolfssl:gh305
Open

kareem-wolfssl wants to merge 2 commits into
wolfSSL:mainfrom
kareem-wolfssl:gh305

Conversation

@kareem-wolfssl

Copy link
Copy Markdown
Contributor

Fixes #305

@kareem-wolfssl
kareem-wolfssl requested review from wolfSSL-Fenrir-bot and a balanced review from Copilot December 4, 2026 00:30
@kareem-wolfssl kareem-wolfssl self-assigned this Dec 4, 2026
@kareem-wolfssl

Copy link
Copy Markdown
Contributor Author

@claude review

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The test incorrectly expects exit code 255 on Windows, where the actual code is 4294967295, causing Windows CI to fail even when the server correctly reports failure.

1 open issue
What changed in this PR

Addresses #305 by making s_server report TLS handshake failures through its process exit status.

Changes:

  • Preserve handshake errors through server cleanup.
  • Propagate server failures to the command’s return status.
  • Test successful and failed handshakes, including server exit codes.
File Description
tests/​server/​server-test.py Adds failure coverage and checks server exit status.
src/​server/​server.c Preserves handshake errors through cleanup.
src/​server/​clu_server_setup.c Logs and propagates server failures.

Review effort: Balanced

Comment thread tests/server/server-test.py Resolved

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Fenrir Automated Review — PR #306

Scan targets checked: wolfclu-src, wolfclu-bugs
Not reviewed (no scan target covers them): tests/server/server-test.py
Coverage: 2 of 2 in-scope changed file(s) opened by the reviewer

Fenrir result: Approved ✅

No new issues found in the changed files.

Advisory only — this automated result does not count as a GitHub approval.

Review tier: Max

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM. This is a small, self-contained fix, and a new regression test covers the failure path.

What was reviewed:

  • acceptErr in server.c is set only on the non-exitWithRet accept-failure branch and copied to return_code only at normal cleanup. The exitWithRet path still sets err and jumps to exit. With -naccept above 1, one failed accept is enough to make the server exit nonzero.
  • Every other goto exit in server_test already sets return_code before jumping, and the value starts at -1. So the new check in clu_server_setup.c also turns those existing error exits (for example a cert load failure or an echo error) into a 255 exit, where before they exited 0. That looks like the intended effect.
  • The tests now wait for the server to exit on its own instead of terminating it, so test_server_client also checks that a successful run exits 0.
Extended reasoning...

The change touches three files: s_server's exit-status reporting in src/server/server.c (a new acceptErr local), a check of args.return_code in src/server/clu_server_setup.c, and the Python server tests. TLS handshake logic, crypto and certificate handling are unchanged; only how an existing failure gets reported is new. The diff is about 40 lines, and every return_code path in server_test was checked to be initialized before wolfCLU_Server reads it. No CODEOWNERS or OWNERS files cover these paths, and the timeline shows no outstanding reviewer objections. The bug hunt finished with dry_streak and reported no findings.

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.

wolfCLU server returns process success after a failed TLS handshake

3 participants