upstream: convert mux.c to new packet API
with & ok markus@ OpenBSD-Commit-ID: 4e3893937bae66416e984b282d8f0f800aafd802
This commit is contained in:
parent
ed1df7226c
commit
e3128b3862
19
mux.c
19
mux.c
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: mux.c,v 1.78 2019/01/19 21:31:32 djm Exp $ */
|
/* $OpenBSD: mux.c,v 1.79 2019/01/19 21:35:25 djm Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2002-2008 Damien Miller <djm@openbsd.org>
|
* Copyright (c) 2002-2008 Damien Miller <djm@openbsd.org>
|
||||||
*
|
*
|
||||||
|
@ -68,9 +68,6 @@
|
||||||
#include "clientloop.h"
|
#include "clientloop.h"
|
||||||
#include "ssherr.h"
|
#include "ssherr.h"
|
||||||
|
|
||||||
#include "opacket.h" /* XXX */
|
|
||||||
extern struct ssh *active_state; /* XXX */
|
|
||||||
|
|
||||||
/* from ssh.c */
|
/* from ssh.c */
|
||||||
extern int tty_flag;
|
extern int tty_flag;
|
||||||
extern Options options;
|
extern Options options;
|
||||||
|
@ -613,6 +610,7 @@ mux_confirm_remote_forward(struct ssh *ssh, int type, u_int32_t seq, void *ctxt)
|
||||||
struct Forward *rfwd;
|
struct Forward *rfwd;
|
||||||
Channel *c;
|
Channel *c;
|
||||||
struct sshbuf *out;
|
struct sshbuf *out;
|
||||||
|
u_int port;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
if ((c = channel_by_id(ssh, fctx->cid)) == NULL) {
|
if ((c = channel_by_id(ssh, fctx->cid)) == NULL) {
|
||||||
|
@ -635,7 +633,15 @@ mux_confirm_remote_forward(struct ssh *ssh, int type, u_int32_t seq, void *ctxt)
|
||||||
rfwd->connect_host, rfwd->connect_port);
|
rfwd->connect_host, rfwd->connect_port);
|
||||||
if (type == SSH2_MSG_REQUEST_SUCCESS) {
|
if (type == SSH2_MSG_REQUEST_SUCCESS) {
|
||||||
if (rfwd->listen_port == 0) {
|
if (rfwd->listen_port == 0) {
|
||||||
rfwd->allocated_port = packet_get_int();
|
if ((r = sshpkt_get_u32(ssh, &port)) != 0)
|
||||||
|
fatal("%s: packet error: %s",
|
||||||
|
__func__, ssh_err(r));
|
||||||
|
if (port > 65535) {
|
||||||
|
fatal("Invalid allocated port %u for "
|
||||||
|
"mux remote forward to %s:%d", port,
|
||||||
|
rfwd->connect_host, rfwd->connect_port);
|
||||||
|
}
|
||||||
|
rfwd->allocated_port = (int)port;
|
||||||
debug("Allocated port %u for mux remote forward"
|
debug("Allocated port %u for mux remote forward"
|
||||||
" to %s:%d", rfwd->allocated_port,
|
" to %s:%d", rfwd->allocated_port,
|
||||||
rfwd->connect_host, rfwd->connect_port);
|
rfwd->connect_host, rfwd->connect_port);
|
||||||
|
@ -1409,7 +1415,8 @@ mux_session_confirm(struct ssh *ssh, int id, int success, void *arg)
|
||||||
if (cctx->want_agent_fwd && options.forward_agent) {
|
if (cctx->want_agent_fwd && options.forward_agent) {
|
||||||
debug("Requesting authentication agent forwarding.");
|
debug("Requesting authentication agent forwarding.");
|
||||||
channel_request_start(ssh, id, "auth-agent-req@openssh.com", 0);
|
channel_request_start(ssh, id, "auth-agent-req@openssh.com", 0);
|
||||||
packet_send();
|
if ((r = sshpkt_send(ssh)) != 0)
|
||||||
|
fatal("%s: packet error: %s", __func__, ssh_err(r));
|
||||||
}
|
}
|
||||||
|
|
||||||
client_session2_setup(ssh, id, cctx->want_tty, cctx->want_subsys,
|
client_session2_setup(ssh, id, cctx->want_tty, cctx->want_subsys,
|
||||||
|
|
Loading…
Reference in New Issue