mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-01 11:32: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:
@ -209,7 +209,8 @@ static void local_proxy_opener_coroutine(void *vctx)
|
||||
put_datapl(logmsg, PTRLEN_LITERAL("Starting local proxy command: "));
|
||||
put_c_string_literal(logmsg, ptrlen_from_asciz(censored_cmd));
|
||||
|
||||
plug_log(lp->plug, PLUGLOG_PROXY_MSG, NULL, 0, logmsg->s, 0);
|
||||
plug_log(lp->plug, lp->socket, PLUGLOG_PROXY_MSG, NULL, 0,
|
||||
logmsg->s, 0);
|
||||
strbuf_free(logmsg);
|
||||
sfree(censored_cmd);
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ static void proxy_activate(ProxySocket *ps)
|
||||
|
||||
proxy_negotiator_cleanup(ps);
|
||||
|
||||
plug_log(ps->plug, PLUGLOG_CONNECT_SUCCESS, NULL, 0, NULL, 0);
|
||||
plug_log(ps->plug, &ps->sock, PLUGLOG_CONNECT_SUCCESS, NULL, 0, NULL, 0);
|
||||
|
||||
/* we want to ignore new receive events until we have sent
|
||||
* all of our buffered receive data.
|
||||
@ -189,12 +189,13 @@ static const char *sk_proxy_socket_error (Socket *s)
|
||||
|
||||
/* basic proxy plug functions */
|
||||
|
||||
static void plug_proxy_log(Plug *plug, PlugLogType type, SockAddr *addr,
|
||||
int port, const char *error_msg, int error_code)
|
||||
static void plug_proxy_log(Plug *plug, Socket *s, PlugLogType type,
|
||||
SockAddr *addr, int port,
|
||||
const char *error_msg, int error_code)
|
||||
{
|
||||
ProxySocket *ps = container_of(plug, ProxySocket, plugimpl);
|
||||
|
||||
plug_log(ps->plug, type, addr, port, error_msg, error_code);
|
||||
plug_log(ps->plug, &ps->sock, type, addr, port, error_msg, error_code);
|
||||
}
|
||||
|
||||
static void plug_proxy_closing(Plug *p, PlugCloseType type,
|
||||
@ -597,7 +598,7 @@ Socket *new_connection(SockAddr *addr, const char *hostname,
|
||||
conf_get_str(conf, CONF_proxy_host),
|
||||
conf_get_int(conf, CONF_proxy_port),
|
||||
hostname, port);
|
||||
plug_log(plug, PLUGLOG_PROXY_MSG, NULL, 0, logmsg, 0);
|
||||
plug_log(plug, &ps->sock, PLUGLOG_PROXY_MSG, NULL, 0, logmsg, 0);
|
||||
sfree(logmsg);
|
||||
}
|
||||
|
||||
@ -605,7 +606,7 @@ Socket *new_connection(SockAddr *addr, const char *hostname,
|
||||
char *logmsg = dns_log_msg(conf_get_str(conf, CONF_proxy_host),
|
||||
conf_get_int(conf, CONF_addressfamily),
|
||||
"proxy");
|
||||
plug_log(plug, PLUGLOG_PROXY_MSG, NULL, 0, logmsg, 0);
|
||||
plug_log(plug, &ps->sock, PLUGLOG_PROXY_MSG, NULL, 0, logmsg, 0);
|
||||
sfree(logmsg);
|
||||
}
|
||||
|
||||
@ -626,7 +627,7 @@ Socket *new_connection(SockAddr *addr, const char *hostname,
|
||||
logmsg = dupprintf("Connecting to %s proxy at %s port %d",
|
||||
vt->type, addrbuf,
|
||||
conf_get_int(conf, CONF_proxy_port));
|
||||
plug_log(plug, PLUGLOG_PROXY_MSG, NULL, 0, logmsg, 0);
|
||||
plug_log(plug, &ps->sock, PLUGLOG_PROXY_MSG, NULL, 0, logmsg, 0);
|
||||
sfree(logmsg);
|
||||
}
|
||||
|
||||
|
@ -142,8 +142,8 @@ static const SocketVtable SshProxy_sock_vt = {
|
||||
static void sshproxy_eventlog(LogPolicy *lp, const char *event)
|
||||
{
|
||||
SshProxy *sp = container_of(lp, SshProxy, logpolicy);
|
||||
log_proxy_stderr(sp->plug, &sp->psb, event, strlen(event));
|
||||
log_proxy_stderr(sp->plug, &sp->psb, "\n", 1);
|
||||
log_proxy_stderr(sp->plug, &sp->sock, &sp->psb, event, strlen(event));
|
||||
log_proxy_stderr(sp->plug, &sp->sock, &sp->psb, "\n", 1);
|
||||
}
|
||||
|
||||
static int sshproxy_askappend(LogPolicy *lp, Filename *filename,
|
||||
@ -248,7 +248,8 @@ static void sshproxy_notify_session_started(Seat *seat)
|
||||
interactor_return_seat(sp->clientitr);
|
||||
sp->conn_established = true;
|
||||
|
||||
plug_log(sp->plug, PLUGLOG_CONNECT_SUCCESS, sp->addr, sp->port, NULL, 0);
|
||||
plug_log(sp->plug, &sp->sock, PLUGLOG_CONNECT_SUCCESS, sp->addr, sp->port,
|
||||
NULL, 0);
|
||||
}
|
||||
|
||||
static size_t sshproxy_output(Seat *seat, SeatOutputType type,
|
||||
@ -261,7 +262,7 @@ static size_t sshproxy_output(Seat *seat, SeatOutputType type,
|
||||
try_send_ssh_to_socket(sp);
|
||||
break;
|
||||
case SEAT_OUTPUT_STDERR:
|
||||
log_proxy_stderr(sp->plug, &sp->psb, data, len);
|
||||
log_proxy_stderr(sp->plug, &sp->sock, &sp->psb, data, len);
|
||||
break;
|
||||
}
|
||||
return bufchain_size(&sp->ssh_to_socket);
|
||||
@ -322,8 +323,8 @@ static void sshproxy_send_close(SshProxy *sp)
|
||||
interactor_return_seat(sp->clientitr);
|
||||
|
||||
if (!sp->conn_established)
|
||||
plug_log(sp->plug, PLUGLOG_CONNECT_FAILED, sp->addr, sp->port,
|
||||
sp->errmsg, 0);
|
||||
plug_log(sp->plug, &sp->sock, PLUGLOG_CONNECT_FAILED, sp->addr,
|
||||
sp->port, sp->errmsg, 0);
|
||||
|
||||
if (sp->errmsg)
|
||||
plug_closing_error(sp->plug, sp->errmsg);
|
||||
|
@ -339,7 +339,8 @@ static void proxy_telnet_process_queue(ProxyNegotiator *pn)
|
||||
put_datapl(logmsg, PTRLEN_LITERAL("Sending Telnet proxy command: "));
|
||||
put_c_string_literal(logmsg, ptrlen_from_asciz(censored_cmd));
|
||||
|
||||
plug_log(pn->ps->plug, PLUGLOG_PROXY_MSG, NULL, 0, logmsg->s, 0);
|
||||
plug_log(pn->ps->plug, &pn->ps->sock, PLUGLOG_PROXY_MSG, NULL, 0,
|
||||
logmsg->s, 0);
|
||||
strbuf_free(logmsg);
|
||||
sfree(censored_cmd);
|
||||
}
|
||||
|
Reference in New Issue
Block a user