1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

Fix assertion failure if server won't start a shell.

In the recent refactoring, when I rewrote the loop in the SSH-2
connection layer startup which tries the primary and then the fallback
command, I failed to reproduce a subtlety of the previous code, namely
that if CONF_remote_cmd2 holds the empty string, we don't even look
for CONF_ssh_subsys2. This is because no application other than pscp
will have set the latter, and looking it up when it's absent triggers
an assertion failure in conf.c.
This commit is contained in:
Simon Tatham 2018-10-12 23:27:53 +01:00
parent b4c8fd9d86
commit dff3cd562d

View File

@ -1288,13 +1288,19 @@ static void ssh2_connection_process_queue(PacketProtocolLayer *ppl)
char *cmd;
if (s->session_attempt == 0) {
subsys = conf_get_int(s->conf, CONF_ssh_subsys);
cmd = conf_get_str(s->conf, CONF_remote_cmd);
subsys = conf_get_int(s->conf, CONF_ssh_subsys);
} else {
subsys = conf_get_int(s->conf, CONF_ssh_subsys2);
cmd = conf_get_str(s->conf, CONF_remote_cmd2);
if (!*cmd)
if (!*cmd) {
/* If there's no remote_cmd2 configured, then we
* have no fallback command, and we should quit
* this loop before even trying to look up
* CONF_ssh_subsys2, which is one of the few conf
* keys that is not guaranteed to be populated. */
break;
}
subsys = conf_get_int(s->conf, CONF_ssh_subsys2);
ppl_logevent(("Primary command failed; attempting fallback"));
}