diff options
author | djm@openbsd.org <djm@openbsd.org> | 2019-01-19 21:35:25 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2019-01-20 09:02:36 +1100 |
commit | e3128b38623eef2fa8d6e7ae934d3bd08c7e973e (patch) | |
tree | ae670e553198bbd5f121b0808fc36b2ef9c4779d | |
parent | ed1df7226caf3a943a36d580d4d4e9275f8a61ee (diff) |
upstream: convert mux.c to new packet API
with & ok markus@
OpenBSD-Commit-ID: 4e3893937bae66416e984b282d8f0f800aafd802
-rw-r--r-- | mux.c | 19 |
1 files changed, 13 insertions, 6 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: mux.c,v 1.78 2019/01/19 21:31:32 djm Exp $ */ | 1 | /* $OpenBSD: mux.c,v 1.79 2019/01/19 21:35:25 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2002-2008 Damien Miller <djm@openbsd.org> | 3 | * Copyright (c) 2002-2008 Damien Miller <djm@openbsd.org> |
4 | * | 4 | * |
@@ -68,9 +68,6 @@ | |||
68 | #include "clientloop.h" | 68 | #include "clientloop.h" |
69 | #include "ssherr.h" | 69 | #include "ssherr.h" |
70 | 70 | ||
71 | #include "opacket.h" /* XXX */ | ||
72 | extern struct ssh *active_state; /* XXX */ | ||
73 | |||
74 | /* from ssh.c */ | 71 | /* from ssh.c */ |
75 | extern int tty_flag; | 72 | extern int tty_flag; |
76 | extern Options options; | 73 | extern Options options; |
@@ -613,6 +610,7 @@ mux_confirm_remote_forward(struct ssh *ssh, int type, u_int32_t seq, void *ctxt) | |||
613 | struct Forward *rfwd; | 610 | struct Forward *rfwd; |
614 | Channel *c; | 611 | Channel *c; |
615 | struct sshbuf *out; | 612 | struct sshbuf *out; |
613 | u_int port; | ||
616 | int r; | 614 | int r; |
617 | 615 | ||
618 | if ((c = channel_by_id(ssh, fctx->cid)) == NULL) { | 616 | 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) | |||
635 | rfwd->connect_host, rfwd->connect_port); | 633 | rfwd->connect_host, rfwd->connect_port); |
636 | if (type == SSH2_MSG_REQUEST_SUCCESS) { | 634 | if (type == SSH2_MSG_REQUEST_SUCCESS) { |
637 | if (rfwd->listen_port == 0) { | 635 | if (rfwd->listen_port == 0) { |
638 | rfwd->allocated_port = packet_get_int(); | 636 | if ((r = sshpkt_get_u32(ssh, &port)) != 0) |
637 | fatal("%s: packet error: %s", | ||
638 | __func__, ssh_err(r)); | ||
639 | if (port > 65535) { | ||
640 | fatal("Invalid allocated port %u for " | ||
641 | "mux remote forward to %s:%d", port, | ||
642 | rfwd->connect_host, rfwd->connect_port); | ||
643 | } | ||
644 | rfwd->allocated_port = (int)port; | ||
639 | debug("Allocated port %u for mux remote forward" | 645 | debug("Allocated port %u for mux remote forward" |
640 | " to %s:%d", rfwd->allocated_port, | 646 | " to %s:%d", rfwd->allocated_port, |
641 | rfwd->connect_host, rfwd->connect_port); | 647 | rfwd->connect_host, rfwd->connect_port); |
@@ -1409,7 +1415,8 @@ mux_session_confirm(struct ssh *ssh, int id, int success, void *arg) | |||
1409 | if (cctx->want_agent_fwd && options.forward_agent) { | 1415 | if (cctx->want_agent_fwd && options.forward_agent) { |
1410 | debug("Requesting authentication agent forwarding."); | 1416 | debug("Requesting authentication agent forwarding."); |
1411 | channel_request_start(ssh, id, "auth-agent-req@openssh.com", 0); | 1417 | channel_request_start(ssh, id, "auth-agent-req@openssh.com", 0); |
1412 | packet_send(); | 1418 | if ((r = sshpkt_send(ssh)) != 0) |
1419 | fatal("%s: packet error: %s", __func__, ssh_err(r)); | ||
1413 | } | 1420 | } |
1414 | 1421 | ||
1415 | client_session2_setup(ssh, id, cctx->want_tty, cctx->want_subsys, | 1422 | client_session2_setup(ssh, id, cctx->want_tty, cctx->want_subsys, |