Skip to content

Add exec channel request support (RFC 4254 §6.5)#95

Merged
kruton merged 2 commits into
connectbot:mainfrom
GlassOnTin:exec-channel
Apr 3, 2026
Merged

Add exec channel request support (RFC 4254 §6.5)#95
kruton merged 2 commits into
connectbot:mainfrom
GlassOnTin:exec-channel

Conversation

@GlassOnTin

Copy link
Copy Markdown
Contributor

Summary

Adds requestExec(command: String): Boolean to the SshSession interface and SessionChannel implementation, enabling remote command execution on session channels.

  • Follows the same pattern as requestShell() — uses sendChannelRequest("exec", ...) with the existing ChannelRequestExec Kaitai definition
  • Only one of requestShell, requestExec, or subsystem requests may succeed per session channel (per RFC 4254 §6.5)
  • Integration tests verify stdout and stderr output from executed commands

Changes

  • SshSession.kt — added requestExec(command: String): Boolean to the interface
  • SessionChannel.kt — implementation using ChannelRequestExec protocol message
  • SshClientIntegrationTest.kt — two integration tests:
    • Execute command and read stdout
    • Execute command and read stderr

Test plan

  • ./gradlew :sshlib:test — integration tests pass against OpenSSH testcontainer
  • Verify exec produces correct stdout output (echo hello-exec)
  • Verify exec produces correct stderr output (echo error-output >&2)

@kruton

kruton commented Apr 3, 2026

Copy link
Copy Markdown
Member

You also have to run ./gradlew metalavaGenerateSignature since you're adding an API.

@kruton kruton left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Run ./gradlew metalavaGenerateSignature

Add requestExec(command) to SshSession interface and SessionChannel
implementation, following the same pattern as requestShell(). This
enables remote command execution on session channels.

Integration tests verify stdout and stderr output from executed commands.
@GlassOnTin

Copy link
Copy Markdown
Contributor Author

Done — ran metalavaGenerateSignature and pushed the updated api.txt. Only requestExec added to both SshSession and SessionChannel.

@kruton
kruton merged commit 88e113f into connectbot:main Apr 3, 2026
5 checks passed
@GlassOnTin
GlassOnTin deleted the exec-channel branch April 5, 2026 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants