Android: SSH on libdmodemssh through JNI, sshj gone

The SSH client is the same as iOS's and the GUI's now: native-ssh, on
libssh, loaded as libdmodem_ssh_jni.so (NativeSsh.kt). SshLink polls
it on its own thread; its channels carry the shell, commands, the
port forwards (-L, -R, -D) and the forwarded agent's requests. Keys
stay the app's: SSH's wire form (SshWire.kt), OpenSSH's and PEM keys
read through the engine, PuTTY's .ppk read here, all on BouncyCastle.

The engine: commands can forward the agent, a write tells what's still
kept for the server (forwards hold back a fast sender), libssh built
WITH_SERVER (its callbacks for the agent's channels need it), and its
remote listen on port 0 patched to take the port from its own reply.

The unit tests build the JNI library for the host (buildHostSsh) and
run against it: OpenSSH's sshd, puttygen and Apache MINA's server.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRSV65geuGd6zMt2V6r
This commit is contained in:
Claude committed 2026-11-12 13:46:38 +00:00
1 parent 55bd6015da
commit e567071ad9
28 files changed
+1726 -566

No files matched your search

+5 -4
View File
@@ -132,8 +132,8 @@ void dmc_ssh_answered(dmc_ssh *s);
DMC_SSH_EV_OPEN tells whether it opened */
/* a shell on a pty of term in the given size; agent: ssh -A asked */
int dmc_ssh_shell(dmc_ssh *s, const char *term, int cols, int rows, int agent);
/* a command run, with no pty */
int dmc_ssh_exec(dmc_ssh *s, const char *command);
/* a command run, with no pty; agent: ssh -A asked */
int dmc_ssh_exec(dmc_ssh *s, const char *command, int agent);
/* a TCP connection made from the server to host:port (ssh -L, -D), for
a connection that came from from_host:from_port */
int dmc_ssh_direct(dmc_ssh *s, const char *host, int port,
@@ -144,8 +144,9 @@ int dmc_ssh_direct(dmc_ssh *s, const char *host, int port,
int dmc_ssh_listen(dmc_ssh *s, const char *address, int port);
/* that listen stopped */
void dmc_ssh_unlisten(dmc_ssh *s, const char *address, int port);
/* data to a channel (kept until the server can take it): 0, or -1 if
the channel isn't open */
/* data to a channel (kept until the server can take it): how many
bytes are still kept (0 when all went; len 0 asks), or -1 if the
channel isn't open */
int dmc_ssh_write(dmc_ssh *s, int channel, const char *data, int len);
/* the channel's end of data sent */
void dmc_ssh_eof(dmc_ssh *s, int channel);