• src/ssh/client.c server.c ssh-chan.c ssh-chan.h ssh-conn.c ssh-conn.h

    From Deucе@VERT to Git commit to main/sbbs/master on Sun Mar 22 10:47:22 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/61c971bcff9e45854c714bf7
    Modified Files:
    src/ssh/client.c server.c ssh-chan.c ssh-chan.h ssh-conn.c ssh-conn.h ssh-trans.c ssh-trans.h ssh.c
    Log Message:
    DeuceSSH: harden channel lifecycle, clean up public API, add signals

    Channel close flow:
    - Removed auto-reciprocal CLOSE from demux — application controls
    when to send reciprocal CLOSE for proper cleanup ordering
    - Discard data after peer EOF/CLOSE
    - Block writes and POLL_WRITE after peer CLOSE
    - Suppress window replenishment after peer EOF/CLOSE

    Channel establishment fixes:
    - Handle CHANNEL_OPEN_FAILURE in demux (was hanging forever)
    - Send CLOSE on failed setup (pty-req/shell/exec rejection) to
    clean up server-side orphaned channels
    - Fix memset zeroing initialized buffers in open_session_channel

    Thread lifetime fixes:
    - Join demux thread in session_stop (was abandoned)
    - Destroy rekey_cnd in transport_cleanup (was leaked)
    - Destroy channel_mtx, accept_mtx, accept_cnd (were leaked)
    - Free channels array and accept queue (were leaked)
    - Remove dead transport_thread field
    - Fix double-init of buf_mtx/poll_cnd in session_accept_channel
    - Free setup_payload in cleanup_channel_buffers
    - Add session_stop() public function

    Thread safety:
    - Replace static buffers with per-channel storage (req_type,
    req_data, last_signal) — was not thread-safe across sessions
    - sigqueue_pop takes caller-provided buffer

    Public API cleanup:
    - Low-level conn_ functions made static (internal only)
    - Removed dead code: conn_open_session, conn_request_exec, conn_recv
    - Removed unimplemented declarations (conn_accept, conn_reject,
    conn_parse_*, conn_request_pty/shell/subsystem/env)
    - Public API is now exclusively the high-level poll/read/write interface

    New features:
    - session_write_ext() for server-side stderr
    - session_send_signal() for RFC 4254 s6.9 signals
    - Signal synchronization verified end-to-end: data before mark is
    readable, data after mark blocked until signal consumed

    Updated client.c and server.c to use high-level API exclusively.

    Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net