Skip to content

Embedded client-only build guards - #1272

Open
ejohnstown wants to merge 3 commits into
wolfSSL:masterfrom
ejohnstown:embedded-client-guards
Open

ejohnstown wants to merge 3 commits into
wolfSSL:masterfrom
ejohnstown:embedded-client-guards

Conversation

@ejohnstown

@ejohnstown ejohnstown commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

More guard fixes for embedded client-only builds: the terminal code no longer needs a filesystem, SCP builds client-only, and regress.c compiles in both one-sided configurations.

  • The WOLFSSH_TERM code drops its NO_FILESYSTEM guard; the ioctl, console and termios pieces are guarded on their own, and default modes are sent without termios
  • wolfSSH_CleanPath() and wolfSSH_GetPath() build for any SFTP or SCP build, since wolfscp.c builds its server half client-only too
  • The settings.h error rejecting a client-only SCP build is removed
  • regress.c gates the TestKb*() calls on NO_WOLFSSH_SERVER and gives the SFTP attribute test its own WOLFSSH_SFTP block

@ejohnstown
ejohnstown requested review from wolfSSL-Fenrir-bot and a lite review from Copilot September 23, 2026 00:43

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

Scan targets checked: wolfssh-src, wolfssh-bugs

Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)

This review was generated automatically by Fenrir. Reported findings require changes before merge.

Comment thread src/internal.c

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.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

Review effort: Lite
Findings: 1 Medium severity · 3 Low severity

Open (4)
What changed in this PR

This PR improves compatibility for embedded and client-only builds by relaxing server-only compile guards and tightening test conditionals so code compiles cleanly across one-sided configurations.

Changes:

  • Remove the hard error that rejected client-only SCP builds.
  • Build path helpers (e.g., wolfSSH_GetPath) for SCP/SFTP in both client-only and server-enabled configurations.
  • Gate regress tests so server-only keyboard-interactive tests and SFTP-only attribute tests compile in one-sided builds.
File Description
wolfssh/​settings.h Removes compile-time rejection for client-only SCP builds.
wolfssh/​internal.h Exposes wolfSSH_GetPath for any SCP/SFTP build (not server-only).
src/​internal.c Enables path helper compilation for client-only SCP/SFTP and adjusts terminal guard.
src/​ssh.c Enables terminal request/resize code without requiring filesystem support.
tests/​regress.c Adds build guards around server-only kb tests and SFTP-only attribute tests.

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

Comment thread tests/regress.c
Comment thread tests/regress.c Outdated
Comment thread tests/regress.c
Comment thread tests/regress.c Outdated

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

Scan targets checked: wolfssh-src, wolfssh-bugs

Fenrir result: Approved ✅

No new issues found in the changed files.

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

@wolfSSL-Fenrir-bot
wolfSSL-Fenrir-bot dismissed their stale review September 23, 2026 04:15

Fenrir's latest completed scan found no issues; clearing the prior automated change request.

The terminal code is compiled for any WOLFSSH_TERM build. The window
dimensions come from an ioctl or the console API and the terminal modes
from termios, each already guarded on its own, so a client on a target
without a filesystem can request a PTY and send its modes.

- <unistd.h> is included beside <termios.h> and <sys/ioctl.h>, since
  port.h only pulls it in for a filesystem build
wolfscp.c builds its server half in a client-only build too, and that
code calls wolfSSH_CleanPath(). Compile it and wolfSSH_GetPath()
whenever SFTP or SCP is enabled, not just for a server build.

- SCP's client half is guarded on NO_WOLFSSH_CLIENT, so the settings.h
  error rejecting a client-only SCP build goes with it

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

Scan targets checked: none
Unchanged since last review (not re-run): wolfssh-src, wolfssh-bugs

Fenrir result: Approved ✅

No new issues found in the changed files.

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

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

Looks good, with 3 nits / suggestions:

  1. should there be a workflow that combines WOLFSSH_TERM && NO_FILESYSTEM? It looks like they're only tested in separation.
$grep -rl  "WOLFSSH_TERM" .github/*
.github/workflows/sbom.yml

$grep -rl "NO_FILESYSTEM" .github/*
.github/workflows/os-check.yml
  1. I don't see any NO_WOLFSSH_SERVER or disable-server workflows. If (SCP || SFTP) && NO_WOLFSSH_SERVER is valid now, then a workflow combining that could be good.

  2. I think the copilot nit was correct (see below).

Comment thread tests/regress.c Outdated
wolfSSH_free(ssh);
wolfSSH_CTX_free(ctx);
}
#endif /* WOLFSSH_SFTP */

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Unless I'm misreading I think copilot was right.

It looks like:

#ifdef WOLFSSH_SFTP
#ifndef NO_WOLFSSH_CLIENT
...blahblah...
#endif /* WOLFSSH_SFTP */
#endif /* !NO_WOLFSSH_CLIENT */ (the comments are reversed)

#ifdef WOLFSSH_SFTP
/* fenrir 2479: the attribute encoder and decoder must agree. Extensions are

The ifdef WOLFSSH_SFTP is the outer scope

@ejohnstown ejohnstown Sep 23, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that's a good catch. I just needed to reread it again. Fixed.

I also combined the two define checks into a compound check.

regress.c compiles in a client-only build with keyboard-interactive
and in a server-only build with SFTP.

- the TestKb*() calls are gated on NO_WOLFSSH_SERVER like their
  definitions
- the #endif lines after TestOct2DecRejectsInvalidNonLeadingDigit()
  close both of its guards, and the attribute test has its own
  WOLFSSH_SFTP block
@ejohnstown
ejohnstown force-pushed the embedded-client-guards branch from cb316fc to bca8449 Compare September 23, 2026 22:08
@ejohnstown
ejohnstown requested a review from philljj September 23, 2026 22:08
@ejohnstown ejohnstown removed their assignment Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants