func parseExecRequest(req *ssh.Request, ctx *ctx) (*execResponse, error) {
	var e execReq
	if err := ssh.Unmarshal(req.Payload, &e); err != nil {
		return nil, fmt.Errorf("failed to parse exec request, error: %v", err)
	}
	// is this scp request?
	args := strings.Split(e.Command, " ")
	if len(args) > 0 {
		_, f := filepath.Split(args[0])
		if f == "scp" {
			// for 'scp' requests, we'll fork ourselves with scp parameters:
			teleportBin, err := osext.Executable()
			if err != nil {
				return nil, trace.Wrap(err)
			}
			e.Command = fmt.Sprintf("%s scp --remote-addr=%s --local-addr=%s %v",
				teleportBin,
				ctx.conn.RemoteAddr().String(),
				ctx.conn.LocalAddr().String(),
				strings.Join(args[1:], " "))
		}
	}
	ctx.exec = &execResponse{
		ctx:     ctx,
		cmdName: e.Command,
	}
	return ctx.exec, nil
}
// parseExecRequest parses SSH exec request
parseExecRequest parses SSH exec request
// parseExecRequest parses SSH exec request
func parseExecRequest(req *ssh.Request, ctx *ctx) (*execResponse, error) {
	var e execReq
	if err := ssh.Unmarshal(req.Payload, &e); err != nil {
		return nil, fmt.Errorf("failed to parse exec request, error: %v", err)
	}
	args := strings.Split(e.Command, " ")
	if len(args) > 0 {
		_, f := filepath.Split(args[0])
		if f == "scp" {
			teleportBin, err := osext.Executable()
			if err != nil {
				return nil, trace.Wrap(err)
			}
			e.Command = fmt.Sprintf("%s scp --remote-addr=%s --local-addr=%s %v",
				teleportBin,
				ctx.conn.RemoteAddr().String(),
				ctx.conn.LocalAddr().String(),
				strings.Join(args[1:], " "))
		}
	}
	ctx.exec = &execResponse{
		ctx:     ctx,
		cmdName: e.Command,
	}
	return ctx.exec, nil
}
func parseExecRequest ( req * ssh . Request , ctx * ctx ) ( * execResponse , error ) { var e execReq if err := ssh . Unmarshal ( req . Payload , & e ) ; err != nil { return nil , fmt . Errorf ( " " , err ) } args := strings . Split ( e . Command , " " ) if len ( args ) > 0 { _ , f := filepath . Split ( args [ 0 ] ) if f == " " { teleportBin , err := osext . Executable ( ) if err != nil { return nil , trace . Wrap ( err ) } e . Command = fmt . Sprintf ( " " , teleportBin , ctx . conn . RemoteAddr ( ) . String ( ) , ctx . conn . LocalAddr ( ) . String ( ) , strings . Join ( args [ 1 : ] , " " ) ) } } ctx . exec = & execResponse { ctx : ctx , cmdName : e . Command , } return ctx . exec , nil }
parseExecRequest parses SSH exec request
parseExecRequest parses SSH exec request
// is this scp request? // for 'scp' requests, we'll fork ourselves with scp parameters: