Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(249)

Unified Diff: ssh/session.go

Issue 6295096: code review 6295096: Added RequestSubsystem(), according to RFC 4254 Section...
Patch Set: diff -r 6e3ad7e7a476 https://code.google.com/p/go.crypto/ Created 13 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ssh/session.go
===================================================================
--- a/ssh/session.go
+++ b/ssh/session.go
@@ -85,6 +85,14 @@
Value string
}
+// RFC 4254 Section 6.5.
+type subsystemRequestMsg struct {
+ PeersId uint32
+ Request string
+ WantReply bool
+ Subsystem string
+}
+
// Setenv sets an environment variable that will be applied to any
// command executed by Shell or Run.
func (s *Session) Setenv(name, value string) error {
@@ -136,6 +144,21 @@
return s.waitForResponse()
}
+// RequestSubsystem requests the association of a subsystem with the session on the remote host.
+// A subsystem is a predefined command that runs in the background when the ssh session is initiated
+func (s *Session) RequestSubsystem(subsystem string) error {
+ req := subsystemRequestMsg{
+ PeersId: s.remoteId,
+ Request: "subsystem",
+ WantReply: true,
+ Subsystem: subsystem,
+ }
+ if err := s.writePacket(marshal(msgChannelRequest, req)); err != nil {
+ return err
+ }
+ return s.waitForResponse()
+}
+
// RFC 4254 Section 6.9.
type signalMsg struct {
PeersId uint32
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b