• src/ssh/test/dssh_test.h dssh_test_internal.h mock_io.c mock_io.h test

    From Deucе@VERT to Git commit to main/sbbs/master on Sun Mar 22 16:11:13 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/73b091e62b39ef31f4601784
    Added Files:
    src/ssh/test/dssh_test.h dssh_test_internal.h mock_io.c mock_io.h test_algo_enc.c test_algo_key.c test_algo_mac.c test_arch.c test_auth.c test_chan.c test_conn.c test_selftest.c test_transport.c
    Modified Files:
    src/ssh/CMakeLists.txt deucessh-conn.h server.c ssh-auth.c ssh-conn.c ssh-trans.c ssh-trans.h
    Log Message:
    DeuceSSH: 367-test suite, 6 bug fixes, channel request API redesign

    Test suite (13,000+ lines across 9 executables):
    - Tier 1 unit tests: arch (89), chan (75), algo_enc (23), algo_mac (18), algo_key (32)
    - Tier 2 layer tests: transport (63), auth (20), conn (33)
    - Tier 3 integration: selftest via socketpair (14)
    - CMake: DEUCESSH_BUILD_TESTS option, ctest integration
    - Infrastructure: dssh_test.h framework, mock_io bidirectional pipe layer,
    dssh_test_internal.h for DSSH_TESTABLE static function exposure

    Bug fixes found by the test suite:
    - ssh-trans.c: recv_packet KEXINIT handler caused recursive rekey during
    self-initiated rekey, sending duplicate KEXINIT that corrupted KEX
    - ssh-auth.c: auth_password/publickey/keyboard_interactive missing
    ensure_auth_service call (SERVICE_REQUEST never sent)
    - ssh-auth.c: server publickey verify computed wrong before_sig offset
    (rpos - sig_len - 4 instead of rpos - 4), failing all signature checks
    - ssh-trans.c: auto-rekey in recv_packet default case overwrote rx_packet
    while payload pointer was still live; deferred via rekey_pending flag
    - ssh-trans.c: kexinit failed on non-KEXINIT packets during rekey
    (application data arriving before peer's KEXINIT); now loops to skip
    - ssh-trans.c: DSSH_TESTABLE inline functions needed extern inline
    declarations for C17 linkage

    API redesign — dssh_server_session_cbs:
    - Replaced per-type callbacks (pty_req, env) with single
    dssh_channel_request_cb fired for every SSH_MSG_CHANNEL_REQUEST
    - Channel type deferred until terminal request: shell/exec creates
    DSSH_CHAN_SESSION (stream bytebufs), subsystem creates DSSH_CHAN_RAW
    (message queue) — both sides of subsystem now use raw I/O
    - Added parse helpers: dssh_parse_pty_req_data, dssh_parse_env_data,
    dssh_parse_exec_data, dssh_parse_subsystem_data

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

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