1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-27 02:02:26 +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); ssh_setup_portfwd(ssh, ssh->conf);
if (ssh->mainchan && !ssh->ncmode) {
/* /*
* Send the CHANNEL_REQUESTS for the main channel. Each one is * Send the CHANNEL_REQUESTS for the main session channel.
* handled by its own little asynchronous co-routine. * Each one is handled by its own little asynchronous
* co-routine.
*/ */
/* /* Potentially enable X11 forwarding. */
* 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),
* Potentially enable X11 forwarding. conf_get_int(ssh->conf, CONF_x11_auth),
*/ ssh->conf)))
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)))
ssh2_setup_x11(ssh->mainchan, NULL, NULL); ssh2_setup_x11(ssh->mainchan, NULL, NULL);
/* /* Potentially enable agent forwarding. */
* Potentially enable agent forwarding. if (conf_get_int(ssh->conf, CONF_agentfwd) && agent_exists())
*/
if (ssh->mainchan && !ssh->ncmode && conf_get_int(ssh->conf, CONF_agentfwd) && agent_exists())
ssh2_setup_agent(ssh->mainchan, NULL, NULL); ssh2_setup_agent(ssh->mainchan, NULL, NULL);
/* /* Now allocate a pty for the session. */
* Now allocate a pty for the session. if (!conf_get_int(ssh->conf, CONF_nopty))
*/
if (ssh->mainchan && !ssh->ncmode && !conf_get_int(ssh->conf, CONF_nopty)) {
ssh2_setup_pty(ssh->mainchan, NULL, NULL); ssh2_setup_pty(ssh->mainchan, NULL, NULL);
} else {
ssh->editing = ssh->echoing = 1;
}
/* /* Send environment variables. */
* Send environment variables.
*/
if (ssh->mainchan && !ssh->ncmode)
ssh2_setup_env(ssh->mainchan, NULL, NULL); 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 * this twice if the config data has provided a second choice
* of command. * of command.
*/ */
if (ssh->mainchan && !ssh->ncmode) while (1) { while (1) {
int subsys; int subsys;
char *cmd; char *cmd;
@ -9321,6 +9310,9 @@ static void do_ssh2_authconn(Ssh ssh, unsigned char *in, int inlen,
} }
break; break;
} }
} else {
ssh->editing = ssh->echoing = TRUE;
}
ssh->state = SSH_STATE_SESSION; ssh->state = SSH_STATE_SESSION;
if (ssh->size_needed) if (ssh->size_needed)