mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-04-10 23:58:06 -05:00
Windows Plink: fix segfault at startup when connection-sharing.
The message "Reusing a shared connection to this server" is sent to the seat's output method during the call to ssh_init. In Windows Plink, that output method wants to talk to the BinarySink stderr_bs (or stdout_bs, but for this particular message, stderr). So we have to have already set up stderr_bs by the time the backend init function is called.
This commit is contained in:
parent
00112549bf
commit
8b87d80a84
@ -448,29 +448,6 @@ int main(int argc, char **argv)
|
||||
lp_eventlog(default_logpolicy, "Running with restricted process ACL");
|
||||
}
|
||||
|
||||
/*
|
||||
* Start up the connection.
|
||||
*/
|
||||
netevent = CreateEvent(NULL, false, false, NULL);
|
||||
{
|
||||
const char *error;
|
||||
char *realhost;
|
||||
/* nodelay is only useful if stdin is a character device (console) */
|
||||
bool nodelay = conf_get_bool(conf, CONF_tcp_nodelay) &&
|
||||
(GetFileType(GetStdHandle(STD_INPUT_HANDLE)) == FILE_TYPE_CHAR);
|
||||
|
||||
error = backend_init(vt, plink_seat, &backend, logctx, conf,
|
||||
conf_get_str(conf, CONF_host),
|
||||
conf_get_int(conf, CONF_port),
|
||||
&realhost, nodelay,
|
||||
conf_get_bool(conf, CONF_tcp_keepalives));
|
||||
if (error) {
|
||||
fprintf(stderr, "Unable to open connection:\n%s", error);
|
||||
return 1;
|
||||
}
|
||||
sfree(realhost);
|
||||
}
|
||||
|
||||
inhandle = GetStdHandle(STD_INPUT_HANDLE);
|
||||
outhandle = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
errhandle = GetStdHandle(STD_ERROR_HANDLE);
|
||||
@ -522,6 +499,29 @@ int main(int argc, char **argv)
|
||||
stderr_bs = BinarySink_UPCAST(stderr_scc);
|
||||
}
|
||||
|
||||
/*
|
||||
* Start up the connection.
|
||||
*/
|
||||
netevent = CreateEvent(NULL, false, false, NULL);
|
||||
{
|
||||
const char *error;
|
||||
char *realhost;
|
||||
/* nodelay is only useful if stdin is a character device (console) */
|
||||
bool nodelay = conf_get_bool(conf, CONF_tcp_nodelay) &&
|
||||
(GetFileType(GetStdHandle(STD_INPUT_HANDLE)) == FILE_TYPE_CHAR);
|
||||
|
||||
error = backend_init(vt, plink_seat, &backend, logctx, conf,
|
||||
conf_get_str(conf, CONF_host),
|
||||
conf_get_int(conf, CONF_port),
|
||||
&realhost, nodelay,
|
||||
conf_get_bool(conf, CONF_tcp_keepalives));
|
||||
if (error) {
|
||||
fprintf(stderr, "Unable to open connection:\n%s", error);
|
||||
return 1;
|
||||
}
|
||||
sfree(realhost);
|
||||
}
|
||||
|
||||
main_thread_id = GetCurrentThreadId();
|
||||
|
||||
sending = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user