View | Details | Raw Unified | Return to bug 1943
Collapse All | Expand All

(-)ssh.c (-7 / +21 lines)
Lines 1030-1040 client_setup_stdio_fwd(const char *host_ Link Here
1030
}
1030
}
1031
1031
1032
static void
1032
static void
1033
ssh_init_forwarding(void)
1033
ssh_init_stdio_forwarding(void)
1034
{
1034
{
1035
	int success = 0;
1036
	int i;
1037
1038
	if (stdio_forward_host != NULL) {
1035
	if (stdio_forward_host != NULL) {
1039
		if (!compat20) {
1036
		if (!compat20) {
1040
			fatal("stdio forwarding require Protocol 2");
1037
			fatal("stdio forwarding require Protocol 2");
Lines 1043-1048 ssh_init_forwarding(void) Link Here
1043
		    stdio_forward_port))
1040
		    stdio_forward_port))
1044
			fatal("Failed to connect in stdio forward mode.");
1041
			fatal("Failed to connect in stdio forward mode.");
1045
	}
1042
	}
1043
}
1044
1045
static void
1046
ssh_init_forwarding(void)
1047
{
1048
	int success = 0;
1049
	int i;
1046
1050
1047
	/* Initiate local TCP/IP port forwardings. */
1051
	/* Initiate local TCP/IP port forwardings. */
1048
	for (i = 0; i < options.num_local_forwards; i++) {
1052
	for (i = 0; i < options.num_local_forwards; i++) {
Lines 1234-1239 ssh_session(void) Link Here
1234
	}
1238
	}
1235
1239
1236
	/* Initiate port forwardings. */
1240
	/* Initiate port forwardings. */
1241
	ssh_init_stdio_forwarding();
1237
	ssh_init_forwarding();
1242
	ssh_init_forwarding();
1238
1243
1239
	/* Execute a local command */
1244
	/* Execute a local command */
Lines 1372-1386 ssh_session2(void) Link Here
1372
	int id = -1;
1377
	int id = -1;
1373
1378
1374
	/* XXX should be pre-session */
1379
	/* XXX should be pre-session */
1380
	if (!options.control_persist)
1381
		ssh_init_stdio_forwarding();
1375
	ssh_init_forwarding();
1382
	ssh_init_forwarding();
1376
1383
1377
	/* Start listening for multiplex clients */
1384
	/* Start listening for multiplex clients */
1378
	muxserver_listen();
1385
	muxserver_listen();
1379
1386
1380
 	/*
1387
 	/*
1381
	 * If we are in control persist mode, then prepare to background
1388
	 * If we are in control persist mode and have a working mux listen
1382
	 * ourselves and have a foreground client attach as a control
1389
	 * socket, then prepare to background ourselves and have a foreground
1383
	 * slave. NB. we must save copies of the flags that we override for
1390
	 * client attach as a control slave.
1391
	 * NB. we must save copies of the flags that we override for
1384
	 * the backgrounding, since we defer attachment of the slave until
1392
	 * the backgrounding, since we defer attachment of the slave until
1385
	 * after the connection is fully established (in particular,
1393
	 * after the connection is fully established (in particular,
1386
	 * async rfwd replies have been received for ExitOnForwardFailure).
1394
	 * async rfwd replies have been received for ExitOnForwardFailure).
Lines 1397-1402 ssh_session2(void) Link Here
1397
			need_controlpersist_detach = 1;
1405
			need_controlpersist_detach = 1;
1398
		fork_after_authentication_flag = 1;
1406
		fork_after_authentication_flag = 1;
1399
 	}
1407
 	}
1408
	/*
1409
	 * ControlPersist mux listen socket setup failed, attempt the
1410
	 * stdio forward setup that we skipped earlier.
1411
	 */
1412
	if (options.control_persist && muxserver_sock == -1)
1413
		ssh_init_stdio_forwarding();
1400
1414
1401
	if (!no_shell_flag || (datafellows & SSH_BUG_DUMMYCHAN))
1415
	if (!no_shell_flag || (datafellows & SSH_BUG_DUMMYCHAN))
1402
		id = ssh_session2_open();
1416
		id = ssh_session2_open();

Return to bug 1943