When the echoserver runs as root, the forkpty child hands the pty
slave to the authenticated user, mode 0620, so the shell can reopen
its terminal, then takes that user's groups, gid and uid and closes
every descriptor above stderr before it execs the shell. It exits
without a shell if any step fails or root can be regained.
- configure: check for closefrom(), with a close() loop as fallback
- a server that is not root starts the shell as before
Issue: F-8857
wsExecStartCb() now takes an exec request as a transfer only when
wolfSSH_ChannelCommandIsScp() does, the same test wolfSSH_accept()
diverts on. A command such as "scpbackup" is served as a session.
- tests: test_wolfSSH_SCP_ExecNotScp echoes data over a "scpbackup"
exec channel
Issue: F-14206
wolfSSH_FwdDefaultActions() serves one forward per session. A
tcpip-forward or direct-tcpip setup that arrives while a listener or
connection is live is refused, and so is a port over 65535, before
anything narrows it to 16 bits. A cancel that lands while a forwarded
connection is open closes only the listener; closing that connection's
channel then frees the slot. server_worker() closes what is left.
- a direct forward whose target hung up may be replaced by a new one
- REMOTE_CLEANUP drops an accepted connection no channel carries yet,
and refuses a cancel while a direct forward is still connecting
- a channel close closes the forwarded connection only once it is
CONNECTED, so a late close of the slot's previous channel spares a
connection still waiting for its own
- a closed forward goes to LISTEN with a listener, else to INIT
- a forwarded connection that ends frees originName; a remote forward
keeps hostName
- a new setup frees stale hostName and originName and clears the
slot's channel id
- server_worker() closes fwdCtx listenFd and appFd at teardown
- api: test_wolfSSH_FwdEchoserverSlot drives an in-process echoserver
through the limit, the port bound, cancel, and a late close, and
reaches the forward over IPv4 even under TEST_IPV6
Issue: F-16817, F-16818
As with OpenSSH scp, the client sends the remote path to the server's
shell as given, with "--" before a path starting with "-". A control
character in the path is refused with WS_BAD_ARGUMENT, since it would
end or split the command.
- wolfSSH_SCP_from works on a copy of dst, not the caller's const string
- wolfscp.h: the remote shell expands the path; callers quote it
- scpclient: test only for WS_FATAL_ERROR in the retry loop
- tests: add MakeScpCmd cases, parsed back off Windows, and check
SCP_from leaves dst unchanged
Issue: F-12624, F-13319, F-12546
ES_ERROR now jumps to an echoserverFail label instead of returning, and
the label frees whatever is set up at that point: the listen socket,
unconsumed option lists, keyboard prompts, doneLock, pwMapList, the CTX,
the TPM host key and wolfSSH_Init(). The test harness keeps running
after echoserver_test() returns, so these were live-process leaks.
- pwMapList and kbAuthData are zeroed on entry; flags track doneLock
and wolfSSH_Init(), each set only once its init succeeds
- usage errors take the same path and keep MY_EX_USAGE
- loop failures free their ssh and thread context before the jump
- drop the inline frees the cert-store and prompt paths now duplicate
- api.c: drive usage, algo-list and key-load failures for LSan; the
key-load case is skipped on Zephyr and Nucleus, which lack -j
Issue: F-17053
wolfSSH_SFTP_MKDIR() encodes atr with SFTP_SetAttributes(), as the
other attribute-carrying requests do. A NULL atr requests permissions
0777, the request every MKDIR used to send.
- sftpclient: pass NULL instead of an uninitialized atr
- api: a 0700 request makes a 0700 directory on the echoserver
Issue: F-14634
wolfSSH_GetText() builds the text locally and copies it into str, so
str is always terminated and the return is the full text length,
whichever function WSNPRINTF maps to. A return of strSz or more means
truncation; an unknown id or unnegotiated KEX gives "" and 0.
- echoservers: test truncation with ret >= strSz
- api: empty, exact, truncated, and DH texts
Issue: F-17102
Comment-only change: each comment now describes what its code does.
No code tokens change.
- kex: server f is our output, not the peer key; the ML-KEM-768 f is
the ciphertext; the client hybrid also covers P-256 and P-384
- scp: base path and fd referents, NEW_REQUEST state, unchanged index,
oversize rejection, and where the symlink checks are not atomic
- error.h: WS_DH_SIZE_E and WS_DISCONNECT meanings, GetErrorString()
- api: stream_read WS_EXTDATA, channel-open built-in refusals, write
ctx, SFTP write offset, agent reply status, userauth returns
- misc: off_t guess, wSelect, handle cap, sftpclient, wolfsshd notes
Issue: F-9422, F-10564, F-11637, F-11638, F-11639, F-11640, F-12555,
F-12556, F-13915, F-14207, F-14399, F-15514, F-15515, F-15516,
F-16055, F-16056, F-16057, F-16757, F-16758, F-16759, F-16760,
F-16761, F-16762, F-16763, F-17054, F-17055, F-17868, F-17869
Without -i the client loads the built-in private key, so load its public
half too and publickey auth with the default keys works. A -j file or a
TPM key still supplies its own public key.
Issue: F-13905
readKeyBlob() checks each part of the key file against its destination
before reading it, and every failure now returns an error with the file
closed. wolfSSH_TPM_InitKey() refuses a key auth that does not fit the
blob, frees what it loaded when it fails, and wipes the key material.
The tpm-ssh job feeds the client a bad key blob for each check.
- reject a public size over pubAreaBuffer, a private part over key->priv
- return BUFFER_E on a short read; parse errors go through exit
- refuse a -K value longer than the auth buffer
- unload the EK, session and key blob when the key load fails
- wipe the key blob and session on return, the TPM key on cleanup
Issue: F-8855, F-10558, F-10604, F-10601, F-10602, F-10603, F-17098
LoadPublicKeyBuffer() searches for its delimiters only up to the end
of the buffer, so a -j file without a final newline is rejected
instead of read past. The sample password, public key, and none lists
are copied into keyLoadBuf only when they fit.
- Add FindDelimiter() in place of the unbounded WSTRCHR() calls
- Add CopyToKeyLoadBuf(), which refuses a string with no room for its
terminator and still accepts an empty one
- Parse a -j file by the bytes actually read, and stop when the read
fails
- Warn when a -j file's keys are not all loaded
- Fix the comment claiming every sample key is ssh-rsa
Issue: F-10600, F-10565, F-14765
keyLoadBuf held host private keys but was wiped only under
WOLFSSH_SMALL_STACK. KeyLoadBufFree() now wipes it in every build and
frees it only when it came from the heap.
- Route every keyLoadBuf exit through KeyLoadBufFree()
- Wipe the ML-DSA key buffer in LoadMlDsaHostKeys() before each free
Issue: F-8859, F-10605
The example client prints the keyboard-interactive name, instruction
and prompts through ClientPrintSafe(), which prints a '.' in place of
each control character other than tab and newline, DEL, and each byte
0x80 and up, per RFC 4256 section 3.3 and RFC 4251 section 9.2.
- tests: auth case capturing the printed strings
Issue: F-15534
The password prompt reads stdin with fgets(), and a buffered stdin
keeps its own copy of the line in libc for the life of the process.
The clients make stdin unbuffered before any stdin I/O, so the typed
password lands only in the buffer ClientUserAuth() wipes.
- the wolfssh app, and the example client, sftp client and scp client
whether or not -P was given, as keyboard-interactive reads stdin too
- ClientUnbufferStdin() acts once per process and reports a failure
- scripts/sshclient.test sends the session data right after the
password, with no sleep
Issue: F-15669
ClientUserAuth() hands the library its static password buffer, and the
library sends from it after the callback returns. The clients now wipe
it, and the example's keyboard-interactive responses, as soon as
connect returns instead of holding them for the whole session.
- ClientClearPassword() in both common.c copies, called after connect
in the wolfssh app, the example client and the sftp client
- the password arm wipes before each prompt and on failure, so a retry
keeps no tail of a longer password
- the keyboard arm wipes its scratch copy after each response
- tests: regress and auth cases for the retry tail, the wipe and a
failed read
Issue: F-8846
wsUserAuth parses the peer certificate to print its FASC-N and UUID.
Free the DecodedCert before leaving that block, on success and on
failure alike.
Issue: F-13997
The echoserver and tpmcertserver userauth callbacks compare the stored
digest or password with wolfSSH_ConstantCompare(). The echoserver
callback now wipes its digest buffer on every return.
Issue: F-8858, F-12630
A root-run echoserver with -F now switches to an unprivileged user once
the listener is bound and the keys are loaded, before any peer is
served, so forwarded connects and binds no longer run as root. The new
-u option names the user; the default is nobody, with a warning. A
failed switch ends the server.
- Add DropPrivileges(): setgroups, setgid, setuid, then check root
cannot be regained
- Build it only for the standalone POSIX echoserver with WOLFSSH_FWD,
not for the tests that run echoserver_test() in-process
- Warn on stderr that -u is ignored in a build without it
- Document -u in the usage text and README.md
Issue: F-11935
With -F a peer's direct-tcpip open is set up only for a loopback
destination. The new -L option replaces that default with a list of
allowed host or host:port entries. Any other open is refused, which
the library reports as administratively prohibited.
- Check the destination in the WOLFSSH_FWD_LOCAL_SETUP action
- Document -L in the usage text and README.md
- openssh-interop.test checks a non-loopback destination and one left
out of -L are refused, and that host and host:port entries connect
Issue: F-11935
The forwarding callback connects and binds with the server's own
credentials, so it is registered only with the new -F option. Without
it the library turns down every forwarding request.
- Bind a remote forward for localhost or 127.0.0.1 to the loopback
address, not INADDR_ANY
- Refuse a remote forward to a privileged port or one over 65535
- Pass -F in fwd.test and fwd-bulk.test; document it in README.md
- openssh-interop.test checks a remote forward fails without -F, works
with it, and is refused by the port check for port 80
Issue: F-11935
The forwarded agent socket now lives in a mkdtemp() directory, and the
session's end runs the agent cleanup, which the library never calls on
a server. The relay addresses the agent channel by its own id and
drains each agent reply in full.
- Set agentChannelId from ssh->agent once the agent channel is open
- Drop agent replies when no local agent client is connected
- Close the accepted agent client in WOLFSSH_AGENT_LOCAL_CLEANUP and
remove the socket and its directory
- Print the socket path; openssh-interop.test forwards ssh-agent
through the echoserver, lists a reply larger than the relay buffer,
and checks the directory is private and removed
Issue: F-10553, F-11936, F-14396
The -p option of wolfssh, client, wolfscp, wolfsftp and echoserver now
goes through a strtol check, so a value that is not wholly a number in
range exits with an error instead of wrapping into a different port.
- apps/wolfssh: ClientParsePort(), shared with ClientParseDestination(),
which also rejects an empty "ssh://host:" port instead of defaulting
- examples: a ClientParsePort() in examples/client/common.c; port 0 is
rejected in every build, not only with a main driver
- echoserver: accepts 0 to 65535, keeping 0 for the test harness
- add TestClientParsePort and an empty URI port case to regress.test
Issue: F-14763, F-14767, F-14768, F-12552
A client refuses shell, exec, subsystem and pty-req channel requests
and direct-tcpip opens before any callback runs (RFC 4254 6.2, 6.5,
7.2). CHANNEL_OPEN_CONFIRMATION and CHANNEL_OPEN_FAILURE are a
protocol error unless the channel's own open is still outstanding.
- SshInit() installs the default WS_TermResize for servers only.
- Drop the Windows clients' raw-HANDLE resize context; nothing uses it.
- Move the channel request builders out of the server-only test block.
Issue: F-10582, F-13923, F-15533, F-15572, F-14434
C++ rejects three C idioms the tree uses: a conditional mixing an enum
constant with a byte, one mixing INADDR_ANY with a pointer, and a {0}
initializer for a struct. Cast the integer arms of the conditionals,
and clear the structs with WMEMSET instead.
- internal.c, regress.c: cast the ID_UNKNOWN arm to byte
- test.h: cast INADDR_ANY through size_t to const char*
- keygen.c, certman.c, echoserver.c, auth.c: replace {0} with WMEMSET
--enable-all turns on wolfsshd and the ssh client app, so adding
--disable-server or --disable-client built an app against a library
missing its side and the link failed. configure now leaves out the app
whose side is disabled, and stops with an error when that app was asked
for outright.
- give the client-less main() stubs in portfwd and scpclient a
prototype, which -Wstrict-prototypes requires before C23
The Windows path of apps/wolfssh and examples/client sets the volatile
quit with InterlockedOr8() once readPeer() returns, repeats
CancelSynchronousIo() on the readInput() thread until it has exited,
and only then closes the handles and frees the session. readInput()
checks quit around its console read and inside its send retries, and
returns quietly when it is set.
Issue: F-11662
readInput() and readPeer() in apps/wolfssh and examples/client clear
their stack buffer with wc_ForceZero() before returning, so neither
what was typed into the session nor the last of its output is left on
a finished thread's stack. On POSIX the main thread cancels
readInput() inside read(), so a pthread cleanup handler does the wipe
for it.
- readInput() holds only the buffer and the cleanup handler; the loop
is readInputLoop(), since glibc's pthread_cleanup_push() is a setjmp
and gcc -Wclobbered flags the locals of the function holding it.
Issue: F-10594, F-12647
readInput() in apps/wolfssh and examples/client sends again from
where a short wolfSSH_stream_send() stopped until the whole chunk is
taken, and waits out WS_WINDOW_FULL the way it waits out a rekey.
readPeer() in both writes stdout and stderr through a WriteAll() that
loops over short writes.
- A send clamped to the peer's window or packet size no longer drops
the rest of the chunk, and the WS_WINDOW_FULL that follows the clamp
no longer ends the stdin thread.
- The Windows stderr path writes the bytes read instead of a "%s".
Issue: F-8830, F-10548, F-10555
wolfSSH_AGENT_SignRequest() writes the sign request and reads the reply
through the whole-message helpers the relay uses, so a short write is
followed up and a reply is read to its declared length before it is
parsed. The setup callback's WS_AgentCbError result becomes
WS_AGENT_CXN_FAIL, and an ECDSA key's reply room fits the SSH blob.
- A short write, a hang-up, or a failed setup is WS_AGENT_CXN_FAIL;
cleanup runs only after a setup that succeeded, and the client
callbacks close their socket when connect() fails.
- PrepareUserAuthRequestEcc() reserves r and s as mpints a pad byte over
the curve size, and BuildUserAuthRequestEcc() hands the agent that
room, checks the reply's algorithm name, and bounds it by outputSz.
- A NULL sig, or a NULL digest or key blob with a size, is
WS_BAD_ARGUMENT; agent.h documents the contract and return codes.
- api: the mock agent's short write is followed up, a reply read a byte
at a time is reassembled, and a failed setup and NULL buffers are
refused.
- regress: the mock agents answer as a stream; ECDSA user auth for each
curve at, under, and over the largest blob, and a wrong curve name
refused; a failed setup refused with nothing sent.
Issue: F-13325, F-14629, F-14631
The remaining teardown sites spun wolfSSH_worker() ten times after
wolfSSH_shutdown(), the loop the client and the echoserver just
replaced. The clients now send a disconnect and drain, and wolfsshd
half closes and drains like the echoserver.
- sftpclient.c, scpclient.c, portfwd.c and the wolfssh app call
SendDisconnectAndDrain() and treat either give-up as a clean close.
- scpclient.c and the wolfssh app report an unexpected shutdown result,
as the client does.
- the wolfssh app waits for the channel close before draining, as the
client does, and fails on an error that broke the wait.
- wolfsshd drained by hand after wolfSSH_free(), with no bound on a peer
that never hung up. HalfCloseAndDrain() bounds it at ten seconds, and
a peer that let the login grace time run out is not drained.
The client and the echoserver both sent their shutdown messages and then
spun wolfSSH_worker() a fixed number of times, so whether the peer's
close was seen at all depended on timing. Both now half close the
socket and read until the peer hangs up; the client sends a disconnect
first, the echoserver does not.
- test.h adds WSHUTDOWN(), a write-side shutdown() on POSIX and Windows,
left undefined where the stack has no half close.
- test.h adds HalfCloseAndDrain(). It flushes a queued write, then reads
the raw socket, since the library reads nothing after the session
ends, and gives up ten seconds in or after 256 reads. MQX gets a stub.
- SendDisconnectAndDrain() sends MSG_DISCONNECT for up to ten seconds,
then drains. It returns WS_WANT_READ for a peer that never hung up,
WS_WANT_WRITE for a disconnect still queued, WS_SUCCESS for a reset.
- test.h adds WaitForChannelClose(), which runs the session until the
peer's channel close, bounded at ten seconds, and returns at once on a
session an error already ended. MQX gets one pass.
- client.c waits for the close, keeping a late exit status, and reports
an unexpected shutdown result. It exits 0 on either give-up and fails
on a broken wait or a disconnect it could not send.
- echoserver.c replaces its 10-attempt worker loop with the drain alone:
the close exchange ended the session, and OpenSSH's client exits 255
on a disconnect that lands before it is done.
- readInput() in apps/wolfssh runs FlushQueuedSend() when
wolfSSH_stream_send() returns WS_WANT_WRITE without taking the
buffer, then sends the same buffer again; a failed flush still
ends in "Couldn't send data".
- readInput() in examples/client retries WS_WANT_WRITE as it
retries WS_REKEYING, for up to SEND_RETRY_TIMEOUT (10) seconds
per buffer.
- The comment on the queued check in apps/wolfssh describes the
positive-return case.
When select() reports the socket readable but only part of a packet
has arrived, wolfSSH_worker() returns WS_WANT_READ. sftp_worker() now
goes back to waiting on the socket instead of ending the session,
which cut off SFTP transfers whose packets arrived split across reads.
The "Unable to copy" message now carries the return code and the
session error with its name. The return alone is usually the generic
WS_FATAL_ERROR, which says nothing about the cause.
- WS_AppCtx stages each direction on its own: buffer, bufferIdx and
bufferOff from appFd to the channel; fdBuffer, fdIdx and fdOff from
the channel to appFd. thread_ctx_t drops channelBuffer and
eofBuffer.
- app_drain_to_channel() advances bufferOff by what
wolfSSH_ChannelIdSend() took, and holds the rest on WS_WANT_WRITE,
WS_WINDOW_FULL, WS_REKEYING, WS_CHANNEL_NOT_CONF and WS_CHAN_RXD,
putting back the ssh->error from before that send for all but
WS_WANT_WRITE. A zero or over-reported send ends the session.
- app_pump_to_fd() reads the channel into fdBuffer and writes it to
the pty or forward socket, both now nonblocking, keeping what would
block.
- ssh_worker() leaves appFd out of the read set while buffer holds
bytes, puts it in the write set while fdBuffer does, and runs both
pumps on every pass.
- A pty read of zero ends the loop whatever errno holds.
- app_echo_pump() echoes the shell channel through shellCtx.buffer
and then hands each new chunk to process_bytes(). It replaces the
EOF drain along with eofOff and eofRead. A negative read ends the
session.
- app_flush_fd() gives a connected forward up to APP_FLUSH_SECS
without progress after the loop to take what fdBuffer still holds.
- The agent keeps blocking writes, through app_write_all(), which
retries an interrupted send.
- A forward clears both of its buffers as it connects.
- fwd-bulk.test phase 3 logs in with a password and echoes 32 MB
through ssh -L while the client keeps sending but stops reading for
10 s. Phase 4 ends a forward while bytes are held for its target
and checks the next forward's target gets only its own.
Issue: F-10544
A held status from wolfSSH_AGENT_RelayChannel() is negative, and
leaving it in ret ended the outer while (ret >= 0) loop before the owed
reply was retried. Reset ret to WS_SUCCESS when the reply is held so
readPeer() returns to select() and retries it.
Issue: F-10545
- src/agent.c gains AgentWriteAll(), AgentReadFull(),
AgentReadMessage() and AgentWriteMessage(), which loop the
agentIoCb, bound a declared length by the new
WOLFSSH_AGENT_MAX_MSG_SZ, and reconnect once when a write finds
the socket dead. wolfSSH_AGENT_Relay() is rebuilt on them.
- New WOLFSSH_API wolfSSH_AGENT_RelayChannel() frames the channel
side, holding a partial request and an unfinished reply on
WOLFSSH_AGENT_CTX in two WOLFSSH_BUFFERs whose whole allocation
is zeroed as each message is consumed. It answers WS_WANT_WRITE,
WS_WINDOW_FULL or WS_REKEYING while a reply is owed, flushes
what is left queued below under those last two, and answers
WS_WANT_WRITE while any of it is still queued.
- readPeer() in apps/wolfssh/wolfssh.c and examples/client/client.c
calls it, drops its local ato32() and 512-byte buffer, and arms a
select() write set for the transport's own want-write. While a
reply is owed it ends the read loop so the retry above select()
runs, and examples/client/client.c times its select() out at one
second.
- tests/api.c adds nine wolfSSH_AGENT_Relay() cases and
tests/regress.c twenty-two for wolfSSH_AGENT_RelayChannel().
Issue: F-10545
The legacy claim in ssh_worker() now takes the channel id as part of
its condition and marks the session connected only once the id is
stored, the same order wsShellStartCb() uses.
Issue: CID-656285
The sample clients load hansel's Ed25519 key when neither RSA nor ECDSA
is compiled in, so public key auth reaches the echoserver's matching
sample keys instead of sending a request carrying no key.
- commit keys/{hansel,gretel}-key-ed25519.{der,pem,pub}, the pair to the
echoserver's sample authorized keys
- ClientUserAuth() fails a publickey request with no key loaded, so the
library can offer another method
The example server loads hansel's and gretel's Ed25519 public keys when
neither RSA nor ECDSA is compiled in, so public key auth works there
instead of falling back to passwords. That arm is the "#if" and the
userEcc choice the "#else", so no empty if/else is left behind.
Nothing defines WOLFSSH_NO_ECC, so every "#ifndef WOLFSSH_NO_ECC" block
was always compiled and the sample ECC keys behind them reached their
"#error" with no curve available. Use WOLFSSH_NO_ECDSA, which
wolfssh/internal.h derives.
- echoserver builds load_key() and its two default host keys only when
RSA or ECDSA is there; the Ed25519 host key still loads
- ECC_PATH moves inside that guard, its only reader
- peerEcc is now read only by load_key(), so mark it used
- ssh_worker() in both echoservers maps a WS_FATAL_ERROR return from
wolfSSH_worker() to WS_WANT_READ or WS_WANT_WRITE at the call site,
off a new local err, and keeps the result in rc.
- The terminal arm tests rc in place of re-reading wolfSSH_get_error():
rc != WS_WANT_READ in examples/echoserver, and rc != WS_WANT_READ &&
rc != WS_WANT_WRITE in the Espressif copy, whose empty WS_WANT_WRITE
arm is removed.
- ssh_worker() in examples/echoserver sets wantWrite from
wolfSSH_OutputPending() before it builds writeFds.
- The comment above rc = cnt_r in both echoservers names cnt_r and
ssh->error as the values that are reused.
- scripts/sshclient.test and scripts/fwd-bulk.test name the client's
missing non-blocking mode in the skip message where they echoed the
macro name, and the comments above both skips are removed.
A send the socket refused leaves WS_WANT_WRITE, and the retry branch
continues past the only tcp_select() in the iteration, which watches
reads. Wait on write readiness there, so a peer that has stopped
reading costs a descriptor wait rather than a spin.
- a buffered send with a willing socket still goes straight around
- an error-ready or failed descriptor ends the loop
- an interrupted select() retries instead of ending the session
ssh_worker() reads a WS_WANT_WRITE from wolfSSH_worker() as a send the
socket has not taken yet: it waits for the socket to accept one and runs
the worker again, rather than leaving the loop. Application-driven mode
answers session requests here, and the peer waits on that reply, so a
blocked one ended a session the legacy accept() carried through.
- the worker runs on a writable socket as well as a readable one, or
the owed send is never retried
- the ssh socket joins the select write set only while a want-write is
outstanding
- a queued agent channel open joins the same wait, so the poll runs
ahead of the write set
The subsystem and exec callbacks pick out the same commands the accept
state machine does: sftp matched whole, by length and bytes, and scp on
the three-byte prefix ChannelCommandIsScp() takes.
- sftp with an embedded NUL is refused, rather than granted and then
dropped by wolfSSH_SFTP_accept()
- a transfer is granted only on the head channel the accept APIs serve,
so a request on a later channel is refused rather than answered
success
ssh_worker() takes the session channel accept() established only when
the request was granted and there is somewhere to put the data. The
type and command stay set on a refusal, so they do not say what was
granted, and a refused request leaves nothing running.
- a shell build serves the channel through the pty, so with no shell
started only echo mode can take it
- wsShellStartCb() closes the pty and reaps the child when the terminal
setup fails, installs ChildSig() only once the session will run, and
leaves ChildRunning alone when forkpty() fails
- the connection holds the shell's pid, so the worker loop's exit and
an accept() whose reply failed end the child too
- the shell, exec and subsystem callbacks share SessionInUse(), so a
second program start on the connection is refused
- the EOF drain answers a half-close only on a claimed session, rather
than on whatever channel id 0 finds
With -A the echoserver drives its own channels: accept() returns at
userauth and the callbacks below start the shell, SFTP or SCP session.
Off by default. The two modes are exclusive, since the callbacks answer
the session requests the accept state machine otherwise answers itself.
- wsShellStartCb() forks the pty, so it is registered in either mode,
and claims the channel only once there is a shell behind it; a second
request is refused rather than forking over the running shell
- wsExecStartCb() takes an "scp " command as a transfer and any other
command as a session, and is registered in either mode, since the
legacy path has always started a shell for an exec request too
- wsSubsysStartCb() is registered only with -A, as accept() serves sftp
itself, and guards a NULL command, which a truncated request leaves
behind
- ssh_worker() drives the session through shellCtx.appFd, claims the
channel itself when no callback did, and leaves an SFTP or SCP
handoff through its cleanup so the pty master still closes
- open the agent channel from the select loop, since the peer's
auth-agent-req lands after accept() has returned, and read the
listener from the context each pass because it appears mid-loop
- resume a subsystem accept that returns a want, waiting on the socket
between attempts rather than spinning
- close the accepted socket again, clear fwdFd on EOF or reset, and
stay in the loop on WS_REKEYING, which the read arm already handles
- key ChildRunning's sig_atomic_t on WOLFSSH_SHELL, the only build
with the SIGCHLD handler that writes it, so a target whose libc has
no signal.h still compiles
- ask for echo mode in the keyboard-interactive test, which has no
account on the host for the shell callback to fork a shell for
- wolfSSH_OutputPending() moves from wolfssh/internal.h to
wolfssh/ssh.h as a WOLFSSH_API taking a const WOLFSSH*, defined
in src/ssh.c beside the other public calls.
- wolfSSH_worker() puts the send's code in the return in place of
an event when the flush fails outright, and gates its flush on
wolfSSH_OutputPending(). wolfssh/ssh.h states both.
- Both wolfsshd shell loops, both echoservers and
ReceiveScpMessage() dispatch on wolfSSH_worker()'s return, and
call wolfSSH_get_error() only to tell a transient failure from a
terminal one. The POSIX wolfsshd loop sets wantWrite from
wolfSSH_OutputPending().
- Five worker tests expect the send's code where they expected the
event, and tests/testsuite.c calls wolfSSH_OutputPending().