• src/ssh/ssh-auth.c ssh-conn.c ssh-trans.c ssh-trans.h src/ssh/test/CMa

    From Deuc¨@VERT to Git commit to main/sbbs/master on Wed Apr 1 16:21:56 2026
    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