- M0: libghostty SSH 终端(渲染/输入/连接)+ 白屏修复(OutputGate) + 会话状态机/自动重连 - M1: tsnet 用户态组网 + SSH-over-tsnet(fd 桥),shell 级真机验证;R5(Go+gvisor+C+++Swift 同进程) retire - M1.5: tmux -CC 原生 tab(MVP) - 结构: packages/(TXCore·TXTransport), apps/TerminalX, vendor/(libghostty-spm/libssh2/mbedtls/tsnet-bridge), artifacts/ - 文档: CLAUDE.md + docs/HANDOFF.md(新会话入口) - 环境: 认证代理→依赖 vendor 本地化;Go 在 ~/.local/go;仅模拟器/未签名 - 待续: M2 mosh, tmux 多 pane, M4 安全(host key/SE) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
58 lines
1.6 KiB
C
58 lines
1.6 KiB
C
/* Copyright (C) The libssh2 project and its contributors.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
|
|
#include "runner.h"
|
|
|
|
static const char *username = "libssh2"; /* set in Dockerfile */
|
|
static const char *key_file_private = "key_rsa";
|
|
static const char *key_file_public = "key_rsa.pub"; /* set in Dockerfile */
|
|
|
|
int test(LIBSSH2_SESSION *session)
|
|
{
|
|
int rc;
|
|
LIBSSH2_CHANNEL *channel;
|
|
|
|
const char *userauth_list =
|
|
libssh2_userauth_list(session, username,
|
|
(unsigned int)strlen(username));
|
|
if(!userauth_list) {
|
|
print_last_session_error("libssh2_userauth_list");
|
|
return 1;
|
|
}
|
|
|
|
if(!strstr(userauth_list, "publickey")) {
|
|
fprintf(stderr, "'publickey' was expected in userauth list: %s\n",
|
|
userauth_list);
|
|
return 1;
|
|
}
|
|
|
|
rc = libssh2_userauth_publickey_fromfile_ex(session, username,
|
|
(unsigned int)strlen(username),
|
|
srcdir_path(key_file_public),
|
|
srcdir_path(key_file_private),
|
|
NULL);
|
|
if(rc) {
|
|
print_last_session_error("libssh2_userauth_publickey_fromfile_ex");
|
|
return 1;
|
|
}
|
|
|
|
channel = libssh2_channel_open_session(session);
|
|
#if 0
|
|
if(!channel) {
|
|
printf("Error opening channel\n");
|
|
return 1;
|
|
}
|
|
#endif
|
|
|
|
rc = libssh2_channel_request_auth_agent(channel);
|
|
if(rc) {
|
|
fprintf(stderr, "Auth agent request for agent forwarding failed, "
|
|
"error code %d\n", rc);
|
|
return 1;
|
|
}
|
|
|
|
return 0;
|
|
}
|