• src/ssh/NOTES.mdsrc/ssh/TODO.md ssh-auth.c ssh-conn.c ssh-internal.h s

    From Deuc¿@VERT to Git commit to main/sbbs/master on Monday, March 23, 2026 20:49:18
    https://gitlab.synchro.net/main/sbbs/-/commit/bebeb7b0feaf3126bfa46bc9
    Added Files:
    src/ssh/NOTES.md
    Modified Files:
    src/ssh/TODO.md ssh-auth.c ssh-conn.c ssh-internal.h ssh-trans.c ssh.c src/ssh/test/mock_io.c test_alloc.c test_conn.c
    Log Message:
    Fix session termination: signal waiters, promote fatal auth errors

    Previously, setting sess->terminate did not wake threads blocked on
    library condvars or I/O callbacks, causing deadlocks when one side
    of a connection failed internally.

    Changes:

    - dssh_session_set_terminate(): new internal helper that sets the
    terminate flag AND broadcasts rekey_cnd, accept_cnd, and all
    per-channel poll_cnd. All code that previously set sess->terminate
    directly now calls this function.

    - send_packet sets terminate on fatal errors (not TOOLONG/REKEY_NEEDED).
    recv_packet_raw sets terminate on all errors (all are fatal).
    handshake() and rekey() set terminate on failure.

    - Auth functions (server, password, get_methods, keyboard_interactive,
    publickey) wrap their implementations with auth_check_terminated(),
    which promotes any negative return to DSSH_ERROR_TERMINATED when
    sess->terminate is set. Auth rejection (USERAUTH_FAILURE) does
    NOT set terminate, so callers can distinguish recoverable rejection
    from fatal connection loss.

    - Mock I/O uses 50ms timed waits instead of indefinite cnd_wait so
    the terminate flag check runs promptly.

    - conn_cleanup no longer needs to close pipes before session_stop
    since the terminate signal now propagates through timed waits.

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

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