• src/ssh/TODO.md deucessh-

    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/bcee61f3a919481f1621dc60
    Modified Files:
    src/ssh/TODO.md deucessh-conn.h ssh-auth.c ssh-chan.c ssh-conn.c src/ssh/test/dssh_test_internal.h
    Log Message:
    Eliminate void functions that swallow errors

    - handle_banner: void  int; callers propagate non-parse errors
    - maybe_replenish_window: void  int; read callers propagate
    - demux_dispatch, demux_open_confirmation, demux_channel_open:
    void  int; demux thread terminates session on non-parse errors,
    tolerates DSSH_ERROR_PARSE (malformed peer data)
    - dssh_session_reject: void  int (public API change)
    - bytebuf_write: guard capacity==0 to prevent SIGFPE (% 0)
    - TODO: document chan_type==0 data delivery race (item 12)

    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 Thursday, March 26, 2026 05:47:00
    https://gitlab.synchro.net/main/sbbs/-/commit/6afdd20feabc24162d9e7086
    Modified Files:
    src/ssh/TODO.md deucessh-auth.h server.c ssh-auth.c ssh-internal.h ssh.c
    Log Message:
    Add dssh_auth_set_banner() API; sarcastic example server

    New public API: dssh_auth_set_banner(sess, message, language)
    queues a banner to be sent before the next auth response.
    Callbacks can set new banners dynamically. NULL message cancels.
    Empty message rejected with DSSH_ERROR_INVALID per RFC 4252 s5.4.
    Banners flushed in send_auth_success and send_auth_failure,
    and at the top of the auth loop (for the initial pre-auth banner).
    Pending banner freed on session cleanup.

    Example server enhancements:
    - Welcome banner before auth
    - Sarcastic per-callback banners showing username/password/key info
    - 75% random auth rejection with 16 quips
    - publickey auth support with same rejection odds
    - Debug, unimplemented, and global request callbacks registered
    - Banner logging via set_banner() helper
    - All session callbacks now wired up

    TODO: note auth/client/pw_changereq_send_fail timing flake.

    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/514b1ce5bffef095c20317e1
    Modified Files:
    src/ssh/TODO.md deucessh-arch.h deucessh-auth.h ssh-arch.c ssh-conn.c ssh-trans.h src/ssh/test/test_arch.c
    Log Message:
    Remove dead code, fix stale comments and wrong docs

    - Remove dssh_bytearray type, functions, _Generic entries, tests (TODO 1)
    - Remove dssh_parse_namelist_next and dssh_namelist_s.next field (TODO 3)
    - Remove unused dssh_transport_packet_s struct (TODO 38)
    - Fix stale comment in open_session_channel: register-then-send (TODO 25)
    - Fix dssh_auth_server() doc: username is copied, not borrowed (TODO 40)
    - Add comment explaining msg type 60 aliasing per RFC 4252/4256 (TODO 42)

    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/b69afc762cf041e1f4dc696b
    Modified Files:
    src/ssh/TODO.md deucessh-auth.h deucessh.h ssh-auth.c ssh-conn.c ssh-trans.c src/ssh/test/test_auth.c test_conn.c test_transport.c
    Log Message:
    Fix error code accuracy: add REJECTED codes, fix ~50 misuses

    Two new error codes: DSSH_ERROR_AUTH_REJECTED (-12) for USERAUTH_FAILURE, DSSH_ERROR_REJECTED (-13) for CHANNEL_OPEN_FAILURE/CHANNEL_FAILURE.

    Fixes ~50 sites where error codes were misleading or wrong-category:
    - Auth rejection: INIT -> AUTH_REJECTED (3 sites in ssh-auth.c)
    - Channel rejection: INIT -> REJECTED (2 sites in ssh-conn.c)
    - Unexpected message type: INIT -> PARSE (3 sites in ssh-auth.c)
    - NULL-argument checks: INIT -> INVALID (~36 sites across all 3 files)
    - Wrong-state writes: INIT -> TERMINATED (3 sites in ssh-conn.c)
    - Channel ID exhaustion: ALLOC -> TOOMANY (1 site in ssh-conn.c)
    - Packet too short: TOOLONG -> PARSE with split condition (ssh-trans.c)
    - Negotiation failure: INIT -> INVALID (1 site in ssh-trans.c)
    - Empty registration name: TOOLONG -> INVALID with split (6 funcs)

    Closes TODO items 9 and 44.

    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/840c20c54e883d611d4ee3ec
    Modified Files:
    src/ssh/TODO.md deucessh-auth.h ssh-auth.c ssh-conn.c ssh.c src/ssh/test/CMakeLists.txt test_auth.c
    Log Message:
    Fix 5 bugs: data races, double-start, auth disconnect, cnd_broadcast (items 58-73)

    - Move channel flag pre-checks (open/eof_sent/close_received) into
    dssh_conn_send_data() and dssh_conn_send_extended_data() under buf_mtx,
    fixing data races in write paths (items 58, 59)
    - Change dssh_session_start() double-start guard from demux_running to
    conn_initialized; clear flag in dssh_session_stop() (item 68)
    - Add DSSH_AUTH_DISCONNECT callback return value so server auth callbacks
    can reject and disconnect clients (item 70)
    - Replace all cnd_signal(poll_cnd) with cnd_broadcast to wake all waiters
    when multiple threads poll the same channel (item 73)

    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/147332188dc74f55116a86d7
    Modified Files:
    src/ssh/TODO.md deucessh-algorithms.h deucessh.h ssh-trans.c ssh-trans.h ssh.c src/ssh/test/CMakeLists.txt test_alloc.c test_selftest.c test_transport.c
    Log Message:
    Fix 5 data races: atomic rekey counters, atomic algo pointers, set_ctx gate (items 32, 53, 57, 60, 61)

    Item 53: split bytes_since_rekey into tx/rx halves; make tx counters
    atomic (atomic_uint_fast32_t / atomic_uint_fast64_t) so rekey_needed()
    reads them lock-free from the recv thread without acquiring tx_mtx
    (which send_packet holds across I/O). rx counters remain non-atomic
    under rx_mtx.

    Item 57: make all 10 *_selected pointer fields _Atomic in dssh_transport_state_s so algorithm query functions perform implicit
    atomic loads, eliminating UB during rekey.

    Item 60: dssh_key_algo_set_ctx() now refuses with DSSH_ERROR_TOOLATE
    after first dssh_session_init() (same gconf.used gate as registration).

    Items 61, 32: documented dssh_dh_gex_set_provider() and callback
    setters as must-call-before-start with thrd_create happens-before
    guarantee explanation.

    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/c53a9bd2a9f77019061038c0
    Modified Files:
    src/ssh/TODO.md deucessh-conn.h ssh-arch.c ssh-arch.h ssh-chan.c ssh-chan.h ssh-conn.c ssh-internal.h src/ssh/test/CMakeLists.txt test_arch.c test_chan.c test_conn.c
    Log Message:
    Fix channel close race, remove 14 dead functions (items 62, 79, 89)

    Item 62/79: dssh_session_close() and dssh_channel_close() freed the
    channel while the demux thread held buf_mtx, causing use-after-free.
    Added atomic_bool closing to channel struct; close functions set it
    before unregistering, then acquire/release buf_mtx to synchronize. demux_dispatch() checks closing after each unlock-relock window
    (window-change callback, send CHANNEL_FAILURE) and bails out.
    Added test_close_during_wc_cb regression test (8 CTest variants).

    Item 89: Removed 14 DSSH_PRIVATE functions with no library callers
    (test-only): parse/serialize for byte, boolean, uint64, string, mpint,
    namelist (ssh-arch.c) and msgqueue_peek_size (ssh-chan.c). Cleaned up declarations in ssh-arch.h and ssh-chan.h, removed dead test cases.

    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/ffd00fa66f5d1dfdfde371ec
    Modified Files:
    src/ssh/TODO.md deucessh-comp.h deucessh-enc.h deucessh-kex.h deucessh-key-algo.h deucessh-mac.h ssh-trans.c ssh-trans.h src/ssh/test/test_transport.c
    Log Message:
    Close items 16, 18: type-safe algorithm lists, DEFINE_REGISTER macro

    Item 16: _Static_assert on next field offset for all 6 algorithm
    structs (dssh_kex_s, dssh_key_algo_s, dssh_enc_s, dssh_mac_s,
    dssh_comp_s, dssh_language_s) and test_algo_node. FREE_LIST macro
    now takes a type parameter and uses typed ->next access instead of
    memcpy cast.

    Item 18: six identical dssh_transport_register_*() functions replaced
    with DEFINE_REGISTER(func_name, param_type, head, tail, entries)
    macro (~140 lines -> ~25 lines).

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

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