Skip to content

Commit 5f859b0

Browse files
committed
add BuildChannelRequestString
1 parent 665ac92 commit 5f859b0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

x/crypto/ssh/client_research.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ func (uac *UnauthClientConn) BuildChannelOpen(id uint32, name string, payload []
242242
}
243243

244244
func (uac *UnauthClientConn) BuildChannelRequest(id uint32, name string, payload []byte, wantReply bool) []byte {
245+
245246
msg := channelRequestMsg{
246247
PeersID: id,
247248
Request: name,
@@ -251,6 +252,14 @@ func (uac *UnauthClientConn) BuildChannelRequest(id uint32, name string, payload
251252
return Marshal(msg)
252253
}
253254

255+
func (uac *UnauthClientConn) BuildChannelRequestString(id uint32, name string, payload string, wantReply bool) []byte {
256+
req := execMsg{ // Struct with a single string field
257+
Command: payload,
258+
}
259+
raw := Marshal(&req)
260+
return uac.BuildChannelRequest(id, name, raw, wantReply)
261+
}
262+
254263
// Setenv sets an environment variable that will be applied to any
255264
// command executed by Shell or Run.
256265
func (s *Session) SetenvNoReply(name, value string) error {

0 commit comments

Comments
 (0)