mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-06-30 19:12:48 -05:00
Pass an Interactor to new_connection().
Thanks to the previous commit, this new parameter can replace two of the existing ones: instead of passing a LogPolicy and a Seat, we now pass just an Interactor, from which any proxy implementation can extract the LogPolicy and the Seat anyway if they need it.
This commit is contained in:
@ -20,7 +20,7 @@ SockAddr *name_lookup(const char *host, int port, char **canonicalname,
|
||||
Socket *new_connection(SockAddr *addr, const char *hostname,
|
||||
int port, bool privport,
|
||||
bool oobinline, bool nodelay, bool keepalive,
|
||||
Plug *plug, Conf *conf, LogPolicy *lp, Seat **seat)
|
||||
Plug *plug, Conf *conf, Interactor *itr)
|
||||
{
|
||||
return sk_new(addr, port, privport, oobinline, nodelay, keepalive, plug);
|
||||
}
|
||||
|
@ -10,8 +10,7 @@ const bool ssh_proxy_supported = false;
|
||||
Socket *sshproxy_new_connection(SockAddr *addr, const char *hostname,
|
||||
int port, bool privport,
|
||||
bool oobinline, bool nodelay, bool keepalive,
|
||||
Plug *plug, Conf *conf,
|
||||
LogPolicy *clientlp, Seat **clientseat)
|
||||
Plug *plug, Conf *conf, Interactor *itr)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
@ -393,7 +393,7 @@ static const PlugVtable ProxySocket_plugvt = {
|
||||
Socket *new_connection(SockAddr *addr, const char *hostname,
|
||||
int port, bool privport,
|
||||
bool oobinline, bool nodelay, bool keepalive,
|
||||
Plug *plug, Conf *conf, LogPolicy *lp, Seat **seat)
|
||||
Plug *plug, Conf *conf, Interactor *itr)
|
||||
{
|
||||
int type = conf_get_int(conf, CONF_proxy_type);
|
||||
|
||||
@ -409,7 +409,7 @@ Socket *new_connection(SockAddr *addr, const char *hostname,
|
||||
if (type == PROXY_SSH &&
|
||||
(sret = sshproxy_new_connection(addr, hostname, port, privport,
|
||||
oobinline, nodelay, keepalive,
|
||||
plug, conf, lp, seat)) != NULL)
|
||||
plug, conf, itr)) != NULL)
|
||||
return sret;
|
||||
|
||||
if ((sret = platform_new_connection(addr, hostname, port, privport,
|
||||
|
@ -483,7 +483,7 @@ Socket *sshproxy_new_connection(SockAddr *addr, const char *hostname,
|
||||
int port, bool privport,
|
||||
bool oobinline, bool nodelay, bool keepalive,
|
||||
Plug *plug, Conf *clientconf,
|
||||
LogPolicy *clientlp, Seat **clientseat)
|
||||
Interactor *clientitr)
|
||||
{
|
||||
SshProxy *sp = snew(SshProxy);
|
||||
memset(sp, 0, sizeof(*sp));
|
||||
@ -594,24 +594,27 @@ Socket *sshproxy_new_connection(SockAddr *addr, const char *hostname,
|
||||
sfree(realhost);
|
||||
|
||||
/*
|
||||
* If we've been given useful bits and pieces for interacting with
|
||||
* the end user, squirrel them away now.
|
||||
* If we've been given an Interactor by the caller, squirrel away
|
||||
* things it's holding.
|
||||
*/
|
||||
sp->clientlp = clientlp;
|
||||
if (clientseat && (backvt->flags & BACKEND_NOTIFIES_SESSION_START)) {
|
||||
/*
|
||||
* We can only keep the client's Seat if our own backend will
|
||||
* tell us when to give it back. (SSH-based backends _should_
|
||||
* do that, but we check the flag here anyway.)
|
||||
*
|
||||
* Also, check if the client already has a TempSeat, and if
|
||||
* so, don't wrap it with another one.
|
||||
*/
|
||||
if (is_tempseat(*clientseat)) {
|
||||
sp->clientseat = tempseat_get_real(*clientseat);
|
||||
} else {
|
||||
sp->clientseat = *clientseat;
|
||||
*clientseat = tempseat_new(sp->clientseat);
|
||||
if (clientitr) {
|
||||
sp->clientlp = interactor_logpolicy(clientitr);
|
||||
if (backvt->flags & BACKEND_NOTIFIES_SESSION_START) {
|
||||
/*
|
||||
* We can only keep the client's Seat if our own backend will
|
||||
* tell us when to give it back. (SSH-based backends _should_
|
||||
* do that, but we check the flag here anyway.)
|
||||
*
|
||||
* Also, check if the client already has a TempSeat, and if
|
||||
* so, don't wrap it with another one.
|
||||
*/
|
||||
Seat *clientseat = interactor_get_seat(clientitr);
|
||||
if (is_tempseat(clientseat)) {
|
||||
sp->clientseat = tempseat_get_real(clientseat);
|
||||
} else {
|
||||
sp->clientseat = clientseat;
|
||||
interactor_set_seat(clientitr, tempseat_new(sp->clientseat));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user