|
Lines 140-145
int session_ident = -1;
Link Here
|
| 140 |
struct confirm_ctx { |
140 |
struct confirm_ctx { |
| 141 |
int want_tty; |
141 |
int want_tty; |
| 142 |
int want_subsys; |
142 |
int want_subsys; |
|
|
143 |
int want_x_fwd; |
| 144 |
int want_agent_fwd; |
| 143 |
Buffer cmd; |
145 |
Buffer cmd; |
| 144 |
char *term; |
146 |
char *term; |
| 145 |
struct termios tio; |
147 |
struct termios tio; |
|
Lines 631-636
static void
Link Here
|
| 631 |
client_extra_session2_setup(int id, void *arg) |
633 |
client_extra_session2_setup(int id, void *arg) |
| 632 |
{ |
634 |
{ |
| 633 |
struct confirm_ctx *cctx = arg; |
635 |
struct confirm_ctx *cctx = arg; |
|
|
636 |
const char *display; |
| 634 |
Channel *c; |
637 |
Channel *c; |
| 635 |
int i; |
638 |
int i; |
| 636 |
|
639 |
|
|
Lines 639-644
client_extra_session2_setup(int id, void
Link Here
|
| 639 |
if ((c = channel_lookup(id)) == NULL) |
642 |
if ((c = channel_lookup(id)) == NULL) |
| 640 |
fatal("%s: no channel for id %d", __func__, id); |
643 |
fatal("%s: no channel for id %d", __func__, id); |
| 641 |
|
644 |
|
|
|
645 |
display = getenv("DISPLAY"); |
| 646 |
if (cctx->want_x_fwd && options.forward_x11 && display != NULL) { |
| 647 |
char *proto, *data; |
| 648 |
/* Get reasonable local authentication information. */ |
| 649 |
client_x11_get_proto(display, options.xauth_location, |
| 650 |
options.forward_x11_trusted, &proto, &data); |
| 651 |
/* Request forwarding with authentication spoofing. */ |
| 652 |
debug("Requesting X11 forwarding with authentication spoofing."); |
| 653 |
x11_request_forwarding_with_spoofing(id, display, proto, data); |
| 654 |
/* XXX wait for reply */ |
| 655 |
} |
| 656 |
|
| 657 |
if (cctx->want_agent_fwd && options.forward_agent) { |
| 658 |
debug("Requesting authentication agent forwarding."); |
| 659 |
channel_request_start(id, "auth-agent-req@openssh.com", 0); |
| 660 |
packet_send(); |
| 661 |
} |
| 662 |
|
| 642 |
client_session2_setup(id, cctx->want_tty, cctx->want_subsys, |
663 |
client_session2_setup(id, cctx->want_tty, cctx->want_subsys, |
| 643 |
cctx->term, &cctx->tio, c->rfd, &cctx->cmd, cctx->env, |
664 |
cctx->term, &cctx->tio, c->rfd, &cctx->cmd, cctx->env, |
| 644 |
client_subsystem_reply); |
665 |
client_subsystem_reply); |
|
Lines 704-710
client_process_control(fd_set * readset)
Link Here
|
| 704 |
buffer_free(&m); |
725 |
buffer_free(&m); |
| 705 |
return; |
726 |
return; |
| 706 |
} |
727 |
} |
| 707 |
if ((ver = buffer_get_char(&m)) != 1) { |
728 |
if ((ver = buffer_get_char(&m)) != SSHMUX_VER) { |
| 708 |
error("%s: wrong client version %d", __func__, ver); |
729 |
error("%s: wrong client version %d", __func__, ver); |
| 709 |
buffer_free(&m); |
730 |
buffer_free(&m); |
| 710 |
close(client_fd); |
731 |
close(client_fd); |
|
Lines 738-744
client_process_control(fd_set * readset)
Link Here
|
| 738 |
buffer_clear(&m); |
759 |
buffer_clear(&m); |
| 739 |
buffer_put_int(&m, allowed); |
760 |
buffer_put_int(&m, allowed); |
| 740 |
buffer_put_int(&m, getpid()); |
761 |
buffer_put_int(&m, getpid()); |
| 741 |
if (ssh_msg_send(client_fd, /* version */1, &m) == -1) { |
762 |
if (ssh_msg_send(client_fd, SSHMUX_VER, &m) == -1) { |
| 742 |
error("%s: client msg_send failed", __func__); |
763 |
error("%s: client msg_send failed", __func__); |
| 743 |
close(client_fd); |
764 |
close(client_fd); |
| 744 |
buffer_free(&m); |
765 |
buffer_free(&m); |
|
Lines 758-764
client_process_control(fd_set * readset)
Link Here
|
| 758 |
buffer_clear(&m); |
779 |
buffer_clear(&m); |
| 759 |
buffer_put_int(&m, allowed); |
780 |
buffer_put_int(&m, allowed); |
| 760 |
buffer_put_int(&m, getpid()); |
781 |
buffer_put_int(&m, getpid()); |
| 761 |
if (ssh_msg_send(client_fd, /* version */1, &m) == -1) { |
782 |
if (ssh_msg_send(client_fd, SSHMUX_VER, &m) == -1) { |
| 762 |
error("%s: client msg_send failed", __func__); |
783 |
error("%s: client msg_send failed", __func__); |
| 763 |
close(client_fd); |
784 |
close(client_fd); |
| 764 |
buffer_free(&m); |
785 |
buffer_free(&m); |
|
Lines 779-785
client_process_control(fd_set * readset)
Link Here
|
| 779 |
buffer_free(&m); |
800 |
buffer_free(&m); |
| 780 |
return; |
801 |
return; |
| 781 |
} |
802 |
} |
| 782 |
if ((ver = buffer_get_char(&m)) != 1) { |
803 |
if ((ver = buffer_get_char(&m)) != SSHMUX_VER) { |
| 783 |
error("%s: wrong client version %d", __func__, ver); |
804 |
error("%s: wrong client version %d", __func__, ver); |
| 784 |
buffer_free(&m); |
805 |
buffer_free(&m); |
| 785 |
close(client_fd); |
806 |
close(client_fd); |
|
Lines 790-795
client_process_control(fd_set * readset)
Link Here
|
| 790 |
memset(cctx, 0, sizeof(*cctx)); |
811 |
memset(cctx, 0, sizeof(*cctx)); |
| 791 |
cctx->want_tty = (flags & SSHMUX_FLAG_TTY) != 0; |
812 |
cctx->want_tty = (flags & SSHMUX_FLAG_TTY) != 0; |
| 792 |
cctx->want_subsys = (flags & SSHMUX_FLAG_SUBSYS) != 0; |
813 |
cctx->want_subsys = (flags & SSHMUX_FLAG_SUBSYS) != 0; |
|
|
814 |
cctx->want_x_fwd = (flags & SSHMUX_FLAG_X11_FWD) != 0; |
| 815 |
cctx->want_agent_fwd = (flags & SSHMUX_FLAG_AGENT_FWD) != 0; |
| 793 |
cctx->term = buffer_get_string(&m, &len); |
816 |
cctx->term = buffer_get_string(&m, &len); |
| 794 |
|
817 |
|
| 795 |
cmd = buffer_get_string(&m, &len); |
818 |
cmd = buffer_get_string(&m, &len); |
|
Lines 823-829
client_process_control(fd_set * readset)
Link Here
|
| 823 |
|
846 |
|
| 824 |
/* This roundtrip is just for synchronisation of ttymodes */ |
847 |
/* This roundtrip is just for synchronisation of ttymodes */ |
| 825 |
buffer_clear(&m); |
848 |
buffer_clear(&m); |
| 826 |
if (ssh_msg_send(client_fd, /* version */1, &m) == -1) { |
849 |
if (ssh_msg_send(client_fd, SSHMUX_VER, &m) == -1) { |
| 827 |
error("%s: client msg_send failed", __func__); |
850 |
error("%s: client msg_send failed", __func__); |
| 828 |
close(client_fd); |
851 |
close(client_fd); |
| 829 |
close(new_fd[0]); |
852 |
close(new_fd[0]); |