LEFT | RIGHT |
1 // Copyright 2011 The Go Authors. All rights reserved. | 1 // Copyright 2011 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 package ssh | 5 package ssh |
6 | 6 |
7 // Session implements an interactive session described in | 7 // Session implements an interactive session described in |
8 // "RFC 4254, section 6". | 8 // "RFC 4254, section 6". |
9 | 9 |
10 import ( | 10 import ( |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 WantReply: true, | 219 WantReply: true, |
220 Subsystem: subsystem, | 220 Subsystem: subsystem, |
221 } | 221 } |
222 if err := s.writePacket(marshal(msgChannelRequest, req)); err != nil { | 222 if err := s.writePacket(marshal(msgChannelRequest, req)); err != nil { |
223 return err | 223 return err |
224 } | 224 } |
225 return s.waitForResponse() | 225 return s.waitForResponse() |
226 } | 226 } |
227 | 227 |
228 func (s *Session) issueAgentRequest() error { | 228 func (s *Session) issueAgentRequest() error { |
229 req := channelRequestMsg{ | 229 req := channelRequestMsg{ |
230 PeersId: s.remoteId, | 230 PeersId: s.remoteId, |
231 Request: "auth-agent-req@openssh.com", | 231 Request: "auth-agent-req@openssh.com", |
232 WantReply: false, | 232 WantReply: false, |
233 } | 233 } |
234 if err := s.writePacket(marshal(msgChannelRequest, req)); err != nil { | 234 if err := s.writePacket(marshal(msgChannelRequest, req)); err != nil { |
235 return err | 235 return err |
236 } | 236 } |
237 return nil | 237 return nil |
238 } | 238 } |
239 | 239 |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 c.chanList.remove(ch.localId) | 585 c.chanList.remove(ch.localId) |
586 return nil, err | 586 return nil, err |
587 } | 587 } |
588 if err := ch.waitForChannelOpenResponse(); err != nil { | 588 if err := ch.waitForChannelOpenResponse(); err != nil { |
589 c.chanList.remove(ch.localId) | 589 c.chanList.remove(ch.localId) |
590 return nil, fmt.Errorf("ssh: unable to open session: %v", err) | 590 return nil, fmt.Errorf("ssh: unable to open session: %v", err) |
591 } | 591 } |
592 s := &Session{ | 592 s := &Session{ |
593 clientChan: ch, | 593 clientChan: ch, |
594 } | 594 } |
595 » if c.config.ForwardingAgentConnector != nil { | 595 » if c.config.ForwardingAgentDialer != nil { |
596 err := s.issueAgentRequest() | 596 err := s.issueAgentRequest() |
597 if err != nil { | 597 if err != nil { |
598 return nil, fmt.Errorf("ssh: unable to request agent for
warding: %v", err) | 598 return nil, fmt.Errorf("ssh: unable to request agent for
warding: %v", err) |
599 } | 599 } |
600 } | 600 } |
601 return s, nil | 601 return s, nil |
602 } | 602 } |
603 | 603 |
604 // An ExitError reports unsuccessful completion of a remote command. | 604 // An ExitError reports unsuccessful completion of a remote command. |
605 type ExitError struct { | 605 type ExitError struct { |
(...skipping 30 matching lines...) Expand all Loading... |
636 } | 636 } |
637 | 637 |
638 // Lang returns the language tag. See RFC 3066 | 638 // Lang returns the language tag. See RFC 3066 |
639 func (w Waitmsg) Lang() string { | 639 func (w Waitmsg) Lang() string { |
640 return w.lang | 640 return w.lang |
641 } | 641 } |
642 | 642 |
643 func (w Waitmsg) String() string { | 643 func (w Waitmsg) String() string { |
644 return fmt.Sprintf("Process exited with: %v. Reason was: %v (%v)", w.sta
tus, w.msg, w.signal) | 644 return fmt.Sprintf("Process exited with: %v. Reason was: %v (%v)", w.sta
tus, w.msg, w.signal) |
645 } | 645 } |
LEFT | RIGHT |