- GetNameListRaw folded a trailing comma into the last name,
so NameToId returned ID_UNKNOWN and negotiation failed.
- Trim one trailing comma up front, matching AlgoListSz.
- Add regression test for a KEX list with a trailing comma.
Issue: F-2478
- forwarded-tcpip was never gated; fell through to default-accept channelOpenCb.
- Require fwdCb for both forwarding channel types, failing closed without it.
- Reject server-side forwarded-tcpip opens before any policy hook runs.
- Add regress coverage for both rejections.
Issue: F-6275
- Reply to a port-0 (dynamic) tcpip-forward with the bound port.
- Add WS_FWD_PORT_CHECK (1024) as the status/port boundary in WS_FwdCbError.
- Callback returns a WS_FwdCbError status below it, the port at or above it.
- DoGlobalRequestFwd reports the port and rejects a port-0 setup with none.
- Map a callback rejection to WS_RESOURCE_E so a no-reply request keeps the link.
- Update the echoserver reference callbacks (examples and Espressif) to
recover the OS-chosen port with getsockname() and return it under the new
convention.
- Add regress coverage for the allocated-port and rejection paths.
Issue: F-5573
Co-authored-by: John Safranek <john@wolfssl.com>
- Merge fileIdCount and dirIdCount into a single handleIdCount.
- File and directory handle IDs now share one namespace.
- A close or other handle op cannot match the wrong resource type.
- Track open SFTP file handles per session in a fileList, returning
opaque session-scoped handle IDs instead of raw file descriptors.
- Resolve and validate client-supplied handle IDs via FindFileHandle.
- Free the handle list and close handles on error paths, including the
Windows code paths.
- Drop the old raw-fd SFTP_ValidateFileHandle/STOREHANDLE handle table
and its tests, superseded by the per-session ID lookup.
Run the DoUserAuthRequestRsa vectors through the X.509 path to pin
that a raw signature with a high leading bit is accepted via the
RFC 6187 branch. keys/ has no RSA certificate, so the test embeds a
self-signed cert made from keys/hansel-key-rsa.pem (valid until
May 2048).
- Parse each field of the key blob in ParseECCPubKey with its own
scoped variables instead of reusing q/qSz for the algorithm name,
curve name, and public key point.
- Validate blob algorithm name against handshake pubKeyId
- Derive curve from negotiated algo, not the key blob
- Check curve name instead of skipping it
- Add a ParseECCPubKey test checking the key blob algorithm and
curve names are validated against the negotiated host key
algorithm.
Issue: #1012
- GetMpint now rejects values with the sign bit set as
non-canonical (RFC 4251 Section 5) and is rewritten in
terms of GetStringRef.
- Parse RSA signature blobs with GetStringRef; they are
strings of raw signature bytes (RFC 4253 Section 6.6),
not mpints, and often have the high bit set.
- Add unit test covering GetMpint parsing and rejection.
- Add a DoUserAuthRequestRsa test pinning the string parse of
the signature blob with a fixed signature whose leading byte
has the high bit set; an mpint parse would reject it as
negative.
Issue: #1013
OCSP_NEED_URL meant the cert has no AIA OCSP URL and no
default responder is set, so OCSP cannot run. Treat it as
not-revoked instead of failing the whole verification.
This softens revocation from hard-fail to soft-fail for that case
only. The AIA URL is part of the signed certificate and is not
attacker-strippable, so a malicious peer cannot use this to bypass
an otherwise-enforced OCSP check.
- Add CertManIntermediateIsCA: require isCA and, for non-self-signed
intermediates that carry a KeyUsage extension, the keyCertSign bit
before promoting a cert.
- Only promote a verified intermediate into the trust store when it is
actually a CA; otherwise fail with WS_CERT_NO_SIGNER_E.
- Prevents a peer-supplied end-entity cert at an intermediate position
from being trusted to issue certs for arbitrary SSH principals.
- Gate keyCertSign on ALLOW_INVALID_CERTSIGN and on the KeyUsage
extension being present, matching wolfSSL's AddCA loader.
- Add regression tests: non-CA intermediate is not promoted, and a
valid CA intermediate (with and without KeyUsage) still is.
Issue: F-5851
Cleanup clang-tidy bugprone-inc-dec-in-conditions finding.
- ParseTimestamp: move ++idx out of the || conditions
and tighten the bound from > bufSz to >= bufSz.
Cleanup clang-tidy concurrency-mt-unsafe finding. Note, this
originally used gmtime which provided UTC based time values. Now,
the wolfSFTP server will provide localtimes for file timestamps.
The exception is Zephyr, which only provides UTC times.
- SFTP_CreateLongName: switch from XGMTIME (gmtime) to
WLOCALTIME, which expands to localtime_r/localtime_s
per platform.
- Note in the Zephyr WLOCALTIME macro that gmtime_r is used
because Zephyr's minimal libc does not provide localtime_r.
- Moved the posix attributes breakdown into a helper function.
- Changed some of the X-prefixed macros to the W-prefixed versions.
- Changed the SFTP longname creation to add a "?" in place of the
number of links. (OpenSSH does the same.)