• src/ssh/ssh-auth.c ssh-co

    From Deuc¿@VERT to Git commit to main/sbbs/m on Friday, March 27, 2026 20:57:00
    https://gitlab.synchro.net/main/sbbs/-/commit/dc1ce31aedfba6301fe7adce
    Modified Files:
    src/ssh/ssh-auth.c ssh-conn.c ssh-internal.h ssh-trans.c src/ssh/test/test_arch.c
    Log Message:
    Add DSSH_GET_U32/DSSH_PUT_U32 internal macros, convert all ~130 call sites

    Unchecked big-endian uint32 read/write macros for internal library use (ssh-trans.c, ssh-auth.c, ssh-conn.c). Every call site individually
    audited: buffer size guards preserved where they were the sole protection, removed where already covered by prior bounds checks or exactly-sized allocations. Modules (kex/, key_algo/) continue using the public dssh_parse_uint32/dssh_serialize_uint32 functions.

    Eliminates 322 unreachable error-handling branches, raising overall branch coverage from 81.5% to 84.9%. Adds serialize_pos_past_bufsz test to
    bring ssh-arch.c back to 100% branch coverage.

    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, April 01, 2026 16:21:00
    https://gitlab.synchro.net/main/sbbs/-/commit/610b12d10ee3ad5bc6771115
    Modified Files:
    src/ssh/ssh-auth.c ssh-conn.c ssh-trans.c ssh-trans.h src/ssh/test/CMakeLists.txt test_alloc.c test_auth.c
    Log Message:
    Serialize packets directly into tx_packet via send_begin/send_commit

    Every send_packet() call copies the payload into the session's
    pre-allocated tx_packet buffer. 16 call sites in ssh-auth.c and
    ssh-conn.c were malloc'ing a temporary buffer, serializing into it,
    passing it to send_packet() (which memcpy'd into tx_packet), then
    immediately freeing the temporary Ä a pointless double-copy.

    Add send_begin/send_commit/send_cancel internal API that returns a
    pointer directly into tx_packet[9] with tx_mtx held, letting callers
    serialize in-place. This mirrors the existing zero-copy channel
    send path (zc_getbuf_inner/zc_send_inner). Refactor send_packet()
    itself to use send_begin + memcpy + send_commit.

    Convert all 16 malloc/send_packet/free sites:
    - ssh-auth.c (12): send_auth_failure, send_passwd_changereq,
    send_pk_ok, send_info_request, flush_pending_banner,
    server SERVICE_ACCEPT, dssh_auth_request_service,
    get_methods_impl, send_password_request, auth_kbi_impl (x2),
    auth_publickey_impl
    - ssh-conn.c (4): send_channel_request_wait,
    dssh_chan_send_signal, dssh_chan_send_window_change,
    dssh_chan_send_break

    Delete 12 alloc-failure tests that tested the now-eliminated malloc
    paths. Remove n>0 guard in alloc/auth_iterate since the password
    auth path now has zero library mallocs.

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

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