Skip to content

fix: four Create functions accept a configuration they cannot work without, and report nothing #732

Description

@DavidCozens

Scope note, 2026-08-17. Retitled from "neither TLS stream". The comment below
extends this to SolidSyslogLwipRawTcpStream_Create and
SolidSyslogLwipRawDnsResolver_Create, so the issue covers four classes across
two platform packs
, and the fix is one decision about what Create owes the
caller across all four. The sections below describe the two TLS adapters only;
read them with the comment.

docs/tls.md requires a TLS Stream given an unusable configuration to report a
bad configuration and return the Null object, rather than accepting it and
failing later. Neither adapter does this.

What happens today

Create in both adapters takes a pool slot, copies the config, and validates
nothing:

  • Sleep is documented "required — there is no fallback" in both headers, and
    both call self->Config.Sleep(...) unguarded on the first WANT_READ /
    WANT_WRITE poll. That is every real handshake, so a NULL Sleep is a NULL
    function-pointer call on the first connection attempt.
  • SolidSyslogMbedTlsStream additionally passes Rng and CaChain straight to
    mbedtls_ssl_conf_rng and mbedtls_ssl_conf_ca_chain, neither of which
    returns a status. A NULL there surfaces later as a handshake failure rather
    than as the configuration error it is.

No test covers a NULL in any of these fields; every test in both suites wires
them.

Why this is not a new rule

The library already holds Create to this contract elsewhere.
SolidSyslogMetaSd_Create reports NULL_CONFIG and NULL_COUNTER as WARNING
and returns the Null structured data rather than proceeding. The TLS adapters are
not following a rule the codebase already demonstrates.

Acceptance

  • A NULL Sleep is reported at Create and the Null stream returned, in both
    adapters
  • SolidSyslogMbedTlsStream does the same for a NULL Rng and a NULL CaChain
  • Severity follows docs/error-severity.md — a Create that falls back to the
    Null object cannot deliver, which is the CRITICAL case
  • Tests cover each field's NULL, since none do today

Not in scope

Whether other classes share the lapse. This was found in the two TLS adapters
while writing their contract; a sweep across every Create is separate work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions