1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-06-30 19:12:48 -05:00

Pass the calling Socket to plug_log.

This enables plug_log to run query methods on the socket in order to
find out useful information to log. I don't expect it's sensible to do
anything else with it.
This commit is contained in:
Simon Tatham
2024-06-26 08:29:39 +01:00
parent 23b15dbc77
commit c1d9da67a2
27 changed files with 94 additions and 80 deletions

View File

@ -4,7 +4,7 @@
#include "putty.h"
#include "network.h"
void backend_socket_log(Seat *seat, LogContext *logctx,
void backend_socket_log(Seat *seat, LogContext *logctx, Socket *sock,
PlugLogType type, SockAddr *addr, int port,
const char *error_msg, int error_code, Conf *conf,
bool session_started)

View File

@ -15,7 +15,7 @@ void psb_set_prefix(ProxyStderrBuf *psb, const char *prefix)
psb->prefix = prefix;
}
void log_proxy_stderr(Plug *plug, ProxyStderrBuf *psb,
void log_proxy_stderr(Plug *plug, Socket *sock, ProxyStderrBuf *psb,
const void *vdata, size_t len)
{
const char *data = (const char *)vdata;
@ -65,7 +65,7 @@ void log_proxy_stderr(Plug *plug, ProxyStderrBuf *psb,
endpos--;
char *msg = dupprintf(
"%s: %.*s", psb->prefix, (int)(endpos - pos), psb->buf + pos);
plug_log(plug, PLUGLOG_PROXY_MSG, NULL, 0, msg, 0);
plug_log(plug, sock, PLUGLOG_PROXY_MSG, NULL, 0, msg, 0);
sfree(msg);
pos = nlpos - psb->buf + 1;
@ -81,7 +81,7 @@ void log_proxy_stderr(Plug *plug, ProxyStderrBuf *psb,
char *msg = dupprintf(
"%s (partial line): %.*s", psb->prefix, (int)psb->size,
psb->buf);
plug_log(plug, PLUGLOG_PROXY_MSG, NULL, 0, msg, 0);
plug_log(plug, sock, PLUGLOG_PROXY_MSG, NULL, 0, msg, 0);
sfree(msg);
pos = psb->size = 0;