1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-02 03:52:49 -05:00

Put proper logging into Pageant.

Now it actually logs all its requests and responses, the fingerprints
of keys mentioned in all messages, and so on.

I've also added the -v option, which causes Pageant in any mode to
direct that logging information to standard error. In --debug mode,
however, the logging output goes to standard output instead (because
when debugging, that information changes from a side effect to the
thing you actually wanted in the first place :-).

An internal tweak: the logging functions now take a va_list rather
than an actual variadic argument list, so that I can pass it through
several functions.
This commit is contained in:
Simon Tatham
2015-05-06 19:32:26 +01:00
parent 340143cea7
commit bc4066e454
4 changed files with 296 additions and 67 deletions

View File

@ -2,6 +2,8 @@
* pageant.h: header for pageant.c.
*/
#include <stdarg.h>
/*
* FIXME: it would be nice not to have this arbitrary limit. It's
* currently needed because the Windows Pageant IPC system needs an
@ -10,6 +12,8 @@
*/
#define AGENT_MAX_MSGLEN 8192
typedef void (*pageant_logfn_t)(void *logctx, const char *fmt, va_list ap);
/*
* Initial setup.
*/
@ -24,7 +28,8 @@ 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 *pageant_handle_msg(const void *msg, int msglen, int *outlen,
void *logctx, pageant_logfn_t logfn);
/*
* Construct a failure response. Useful for agent front ends which
@ -74,7 +79,7 @@ void keylist_update(void);
* socket pointer.
*/
struct pageant_listen_state;
struct pageant_listen_state *pageant_listener_new
(void *logctx, void (*logfn)(void *logctx, const char *fmt, ...));
struct pageant_listen_state *pageant_listener_new(void *logctx,
pageant_logfn_t logfn);
void pageant_listener_got_socket(struct pageant_listen_state *pl, Socket sock);
void pageant_listener_free(struct pageant_listen_state *pl);