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

Make ProxySocket an Interactor.

This lays all the groundwork for ProxyNegotiators to be able to issue
username and password prompts: ProxySocket now implements the
Interactor trait, it will borrow and return a Seat if one is
available, and it will present an Interactor of its own to the
ProxyNegotiator which can use it (via interactor_announce as usual) to
get a Seat to send prompts to. Also, proxy.c provides a centralised
system for making a prompts_t with an appropriate callback in it, and
dealing with the results of that callback.

No actual ProxyNegotiator implementation uses it yet, though.
This commit is contained in:
Simon Tatham
2021-11-19 11:05:14 +00:00
parent b7bf2aec74
commit 02aa5610dd
2 changed files with 99 additions and 7 deletions

View File

@ -38,8 +38,14 @@ struct ProxySocket {
/* configuration, used to look up proxy settings */
Conf *conf;
/* for interaction with the Seat */
Interactor *clientitr;
LogPolicy *clientlp;
Seat *clientseat;
Socket sock;
Plug plugimpl;
Interactor interactor;
};
struct ProxyNegotiator {
@ -50,6 +56,7 @@ struct ProxyNegotiator {
ProxySocket *ps;
bufchain *input;
bufchain_sink output[1];
Interactor *itr; /* NULL if we are not able to interact with the user */
/* Set to report success during proxy negotiation. */
bool done;
@ -58,6 +65,9 @@ struct ProxyNegotiator {
* ProxySocket will free it, and will then guarantee never to call
* process_queue again. */
char *error;
/* Set to report user abort during proxy negotiation. */
bool aborted;
};
struct ProxyNegotiatorVT {
@ -80,6 +90,12 @@ extern const ProxyNegotiatorVT socks4_proxy_negotiator_vt;
extern const ProxyNegotiatorVT socks5_proxy_negotiator_vt;
extern const ProxyNegotiatorVT telnet_proxy_negotiator_vt;
/*
* Centralised function to allow ProxyNegotiators to get hold of a
* prompts_t.
*/
prompts_t *proxy_new_prompts(ProxySocket *ps);
/*
* This may be reused by local-command proxies on individual
* platforms.