mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-02 03:52:49 -05:00
Build SSH agent reply messages in a BinarySink.
This gets rid of yet another huge pile of beating around the bush with length-counting. Also, this time, the BinarySink in question is a little more interesting than just being a strbuf every time: on Windows, where the shared-memory Pageant IPC system imposes a hard limit on the size of message we can return, I've written a custom BinarySink implementation that collects up to that much data and then gives up and sets an overflow flag rather than continue to allocate memory. So the main Pageant code no longer has to worry about checking AGENT_MAX_MSGLEN all the time - and better still, the Unix version of Pageant is no longer _limited_ by AGENT_MAX_MSGLEN in its outgoing messages, i.e. it could store a really extra large number of keys if it needed to. That limitation is now a local feature of Windows Pageant rather than intrinsic to the whole code base. (AGENT_MAX_MSGLEN is still used to check incoming agent messages for sanity, however. Mostly that's because I feel I ought to check them against _some_ limit, and this one seems sensible enough. Incoming agent messages are more bounded anyway - they generally don't hold more than _one_ private key.)
This commit is contained in:
15
pageant.h
15
pageant.h
@ -28,21 +28,26 @@ void pageant_init(void);
|
||||
* Returns a fully formatted message as output, *with* its initial
|
||||
* length field, and sets *outlen to the full size of that message.
|
||||
*/
|
||||
void *pageant_handle_msg(const void *msg, int msglen, int *outlen,
|
||||
void *logctx, pageant_logfn_t logfn);
|
||||
void pageant_handle_msg(BinarySink *bs,
|
||||
const void *msg, int msglen,
|
||||
void *logctx, pageant_logfn_t logfn);
|
||||
|
||||
/*
|
||||
* Construct a failure response. Useful for agent front ends which
|
||||
* suffer a problem before they even get to pageant_handle_msg.
|
||||
*
|
||||
* 'log_reason' is only used if logfn is not NULL.
|
||||
*/
|
||||
void *pageant_failure_msg(int *outlen);
|
||||
void pageant_failure_msg(BinarySink *bs,
|
||||
const char *log_reason,
|
||||
void *logctx, pageant_logfn_t logfn);
|
||||
|
||||
/*
|
||||
* Construct a list of public keys, just as the two LIST_IDENTITIES
|
||||
* requests would have returned them.
|
||||
*/
|
||||
void *pageant_make_keylist1(int *length);
|
||||
void *pageant_make_keylist2(int *length);
|
||||
void pageant_make_keylist1(BinarySink *);
|
||||
void pageant_make_keylist2(BinarySink *);
|
||||
|
||||
/*
|
||||
* Accessor functions for Pageant's internal key lists. Fetch the nth
|
||||
|
Reference in New Issue
Block a user