Commit Graph

14 Commits (57dfc44c93bfe00b4e64bf6a4e3051dfefd4d4da)

Author SHA1 Message Date
John Safranek 41fb47b205 scp: receive through a per-session dirfd
The default SCP receive callback keeps its destination per session, the
base path plus each directory entered, in place of the process working
directory that every session of a threaded server shares. With openat()
it holds that directory open, reaches it and everything created below
it with O_NOFOLLOW, and confirms a reopened parent is the one entered.

- port.h gains WOPENAT, WMKDIRAT, WOLFSSH_O_SEARCH with a search check
  as chdir() made, and WOLFSSH_HAVE_DIRFD, which sizes WOLFSSH so it
  keys only on configure's openat() probe; WOLFSSH_NO_DIRFD opts out
- ports without them open by the full path after a wIsDirNoFollow()
  screen of the base and of each directory entered; a refused base
  frees the receive path
- the receive path is capped at DEFAULT_SCP_FILE_NAME_SZ like the
  send side's; futimes() stands in for futimens() on hosts with
  openat() but not futimens(), such as macOS before 10.13
- unit: ScpRecvCallback_SessionPath walks down and back with the
  working directory untouched, then has the tree moved out from under
  it; a linked base and a file-named directory are refused
- scp.test: a planted symlink at the destination name keeps its target;
  scp-test.yml also builds and tests the fallback

Issue: F-14758, F-13998
2026-10-15 17:14:34 -05:00
John Safranek 96d6c0db50 scripts: widen the ready-file wait to ten seconds
The sftp, scp and get-put scripts wait for the echoserver to publish its
port before connecting. Two seconds is not enough for a libtool re-exec,
the dynamic linker and the sample-key parse with a dozen sibling test
jobs on the machine, so a parallel make check failed them at their first
scenario. Ten seconds matches what sshclient.test already allows.

- raise the three wait loops from 20 to 100 iterations of 0.1 seconds
- test -s, not -e, after the loop in scp.test and get-put.test: the
  ready file is created empty and the port written afterward, so -e can
  take a file caught mid-write and yield an empty port
2026-09-17 15:04:26 +02:00
John Safranek 46795b1ef2 tests: cover the app-driven sftp and shell paths
The -A cases in scp.test reach the exec callback and the scp handoff.
These drive the rest: the subsystem callback with the sftp accept, the
shell callback in echo mode, and both accepts on a blocking server.

- sftp.test connects to an -A server blocking and non-blocking
- sshclient.test runs a terminal session and a command session against
  an -A server
- scp.test copies from a blocking -A server, where wolfSSH_SCP_accept()
  completes in one call rather than through the retry loop
2026-09-15 09:31:16 -07:00
John Safranek 6b954da7f7 tests: cover the application-driven SCP start
The echoserver's -A mode runs an accepted scp command through
wolfSSH_SCP_accept(). Reaching that call's want retry path takes a
non-blocking server, which -N supplies.

- copy to and from an app-driven server in scp.test
- check the entry point's null-session argument
2026-09-15 09:31:16 -07:00
John Safranek 754317b6bf Use wolfssh-options in the test scripts
The scripts now read the build options from the probe instead of grepping
usage text, config.log and daemon logs. Drops the usage lines only tests read.
2026-08-19 16:55:00 -07:00
Paul Adelsbach d7e99dc0a4 Address CI UBSan timeouts 2026-07-21 18:06:37 -05:00
Yosuke Shimizu c8a347de85 Reject symlinks in default SCP send callback 2026-06-23 14:37:57 -07:00
Andrew Hutchings 33203c3aca Add contention testing
Simulate netowrk latency using netem and use it to test the non-blocking
mode of SFTP. This helps find issues which would affect running an SFTP
server on a microcontroller. It helped find the bug fixed in #876.
2026-02-16 06:42:32 +00:00
John Safranek a4f860d071 Release v1.4.18: Release Fixes
1. Update scp.test to delete the empty test file.
2. In wolfSSHd, when coverting an IP address to a printable
   representation, the destination needs to be able to handle IPv6
   addresses potentially.
2024-07-19 14:38:07 -07:00
JacobBarthelmeh 7d6fbcf770 add test case 2024-05-23 13:57:23 -06:00
JacobBarthelmeh 5780570880 limit additional nonblocking test 2023-09-29 16:12:21 -07:00
Anthony Hu bca1ac4ed2 Generate and clean up empty file. 2022-03-28 11:51:53 -04:00
Anthony Hu 9dc6366178 Stop over-zealously checking application return code. 2022-03-25 10:55:25 -04:00
Anthony Hu f589ea275d Add tests for scp, even empty file transfer. 2022-03-25 10:23:11 -04:00