aboutsummaryrefslogtreecommitdiff
path: root/tools/plink
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-07-19 15:12:53 +0200
committermarha <marha@users.sourceforge.net>2014-07-19 15:12:53 +0200
commit61c36feba19d918885022042ea62d068a698c83d (patch)
treefd351953eb2193fe548e7d0e2dca06b34b7c4f4d /tools/plink
parent3865d60ef607cbb00c819e905e40d3628b8eca29 (diff)
parentd0c30e7945e76ac119f6d867e27137c8a76f7e15 (diff)
downloadvcxsrv-61c36feba19d918885022042ea62d068a698c83d.tar.gz
vcxsrv-61c36feba19d918885022042ea62d068a698c83d.tar.bz2
vcxsrv-61c36feba19d918885022042ea62d068a698c83d.zip
Merge remote-tracking branch 'origin/released'
Conflicts: mesalib/src/glsl/ir.cpp xorg-server/config/config.c xorg-server/include/callback.h xorg-server/include/colormap.h xorg-server/include/cursor.h xorg-server/include/dix.h xorg-server/include/dixfont.h xorg-server/include/dixgrabs.h xorg-server/include/gc.h xorg-server/include/gcstruct.h xorg-server/include/input.h xorg-server/include/os.h xorg-server/include/pixmap.h xorg-server/include/property.h xorg-server/include/resource.h xorg-server/include/scrnintstr.h xorg-server/include/window.h xorg-server/include/xkbsrv.h xorg-server/mi/mi.h
Diffstat (limited to 'tools/plink')
-rw-r--r--tools/plink/putty.h1
-rw-r--r--tools/plink/settings.c2
-rwxr-xr-xtools/plink/ssh.c51
-rw-r--r--tools/plink/winhelp.h1
4 files changed, 50 insertions, 5 deletions
diff --git a/tools/plink/putty.h b/tools/plink/putty.h
index f97c723b0..a6578ae0c 100644
--- a/tools/plink/putty.h
+++ b/tools/plink/putty.h
@@ -838,6 +838,7 @@ void cleanup_exit(int);
X(INT, NONE, sshbug_maxpkt2) \
X(INT, NONE, sshbug_ignore2) \
X(INT, NONE, sshbug_winadj) \
+ X(INT, NONE, sshbug_chanreq) \
/* \
* ssh_simple means that we promise never to open any channel \
* other than the main one, which means it can safely use a very \
diff --git a/tools/plink/settings.c b/tools/plink/settings.c
index a82a388bf..e949df95f 100644
--- a/tools/plink/settings.c
+++ b/tools/plink/settings.c
@@ -626,6 +626,7 @@ void save_open_settings(void *sesskey, Conf *conf)
write_setting_i(sesskey, "BugRekey2", 2-conf_get_int(conf, CONF_sshbug_rekey2));
write_setting_i(sesskey, "BugMaxPkt2", 2-conf_get_int(conf, CONF_sshbug_maxpkt2));
write_setting_i(sesskey, "BugWinadj", 2-conf_get_int(conf, CONF_sshbug_winadj));
+ write_setting_i(sesskey, "BugChanReq", 2-conf_get_int(conf, CONF_sshbug_chanreq));
write_setting_i(sesskey, "StampUtmp", conf_get_int(conf, CONF_stamp_utmp));
write_setting_i(sesskey, "LoginShell", conf_get_int(conf, CONF_login_shell));
write_setting_i(sesskey, "ScrollbarOnLeft", conf_get_int(conf, CONF_scrollbar_on_left));
@@ -970,6 +971,7 @@ void load_open_settings(void *sesskey, Conf *conf)
i = gppi_raw(sesskey, "BugRekey2", 0); conf_set_int(conf, CONF_sshbug_rekey2, 2-i);
i = gppi_raw(sesskey, "BugMaxPkt2", 0); conf_set_int(conf, CONF_sshbug_maxpkt2, 2-i);
i = gppi_raw(sesskey, "BugWinadj", 0); conf_set_int(conf, CONF_sshbug_winadj, 2-i);
+ i = gppi_raw(sesskey, "BugChanReq", 0); conf_set_int(conf, CONF_sshbug_chanreq, 2-i);
conf_set_int(conf, CONF_ssh_simple, FALSE);
gppi(sesskey, "StampUtmp", 1, conf, CONF_stamp_utmp);
gppi(sesskey, "LoginShell", 1, conf, CONF_login_shell);
diff --git a/tools/plink/ssh.c b/tools/plink/ssh.c
index cef4455e8..c9adfc8b0 100755
--- a/tools/plink/ssh.c
+++ b/tools/plink/ssh.c
@@ -75,6 +75,7 @@ static const char *const ssh2_disconnect_reasons[] = {
#define BUG_SSH2_MAXPKT 256
#define BUG_CHOKES_ON_SSH2_IGNORE 512
#define BUG_CHOKES_ON_WINADJ 1024
+#define BUG_SENDS_LATE_REQUEST_REPLY 2048
/*
* Codes for terminal modes.
@@ -2813,6 +2814,19 @@ static void ssh_detect_bugs(Ssh ssh, char *vstring)
ssh->remote_bugs |= BUG_CHOKES_ON_WINADJ;
logevent("We believe remote version has winadj bug");
}
+
+ if (conf_get_int(ssh->conf, CONF_sshbug_chanreq) == FORCE_ON ||
+ (conf_get_int(ssh->conf, CONF_sshbug_chanreq) == AUTO &&
+ (wc_match("OpenSSH_[2-5].*", imp) ||
+ wc_match("OpenSSH_6.[0-6]*", imp)))) {
+ /*
+ * These versions have the SSH-2 channel request bug. 6.7 and
+ * above do not:
+ * https://bugzilla.mindrot.org/show_bug.cgi?id=1818
+ */
+ ssh->remote_bugs |= BUG_SENDS_LATE_REQUEST_REPLY;
+ logevent("We believe remote version has SSH-2 channel request bug");
+ }
}
/*
@@ -7120,10 +7134,11 @@ static void ssh2_queue_chanreq_handler(struct ssh_channel *c,
* request-specific data added and be sent. Note that if a handler is
* provided, it's essential that the request actually be sent.
*
- * The handler will usually be passed the response packet in pktin.
- * If pktin is NULL, this means that no reply will ever be forthcoming
- * (e.g. because the entire connection is being destroyed) and the
- * handler should free any storage it's holding.
+ * The handler will usually be passed the response packet in pktin. If
+ * pktin is NULL, this means that no reply will ever be forthcoming
+ * (e.g. because the entire connection is being destroyed, or because
+ * the server initiated channel closure before we saw the response)
+ * and the handler should free any storage it's holding.
*/
static struct Packet *ssh2_chanreq_init(struct ssh_channel *c, char *type,
cchandler_fn_t handler, void *ctx)
@@ -7613,6 +7628,21 @@ static void ssh2_msg_channel_close(Ssh ssh, struct Packet *pktin)
*/
ssh2_channel_got_eof(c);
+ if (!(ssh->remote_bugs & BUG_SENDS_LATE_REQUEST_REPLY)) {
+ /*
+ * It also means we stop expecting to see replies to any
+ * outstanding channel requests, so clean those up too.
+ * (ssh_chanreq_init will enforce by assertion that we don't
+ * subsequently put anything back on this list.)
+ */
+ while (c->v.v2.chanreq_head) {
+ struct outstanding_channel_request *ocr = c->v.v2.chanreq_head;
+ ocr->handler(c, NULL, ocr->ctx);
+ c->v.v2.chanreq_head = ocr->next;
+ sfree(ocr);
+ }
+ }
+
/*
* And we also send an outgoing EOF, if we haven't already, on the
* assumption that CLOSE is a pretty forceful announcement that
@@ -7788,6 +7818,16 @@ static void ssh2_msg_channel_request(Ssh ssh, struct Packet *pktin)
ssh_pkt_getstring(pktin, &type, &typelen);
want_reply = ssh2_pkt_getbool(pktin);
+ if (c->closes & CLOSES_SENT_CLOSE) {
+ /*
+ * We don't reply to channel requests after we've sent
+ * CHANNEL_CLOSE for the channel, because our reply might
+ * cross in the network with the other side's CHANNEL_CLOSE
+ * and arrive after they have wound the channel up completely.
+ */
+ want_reply = FALSE;
+ }
+
/*
* Having got the channel number, we now look at
* the request type string to see if it's something
@@ -8417,7 +8457,8 @@ static void ssh2_msg_authconn(Ssh ssh, struct Packet *pktin)
static void ssh2_response_authconn(struct ssh_channel *c, struct Packet *pktin,
void *ctx)
{
- do_ssh2_authconn(c->ssh, NULL, 0, pktin);
+ if (pktin)
+ do_ssh2_authconn(c->ssh, NULL, 0, pktin);
}
static void do_ssh2_authconn(Ssh ssh, unsigned char *in, int inlen,
diff --git a/tools/plink/winhelp.h b/tools/plink/winhelp.h
index 14b588600..dabd8b825 100644
--- a/tools/plink/winhelp.h
+++ b/tools/plink/winhelp.h
@@ -146,6 +146,7 @@
#define WINHELP_CTX_ssh_bugs_rekey2 "ssh.bugs.rekey2:config-ssh-bug-rekey"
#define WINHELP_CTX_ssh_bugs_maxpkt2 "ssh.bugs.maxpkt2:config-ssh-bug-maxpkt2"
#define WINHELP_CTX_ssh_bugs_winadj "ssh.bugs.winadj:config-ssh-bug-winadj"
+#define WINHELP_CTX_ssh_bugs_chanreq "ssh.bugs.winadj:config-ssh-bug-chanreq"
#define WINHELP_CTX_serial_line "serial.line:config-serial-line"
#define WINHELP_CTX_serial_speed "serial.speed:config-serial-speed"
#define WINHELP_CTX_serial_databits "serial.databits:config-serial-databits"