• src/ssh/TODO.md ssh-conn.

    From Deuc¿@VERT to Git commit to main/sbbs/m on Tuesday, March 24, 2026 20:58:00
    https://gitlab.synchro.net/main/sbbs/-/commit/ee785accd1f8c627cca4da09
    Modified Files:
    src/ssh/TODO.md ssh-conn.c
    Log Message:
    Delete dead x11 type_len==2 check (bug 6)

    The check `type_len == 2 && memcmp(ctype, "x11", 3)` compared
    3 bytes against a 2-byte string Ä could never match. The x11
    rejection is fully handled by the type_len==3 check.

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

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Deuc¿@VERT to Git commit to main/sbbs/m on Wednesday, March 25, 2026 23:06:00
    https://gitlab.synchro.net/main/sbbs/-/commit/3007d949c00e9f351be790e1
    Modified Files:
    src/ssh/TODO.md ssh-conn.c
    Log Message:
    Fix channel ID collision on uint32_t wrap

    alloc_channel_id() now scans the active channel table to skip
    IDs already in use. Returns DSSH_ERROR_ALLOC if all 2^32 IDs
    are exhausted (the application has made some terrible mistakes).

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

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Deuc¿@VERT to Git commit to main/sbbs/m on Friday, March 27, 2026 05:30:00
    https://gitlab.synchro.net/main/sbbs/-/commit/7519a938abcf7c6869b1342b
    Modified Files:
    src/ssh/TODO.md ssh-conn.c ssh.c
    Log Message:
    Fix 3 bugs: data race, memory leak, terminate hang

    - dssh_session_write/write_ext: read remote_window and remote_max_packet
    under buf_mtx to eliminate data race with demux WINDOW_ADJUST thread
    - dssh_session_accept_channel fail path: free setup_payload before
    freeing channel struct to prevent leak when demux delivered a message
    - dssh_session_set_terminate and demux cleanup: remove chan_type != 0
    guard so setup-mode channels get poll_cnd signaled on termination
    (buf_mtx/poll_cnd are initialized before register_channel)

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

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Deuc¿@VERT to Git commit to main/sbbs/m on Friday, March 27, 2026 07:09:00
    https://gitlab.synchro.net/main/sbbs/-/commit/8533cb551b49b8a61d338cf0
    Modified Files:
    src/ssh/TODO.md ssh-conn.c src/ssh/test/dssh_test_internal.h test_conn.c
    Log Message:
    Fix 3 window-accounting data races (items 51, 63, 84)

    local_window was modified without buf_mtx and before send_packet
    succeeded, causing flow-control drift and permanent channel stalls. session_write/write_ext used a stale remote_window snapshot from a
    separate lock acquisition, causing spurious DSSH_ERROR_TOOLONG.

    - send_window_adjust: update local_window under buf_mtx, only after
    send_packet succeeds
    - send_data/send_extended_data: add size_t *sentp parameter for
    clamp-under-lock mode (NULL = exact-or-fail)
    - session_write/write_ext: pass bufsz directly, let inner function
    clamp atomically (eliminates double-lock gap)
    - channel_write: remove racy unlocked pre-check of remote_window

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

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Deuc¿@VERT to Git commit to main/sbbs/m on Friday, March 27, 2026 14:34:00
    https://gitlab.synchro.net/main/sbbs/-/commit/7839289dc562f7e958d6a132
    Modified Files:
    src/ssh/TODO.md ssh-conn.c ssh-trans.c src/ssh/test/CMakeLists.txt test_conn.c test_transport.c
    Log Message:
    Fix 3 bugs: recv rekey termination, bytebuf window drift, close item 81 (items 15, 74, 81)

    Item 15: recv_packet_raw() terminated the session on DSSH_ERROR_REKEY_NEEDED, asymmetric with send_packet() which correctly exempts it. Fixed to match.

    Item 74: demux_dispatch() ignored dssh_bytebuf_write() return value,
    deducting full dlen from local_window even on partial writes. Window accounting drifted, eventually starving the channel. Also capped maybe_replenish_window() by free buffer space so WINDOW_ADJUST never
    grants more than the buffers can absorb.

    Item 81: Closed as not-a-bug. The single demux thread serializes packet processing; the accept queue only grows while the app controls drain rate
    via dssh_session_accept().

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

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Deuc¿@VERT to Git commit to main/sbbs/m on Saturday, March 28, 2026 12:55:00
    https://gitlab.synchro.net/main/sbbs/-/commit/4d27ca8b6489c631c6fc2070
    Modified Files:
    src/ssh/TODO.md ssh-conn.c src/ssh/test/dssh_test_internal.h test_conn.c
    Log Message:
    Close items 26, 30: decompose demux_dispatch/accept_channel, eliminate SER macros

    demux_dispatch() (~240 lines) split into 4 helpers:
    handle_channel_data, handle_channel_extended_data,
    handle_channel_request, and dssh_test_parse_channel_request
    (DSSH_TESTABLE shared parser). Switch body reduced to ~15 lines.

    dssh_session_accept_channel() (~230 lines) split into
    accept_channel_init and accept_setup_loop, both using
    the shared CHANNEL_REQUEST parser. Main function reduced
    to ~50 lines.

    PTY_SER/SIG_SER local macros replaced with direct DSSH_PUT_U32
    calls (11 sites). 6 new parser unit tests.

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

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Deuc¿@VERT to Git commit to main/sbbs/m on Saturday, March 28, 2026 12:55:00
    https://gitlab.synchro.net/main/sbbs/-/commit/f7a7973a535c5b77c9a129b4
    Modified Files:
    src/ssh/TODO.md ssh-conn.c ssh-trans.c ssh-trans.h
    Log Message:
    Close item 76: non-blocking demux sends via tx queue

    send_packet() held tx_mtx for its entire duration including the blocking gconf.tx() I/O callback. On a congested link, the demux thread blocked
    on tx_mtx for fire-and-forget protocol responses, stalling all incoming
    packet processing.

    The naive split (prepare under lock, I/O outside) doesn't work: SSH MACs
    use implicit sequence numbers, so wire order must match assignment order.
    Any split requires a second ordering mechanism that re-serializes I/O.

    Instead, add a send queue: the demux thread uses mtx_trylock on tx_mtx --
    fast path sends immediately, slow path enqueues the payload (linked list
    under independent tx_queue_mtx). send_packet() drains the queue before
    each send, preserving sequence-number ordering.

    Extracted send_packet_inner() for the core build/MAC/encrypt/I/O logic.
    Three demux call sites changed to send_or_queue(): CHANNEL_FAILURE, OPEN_FAILURE, and GLOBAL_REQUEST reply.

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

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Deuc¿@VERT to Git commit to main/sbbs/m on Saturday, March 28, 2026 12:55:00
    https://gitlab.synchro.net/main/sbbs/-/commit/cab425435ace689ceda32b4e
    Modified Files:
    src/ssh/TODO.md ssh-conn.c src/ssh/test/test_conn.c
    Log Message:
    Close items 92, 94: fix channel_read peek, add chan_type checks

    Item 92: dssh_channel_read(sess, ch, NULL, 0) now reaches
    msgqueue_pop() for peek (returns next message size without
    consuming). Guard maybe_replenish_window on buf != NULL.

    Item 94: all 11 channel I/O functions (7 session, 4 raw) now
    check chan_type and return DSSH_ERROR_INVALID on mismatch.

    New item 98: re-evaluate peek semantics for session channels.

    5 new tests, 6 existing tests updated to set chan_type.

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

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Deuc¿@VERT to Git commit to main/sbbs/m on Monday, March 30, 2026 14:17:00
    https://gitlab.synchro.net/main/sbbs/-/commit/a6fc65e8269ab5a07c35f3a9
    Modified Files:
    src/ssh/TODO.md ssh-conn.c
    Log Message:
    Fix send_channel_request_wait race: CLOSE clobbering successful response

    When the server accepted a channel request (CHANNEL_SUCCESS) and then immediately closed the channel (CHANNEL_CLOSE), the client's demux
    thread could process both messages before the client thread woke up.
    The post-loop check `if (sess->terminate || ch->close_received)` then
    returned DSSH_ERROR_TERMINATED even though request_responded was true, discarding the successful response and causing dssh_chan_open to return
    NULL.

    Fix: capture `responded` under buf_mtx; only return TERMINATED when
    the loop exited without getting a response. If the server explicitly
    answered, honor that answer regardless of close_received.

    Observed as test_self_exec_exit_code failing under -j16, predominantly
    with RSA variants where keygen CPU contention widens the scheduling
    window between the two demux dispatches.

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

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