Skip to content

Fix the client-only and server-only builds - #1264

Open
ejohnstown wants to merge 3 commits into
wolfSSL:masterfrom
ejohnstown:no-client-no-server
Open

ejohnstown wants to merge 3 commits into
wolfSSL:masterfrom
ejohnstown:no-client-no-server

Conversation

@ejohnstown

@ejohnstown ejohnstown commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Both one-sided builds link and run their tests again. --disable-server was broken by a server-gated wolfSSH_RealPath() and by test programs that link examples/echoserver; --disable-client by test cases that drive a client session.

  • Compile wolfSSH_RealPath() whenever SFTP or SCP is on, because the SFTP client reaches it through wolfSSH_SFTP_SetDefaultPath().
  • Add BUILD_SERVER and BUILD_CLIENT conditionals, and gate api.test, testsuite.test, kex.test, auth.test and the scripts on the half they link.
  • Gate the client-session cases in regress.c and unit.c the way the server cases already are, leaving unit.test and regress.test in both builds.

Copilot AI lite review requested due to automatic review settings September 18, 2026 18:00

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

Unresolved critical and moderate findings remain in tests/include.am and tests/regress.c.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Fixes client-only and server-only builds by gating role-specific tests and scripts and making wolfSSH_RealPath() available to SFTP/SCP clients.

Changes:

  • Adds BUILD_SERVER and BUILD_CLIENT conditionals.
  • Gates endpoint-dependent tests and scripts.
  • Adjusts client/server test coverage and wolfSSH_RealPath() compilation.
File summaries
File Summary
tests/unit.c Gates server-specific SFTP tests.
tests/regress.c Gates client-session regression cases; a moderate unused-function issue remains.
tests/include.am Gates role-dependent test targets; api.test still needs a client-build gate (critical).
src/ssh.c Builds wolfSSH_RealPath() for SFTP/SCP clients.
scripts/include.am Gates integration scripts by required endpoint.
configure.ac Defines server/client Automake conditionals.
Review details

Suppressed comments (1)

tests/regress.c:16437

  • This gates the only call to TestTerminalResizeBlockedAfterDisconnect() in a NO_WOLFSSH_CLIENT build, but the function definition at lines 11843-11880 is still compiled under only WOLFSSH_TERM && !NO_FILESYSTEM. That leaves a static function unused (and the project builds with -Wall in its compiler matrix), so the one-sided build can fail on -Wunused-function; put the same client guard around the definition or mark it WS_MAYBE_UNUSED.
#if defined(WOLFSSH_TERM) && !defined(NO_FILESYSTEM) \
    && !defined(NO_WOLFSSH_CLIENT)
  • Files reviewed: 6/6 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tests/include.am
A --disable-server build now links, and make check builds and runs what
does not need a server. wolfSSH_RealPath() is compiled whenever SFTP or
SCP is enabled, because the SFTP client reaches it through
wolfSSH_SFTP_SetDefaultPath(), and the test programs that link
examples/echoserver are built only when the server half is.

- Drop the server term from the wolfSSH_RealPath() guard in ssh.c; the
  block holds that one function.
- Add BUILD_SERVER and BUILD_CLIENT conditionals off the existing
  ENABLED_SERVER and ENABLED_CLIENT.
- Gate api.test on the server, testsuite.test, kex.test, auth.test and
  every script on both halves; unit.test and regress.test stay.
- Gate unit.c's wolfSSH_SFTP_read() tests on the server and share their
  want-read IORecv mock with the client tests below them.
regress.test now builds and runs in a --disable-client tree. The cases
that drive a client session are compiled only when the client half is,
matching the NO_WOLFSSH_SERVER gates already around the server cases.
Without the client, IsMessageAllowed() denies every message, so those
cases asserted against a session that refuses everything.

- Gate the message-policy run, the disconnect and shutdown families, the
  EXT_INFO and algorithm-negotiation cases, and their driver calls.
- Mark the seven helpers whose only callers are now gated out
  WS_MAYBE_UNUSED rather than move them.
EXT_INFO is a transport-generic message, so a server session parses it
too, RFC 8308 section 2.3. These cases call DoExtInfo() directly and
never reach the message filter, so they run in a server-only build as
well as a client-only one, keeping the name-list bounds covered on both
sides.
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.

2 participants