1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-01 19:42:48 -05:00

Build outgoing SSH agent requests in a strbuf.

This simplifies the client code both in ssh.c and in the client side
of Pageant.

I've cheated a tiny bit by preparing agent requests in a strbuf that
has space reserved at the front for the packet frame, which makes life
easier for the code that sends them off.
This commit is contained in:
Simon Tatham
2018-05-24 13:18:13 +01:00
parent 8ce0a67028
commit 0c44fa85df
8 changed files with 155 additions and 184 deletions

View File

@ -126,7 +126,7 @@ static void agent_select_result(int fd, int event)
}
agent_pending_query *agent_query(
void *in, int inlen, void **out, int *outlen,
strbuf *query, void **out, int *outlen,
void (*callback)(void *, void *, int), void *callback_ctx)
{
char *name;
@ -154,8 +154,11 @@ agent_pending_query *agent_query(
goto failure;
}
for (done = 0; done < inlen ;) {
int ret = write(sock, (char *)in + done, inlen - done);
strbuf_finalise_agent_query(query);
for (done = 0; done < query->len ;) {
int ret = write(sock, query->s + done,
query->len - done);
if (ret <= 0) {
close(sock);
goto failure;