Skip to content

wolfsshd: fix shell and SCP session setup - #1346

Closed
ejohnstown wants to merge 3 commits into
wolfSSL:masterfrom
ejohnstown:sshd-shell
Closed

ejohnstown wants to merge 3 commits into
wolfSSL:masterfrom
ejohnstown:sshd-shell

Conversation

@ejohnstown

Copy link
Copy Markdown
Contributor

Fixes to how wolfsshd starts and tears down shell, exec and SCP
sessions, and to terminal mode handling in wolfSSH_DoModes().

  • DoModes() returns -1 when the tty cannot be read or set, and
    wolfsshd logs it
  • A child killed by a signal exits with 128 plus the signal
  • A failed post-fork setup kills and reaps the child and closes its
    descriptors
  • SCP starts in the user's home, as the shell and SFTP do

Issue: F-10546, F-13327, F-14203, F-14204, F-15571, F-15502

wolfSSH_DoModes() now returns -1 without touching the terminal when
tcgetattr() fails, instead of applying an uninitialized termios. A
failed tcsetattr() is reported the same way, and wolfsshd logs it.

- api.c: DoModes fails on a pipe and sets ECHO on a pty

Issue: F-10546
A shell child killed by a signal now reports 128 plus the signal as
its exit status. A failure after the fork kills and reaps the child
and closes the parent's descriptors to it, and the resize context is
cleared before the terminal it points at is closed.

- SHELL_AbortChild() serves the post-fork setup failures
- -r with no command now fails at the argument check in main()
- sshd_exit_signal_test.sh checks a plain exit and a SIGKILL

Issue: F-13327, F-14203, F-15571, F-14204
SCP_Subsystem() changes to pw_dir after dropping privileges, as the
shell and SFTP do, so a relative remote path resolves from home rather
than from the daemon's working directory, inside a chroot too. When
home is unreachable, SCP and the shell start from "/", as OpenSSH does.
Both log that only outside a chroot.

- sshd_scp_home_test.sh uploads to "." and finds the file in home

Issue: F-15502
Copilot AI balanced review requested due to automatic review settings October 28, 2026 22: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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@ejohnstown

Copy link
Copy Markdown
Contributor Author

Duplicate of #1341, which already carries these three commits. The review fixes made here (a pty case in the DoModes test, and no missing-home log for the shell inside a chroot) are now folded into #1341.

@ejohnstown ejohnstown closed this Oct 28, 2026
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