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

Windows: use named-pipe IPC for stream agent forwarding.

Now that Pageant runs a named-pipe server as well as a WM_COPYDATA
server, we prefer the former (if available) for agent forwarding, for
the same reasons as on Unix: it lets us establish a simple raw-data
streaming connection instead of agentf.c's complicated message
boundary detection and buffer management, and if agent connections
ever become stateful, this technique will cope.

On Windows, another advantage of this change is that forwarded agent
requests can now be asynchronous: if the agent takes time to respond
to a request for any reason, then the rest of PuTTY's GUI and SSH
connection are not blocked, and you can carry on working while the
agent is thinking about the request.

(I didn't list that as a benefit of doing the same thing for Unix in
commit ae1148267, because on Unix, agent_query() could _already_ run
asynchronously. It's only on Windows that that's new.)
This commit is contained in:
Simon Tatham 2020-01-01 16:47:11 +00:00
parent f93b260694
commit cf29125fb4

View File

@ -150,7 +150,30 @@ char *agent_named_pipe_name(void)
return pipename;
}
#endif /* NO_SECURITY */
struct agent_connect_ctx {
char *pipename;
};
Socket *agent_connect(void *vctx, Plug *plug)
{
agent_connect_ctx *ctx = (agent_connect_ctx *)vctx;
return new_named_pipe_client(ctx->pipename, plug);
}
agent_connect_ctx *agent_get_connect_ctx(void)
{
agent_connect_ctx *ctx = snew(agent_connect_ctx);
ctx->pipename = agent_named_pipe_name();
return ctx;
}
void agent_free_connect_ctx(agent_connect_ctx *ctx)
{
sfree(ctx->pipename);
sfree(ctx);
}
#else /* NO_SECURITY */
Socket *agent_connect(void *vctx, Plug *plug)
{
@ -165,3 +188,5 @@ agent_connect_ctx *agent_get_connect_ctx(void)
void agent_free_connect_ctx(agent_connect_ctx *ctx)
{
}
#endif /* NO_SECURITY */