summaryrefslogtreecommitdiff
path: root/channels.c
diff options
context:
space:
mode:
Diffstat (limited to 'channels.c')
-rw-r--r--channels.c45
1 files changed, 15 insertions, 30 deletions
diff --git a/channels.c b/channels.c
index c2706ace7..1c381e0e2 100644
--- a/channels.c
+++ b/channels.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: channels.c,v 1.377 2017/12/05 01:30:19 djm Exp $ */ 1/* $OpenBSD: channels.c,v 1.378 2018/01/23 05:27:21 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1582,13 +1582,8 @@ channel_post_x11_listener(struct ssh *ssh, Channel *c,
1582 SSH_CHANNEL_OPENING, newsock, newsock, -1, 1582 SSH_CHANNEL_OPENING, newsock, newsock, -1,
1583 c->local_window_max, c->local_maxpacket, 0, buf, 1); 1583 c->local_window_max, c->local_maxpacket, 0, buf, 1);
1584 open_preamble(ssh, __func__, nc, "x11"); 1584 open_preamble(ssh, __func__, nc, "x11");
1585 if ((r = sshpkt_put_cstring(ssh, remote_ipaddr)) != 0) { 1585 if ((r = sshpkt_put_cstring(ssh, remote_ipaddr)) != 0 ||
1586 fatal("%s: channel %i: reply %s", __func__, 1586 (r = sshpkt_put_u32(ssh, remote_port)) != 0) {
1587 c->self, ssh_err(r));
1588 }
1589 if ((datafellows & SSH_BUG_X11FWD) != 0)
1590 debug2("channel %d: ssh2 x11 bug compat mode", nc->self);
1591 else if ((r = sshpkt_put_u32(ssh, remote_port)) != 0) {
1592 fatal("%s: channel %i: reply %s", __func__, 1587 fatal("%s: channel %i: reply %s", __func__,
1593 c->self, ssh_err(r)); 1588 c->self, ssh_err(r));
1594 } 1589 }
@@ -1824,15 +1819,13 @@ channel_post_connecting(struct ssh *ssh, Channel *c,
1824 if ((r = sshpkt_start(ssh, 1819 if ((r = sshpkt_start(ssh,
1825 SSH2_MSG_CHANNEL_OPEN_FAILURE)) != 0 || 1820 SSH2_MSG_CHANNEL_OPEN_FAILURE)) != 0 ||
1826 (r = sshpkt_put_u32(ssh, c->remote_id)) != 0 || 1821 (r = sshpkt_put_u32(ssh, c->remote_id)) != 0 ||
1827 (r = sshpkt_put_u32(ssh, SSH2_OPEN_CONNECT_FAILED)) 1822 (r = sshpkt_put_u32(ssh,
1828 != 0) 1823 SSH2_OPEN_CONNECT_FAILED)) != 0 ||
1829 fatal("%s: channel %i: failure: %s", __func__, 1824 (r = sshpkt_put_cstring(ssh, strerror(err))) != 0 ||
1830 c->self, ssh_err(r)); 1825 (r = sshpkt_put_cstring(ssh, "")) != 0) {
1831 if ((datafellows & SSH_BUG_OPENFAILURE) == 0 &&
1832 ((r = sshpkt_put_cstring(ssh, strerror(err))) != 0 ||
1833 (r = sshpkt_put_cstring(ssh, "")) != 0))
1834 fatal("%s: channel %i: failure: %s", __func__, 1826 fatal("%s: channel %i: failure: %s", __func__,
1835 c->self, ssh_err(r)); 1827 c->self, ssh_err(r));
1828 }
1836 if ((r = sshpkt_send(ssh)) != 0) 1829 if ((r = sshpkt_send(ssh)) != 0)
1837 fatal("%s: channel %i: %s", __func__, c->self, 1830 fatal("%s: channel %i: %s", __func__, c->self,
1838 ssh_err(r)); 1831 ssh_err(r));
@@ -3110,13 +3103,11 @@ channel_input_open_failure(int type, u_int32_t seq, struct ssh *ssh)
3110 error("%s: reason: %s", __func__, ssh_err(r)); 3103 error("%s: reason: %s", __func__, ssh_err(r));
3111 packet_disconnect("Invalid open failure message"); 3104 packet_disconnect("Invalid open failure message");
3112 } 3105 }
3113 if ((datafellows & SSH_BUG_OPENFAILURE) == 0) { 3106 /* skip language */
3114 /* skip language */ 3107 if ((r = sshpkt_get_cstring(ssh, &msg, NULL)) != 0 ||
3115 if ((r = sshpkt_get_cstring(ssh, &msg, NULL)) != 0 || 3108 (r = sshpkt_get_string_direct(ssh, NULL, NULL)) != 0) {
3116 (r = sshpkt_get_string_direct(ssh, NULL, NULL)) != 0) { 3109 error("%s: message/lang: %s", __func__, ssh_err(r));
3117 error("%s: message/lang: %s", __func__, ssh_err(r)); 3110 packet_disconnect("Invalid open failure message");
3118 packet_disconnect("Invalid open failure message");
3119 }
3120 } 3111 }
3121 ssh_packet_check_eom(ssh); 3112 ssh_packet_check_eom(ssh);
3122 logit("channel %d: open failed: %s%s%s", c->self, 3113 logit("channel %d: open failed: %s%s%s", c->self,
@@ -3664,15 +3655,9 @@ static const char *
3664channel_rfwd_bind_host(const char *listen_host) 3655channel_rfwd_bind_host(const char *listen_host)
3665{ 3656{
3666 if (listen_host == NULL) { 3657 if (listen_host == NULL) {
3667 if (datafellows & SSH_BUG_RFWD_ADDR) 3658 return "localhost";
3668 return "127.0.0.1";
3669 else
3670 return "localhost";
3671 } else if (*listen_host == '\0' || strcmp(listen_host, "*") == 0) { 3659 } else if (*listen_host == '\0' || strcmp(listen_host, "*") == 0) {
3672 if (datafellows & SSH_BUG_RFWD_ADDR) 3660 return "";
3673 return "0.0.0.0";
3674 else
3675 return "";
3676 } else 3661 } else
3677 return listen_host; 3662 return listen_host;
3678} 3663}