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

All of the initial CHANNEL_REQUESTs are conditional on (ssh->mainchan &&

!ssh->ncmode), so bundle them up in a big block conditional on this rather
than checking it five times.

[originally from svn r9647]
This commit is contained in:
Ben Harris 2012-09-01 12:03:12 +00:00
parent 54da9ee07a
commit 98e562b7f6

46
ssh.c
View File

@ -9226,41 +9226,30 @@ static void do_ssh2_authconn(Ssh ssh, unsigned char *in, int inlen,
*/
ssh_setup_portfwd(ssh, ssh->conf);
if (ssh->mainchan && !ssh->ncmode) {
/*
* Send the CHANNEL_REQUESTS for the main channel. Each one is
* handled by its own little asynchronous co-routine.
* Send the CHANNEL_REQUESTS for the main session channel.
* Each one is handled by its own little asynchronous
* co-routine.
*/
/*
* Potentially enable X11 forwarding.
*/
/*
* Potentially enable X11 forwarding.
*/
if (ssh->mainchan && !ssh->ncmode && conf_get_int(ssh->conf, CONF_x11_forward) &&
(ssh->x11disp = x11_setup_display(conf_get_str(ssh->conf, CONF_x11_display),
conf_get_int(ssh->conf, CONF_x11_auth), ssh->conf)))
/* Potentially enable X11 forwarding. */
if (conf_get_int(ssh->conf, CONF_x11_forward) &&
(ssh->x11disp =
x11_setup_display(conf_get_str(ssh->conf, CONF_x11_display),
conf_get_int(ssh->conf, CONF_x11_auth),
ssh->conf)))
ssh2_setup_x11(ssh->mainchan, NULL, NULL);
/*
* Potentially enable agent forwarding.
*/
if (ssh->mainchan && !ssh->ncmode && conf_get_int(ssh->conf, CONF_agentfwd) && agent_exists())
/* Potentially enable agent forwarding. */
if (conf_get_int(ssh->conf, CONF_agentfwd) && agent_exists())
ssh2_setup_agent(ssh->mainchan, NULL, NULL);
/*
* Now allocate a pty for the session.
*/
if (ssh->mainchan && !ssh->ncmode && !conf_get_int(ssh->conf, CONF_nopty)) {
/* Now allocate a pty for the session. */
if (!conf_get_int(ssh->conf, CONF_nopty))
ssh2_setup_pty(ssh->mainchan, NULL, NULL);
} else {
ssh->editing = ssh->echoing = 1;
}
/*
* Send environment variables.
*/
if (ssh->mainchan && !ssh->ncmode)
/* Send environment variables. */
ssh2_setup_env(ssh->mainchan, NULL, NULL);
/*
@ -9268,7 +9257,7 @@ static void do_ssh2_authconn(Ssh ssh, unsigned char *in, int inlen,
* this twice if the config data has provided a second choice
* of command.
*/
if (ssh->mainchan && !ssh->ncmode) while (1) {
while (1) {
int subsys;
char *cmd;
@ -9321,6 +9310,9 @@ static void do_ssh2_authconn(Ssh ssh, unsigned char *in, int inlen,
}
break;
}
} else {
ssh->editing = ssh->echoing = TRUE;
}
ssh->state = SSH_STATE_SESSION;
if (ssh->size_needed)