Commit Graph

13 Commits (10d97e151fbab0c8d06be441cdc8c2e121bca65d)

Author SHA1 Message Date
John Safranek ff59c723ec Handle the EOF status in apps and examples
Every in-tree caller of wolfSSH_worker() now recognises a peer half-close.
wolfsshd's shell loop and both echoservers need it: all three ladders end in
"else if (rc != WS_WANT_READ) break", and wolfsshd's reaches
kill(childPid, SIGKILL), so without it a client half-close kills the command
it just finished feeding.

- wolfsshd closes the child's stdin off the channel's own EOF state instead of
  off a worker return of zero, which no longer happens on a half-close.
- The echoservers answer the half-close off wolfSSH_ChannelGetEof() rather
  than the WS_EOF status: the flush inside wolfSSH_worker() can supersede that
  status, and it is raised once. They hand back the backlog first, finish a
  short send, and only send the EOF once the channel is empty. Answering is
  not conditional on the shell build, where an echo session is the default.
- The SFTP loops peek before leaving, so a half-close with requests still
  buffered is served rather than dropped, and they report an ordinary session
  end as success.
- The clients -- examples/client, scpclient, sftpclient, apps/wolfssh -- treat
  it as the graceful case instead of an error. apps/wolfssh counts it as a
  finished flush as well, since one worker pass can drain the queue and
  consume the peer's EOF together.
- portfwd relays it to the local socket with shutdown(SHUT_WR) so a local
  reader waiting on end-of-input returns, once the backlog has genuinely been
  handed over: a read cut short by a rekey leaves the half-close for a later
  pass.
- The Windows half of wolfsshd does not answer with an EOF of its own. That
  latches eofTxd and the child's remaining output would be refused, which is
  the defect this series removes from the library.
- The mplabx port drains before tearing down, the way its SFTP read path
  already did; its worker arm was unreachable for a half-close until now.
2026-08-31 11:53:29 -05:00
John Safranek d70f8e64d3 Hoist the shared unit test doubles
The receive mock and the packet builders sit ahead of every endpoint region
rather than inside the server half. A staged-packet IORecv and a plaintext
packet builder have nothing to do with which endpoint is built, and the tests
that follow reach for them from both halves.

- Marked WS_MAYBE_UNUSED, since either half can be the only user of any one.
- WantWriteIoSend() joins DiscardIoSend() among the send mocks.
- A relocation only: no test body changes, and the moved text is unchanged
  bar the annotation. Read it with --color-moved.
2026-08-31 11:53:29 -05:00
John Safranek 8951bd9209 Release v1.4.22
1. Update copyright date to 2026.
2025-12-29 16:53:33 -08:00
gojimmypi dccc62bafd
Rename wolfssh test certs 2025-09-03 11:10:53 -07:00
JacobBarthelmeh 333cf30d60 fix for make dist 2025-08-21 11:07:50 -06:00
JacobBarthelmeh ae5fa76f74 update include.am for correct mplabx files 2025-04-04 10:15:30 -06:00
JacobBarthelmeh 79d32d0f80 create library build exmaple 2025-04-02 17:17:40 -06:00
JacobBarthelmeh 5fb496b9aa add chmod support, update readme and example app 2025-03-19 14:32:18 +07:00
JacobBarthelmeh 4f9e6b5732 remove some trailing white space and initialize get current drive buffer 2025-03-18 15:13:48 +07:00
JacobBarthelmeh 7067b200b8 clear stat struct before use and treat mount as directory 2025-03-18 13:01:04 +07:00
JacobBarthelmeh 604d1e8422 ls command working 2025-03-14 09:33:42 +07:00
Jacob Barthelmeh 41cef3309f fix numbering in README steps 2025-02-28 16:17:54 -07:00
Jacob Barthelmeh 48fa1e019e add example code for MPLABX use 2025-02-28 16:17:51 -07:00