From d42f1fe96d4a42f94954cf665ba12e6f1317fc62 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sat, 23 Oct 2021 17:54:21 +0100 Subject: [PATCH] Remove 'calling_back' parameter from plug_closing. It was totally unused. No implementation of the 'closing' method in a Plug vtable was checking it for any reason at all, except for ProxySocket which captured it from its client in order to pass on to its server (which, perhaps after further iterations of ProxySocket, would have ended up ignoring it similarly). And every caller of plug_closing set it to 0 (aka false), except for the one in sshproxy.c which passed true (but it would have made no difference to anyone). The comment in network.h refers to a FIXME comment which was in try_send() when that code was written (see winnet.c in commit 7b0e08270058390). That FIXME is long gone, replaced by a use of a toplevel callback. So I think the aim must have been to avoid re-entrancy when sk_write called try_send which encountered a socket error and called back to plug_closing - but that's long since fixed by other means now. --- cproxy.c | 10 ++++---- network.h | 10 +++----- nocproxy.c | 4 +-- nullplug.c | 3 +-- otherbackends/raw.c | 3 +-- otherbackends/rlogin.c | 3 +-- otherbackends/supdup.c | 3 +-- otherbackends/telnet.c | 3 +-- pageant.c | 4 +-- proxy.c | 56 ++++++++++++++++++----------------------- proxy.h | 1 - psocks.c | 4 +-- ssh/portfwd.c | 6 ++--- ssh/server.c | 3 +-- ssh/sesschan.c | 3 +-- ssh/sharing.c | 5 ++-- ssh/ssh.c | 3 +-- ssh/x11fwd.c | 3 +-- sshproxy.c | 4 +-- unix/fd-socket.c | 7 +++--- unix/network.c | 10 ++++---- unix/pageant.c | 3 +-- unix/psusan.c | 3 +-- unix/uppity.c | 3 +-- windows/handle-socket.c | 6 ++--- windows/network.c | 14 +++++------ 26 files changed, 76 insertions(+), 101 deletions(-) diff --git a/cproxy.c b/cproxy.c index e1d788b6..d187ffec 100644 --- a/cproxy.c +++ b/cproxy.c @@ -67,13 +67,13 @@ int proxy_socks5_handlechap (ProxySocket *p) if (data[0] != 0x01) { plug_closing(p->plug, "Proxy error: SOCKS proxy wants" " a different CHAP version", - PROXY_ERROR_GENERAL, 0); + PROXY_ERROR_GENERAL); return 1; } if (data[1] == 0x00) { plug_closing(p->plug, "Proxy error: SOCKS proxy won't" " negotiate CHAP with us", - PROXY_ERROR_GENERAL, 0); + PROXY_ERROR_GENERAL); return 1; } p->chap_num_attributes = data[1]; @@ -105,7 +105,7 @@ int proxy_socks5_handlechap (ProxySocket *p) else { plug_closing(p->plug, "Proxy error: SOCKS proxy" " refused CHAP authentication", - PROXY_ERROR_GENERAL, 0); + PROXY_ERROR_GENERAL); return 1; } break; @@ -125,7 +125,7 @@ int proxy_socks5_handlechap (ProxySocket *p) plug_closing(p->plug, "Proxy error: Server chose " "CHAP of other than HMAC-MD5 but we " "didn't offer it!", - PROXY_ERROR_GENERAL, 0); + PROXY_ERROR_GENERAL); return 1; } break; @@ -174,6 +174,6 @@ int proxy_socks5_selectchap(ProxySocket *p) } else plug_closing(p->plug, "Proxy error: Server chose " "CHAP authentication but we didn't offer it!", - PROXY_ERROR_GENERAL, 0); + PROXY_ERROR_GENERAL); return 1; } diff --git a/network.h b/network.h index 85c5a6d9..ff88923b 100644 --- a/network.h +++ b/network.h @@ -87,7 +87,7 @@ struct PlugVtable { * the logged events. */ void (*closing) - (Plug *p, const char *error_msg, int error_code, bool calling_back); + (Plug *p, const char *error_msg, int error_code); /* error_msg is NULL iff it is not an error (ie it closed normally) */ /* calling_back != 0 iff there is a Plug function */ /* currently running (would cure the fixme in try_send()) */ @@ -214,9 +214,8 @@ static inline void sk_write_eof(Socket *s) static inline void plug_log( Plug *p, int type, SockAddr *addr, int port, const char *msg, int code) { p->vt->log(p, type, addr, port, msg, code); } -static inline void plug_closing( - Plug *p, const char *msg, int code, bool calling_back) -{ p->vt->closing(p, msg, code, calling_back); } +static inline void plug_closing(Plug *p, const char *msg, int code) +{ p->vt->closing(p, msg, code); } static inline void plug_receive(Plug *p, int urg, const char *data, size_t len) { p->vt->receive(p, urg, data, len); } static inline void plug_sent (Plug *p, size_t bufsize) @@ -341,8 +340,7 @@ extern Plug *const nullplug; */ void nullplug_log(Plug *plug, PlugLogType type, SockAddr *addr, int port, const char *err_msg, int err_code); -void nullplug_closing(Plug *plug, const char *error_msg, int error_code, - bool calling_back); +void nullplug_closing(Plug *plug, const char *error_msg, int error_code); void nullplug_receive(Plug *plug, int urgent, const char *data, size_t len); void nullplug_sent(Plug *plug, size_t bufsize); diff --git a/nocproxy.c b/nocproxy.c index f93214fa..cdc28a39 100644 --- a/nocproxy.c +++ b/nocproxy.c @@ -22,7 +22,7 @@ int proxy_socks5_handlechap (ProxySocket *p) plug_closing(p->plug, "Proxy error: Trying to handle a SOCKS5 CHAP request" " in telnet-only build", - PROXY_ERROR_GENERAL, 0); + PROXY_ERROR_GENERAL); return 1; } @@ -30,6 +30,6 @@ int proxy_socks5_selectchap(ProxySocket *p) { plug_closing(p->plug, "Proxy error: Trying to handle a SOCKS5 CHAP request" " in telnet-only build", - PROXY_ERROR_GENERAL, 0); + PROXY_ERROR_GENERAL); return 1; } diff --git a/nullplug.c b/nullplug.c index 380e4b4f..ad65f5ea 100644 --- a/nullplug.c +++ b/nullplug.c @@ -12,8 +12,7 @@ void nullplug_log(Plug *plug, PlugLogType type, SockAddr *addr, { } -void nullplug_closing(Plug *plug, const char *error_msg, int error_code, - bool calling_back) +void nullplug_closing(Plug *plug, const char *error_msg, int error_code) { } diff --git a/otherbackends/raw.c b/otherbackends/raw.c index 97b7be09..491a3df9 100644 --- a/otherbackends/raw.c +++ b/otherbackends/raw.c @@ -69,8 +69,7 @@ static void raw_check_close(Raw *raw) } } -static void raw_closing(Plug *plug, const char *error_msg, int error_code, - bool calling_back) +static void raw_closing(Plug *plug, const char *error_msg, int error_code) { Raw *raw = container_of(plug, Raw, plug); diff --git a/otherbackends/rlogin.c b/otherbackends/rlogin.c index 09f1ab1d..9951ce18 100644 --- a/otherbackends/rlogin.c +++ b/otherbackends/rlogin.c @@ -89,8 +89,7 @@ static void rlogin_log(Plug *plug, PlugLogType type, SockAddr *addr, int port, } } -static void rlogin_closing(Plug *plug, const char *error_msg, int error_code, - bool calling_back) +static void rlogin_closing(Plug *plug, const char *error_msg, int error_code) { Rlogin *rlogin = container_of(plug, Rlogin, plug); diff --git a/otherbackends/supdup.c b/otherbackends/supdup.c index a3418fe1..f015e054 100644 --- a/otherbackends/supdup.c +++ b/otherbackends/supdup.c @@ -577,8 +577,7 @@ static void supdup_log(Plug *plug, PlugLogType type, SockAddr *addr, int port, } } -static void supdup_closing(Plug *plug, const char *error_msg, int error_code, - bool calling_back) +static void supdup_closing(Plug *plug, const char *error_msg, int error_code) { Supdup *supdup = container_of(plug, Supdup, plug); diff --git a/otherbackends/telnet.c b/otherbackends/telnet.c index 98c202c6..281c39ac 100644 --- a/otherbackends/telnet.c +++ b/otherbackends/telnet.c @@ -639,8 +639,7 @@ static void telnet_log(Plug *plug, PlugLogType type, SockAddr *addr, int port, } } -static void telnet_closing(Plug *plug, const char *error_msg, int error_code, - bool calling_back) +static void telnet_closing(Plug *plug, const char *error_msg, int error_code) { Telnet *telnet = container_of(plug, Telnet, plug); diff --git a/pageant.c b/pageant.c index 89256b53..bb658cfe 100644 --- a/pageant.c +++ b/pageant.c @@ -1464,7 +1464,7 @@ struct pageant_conn_state { }; static void pageant_conn_closing(Plug *plug, const char *error_msg, - int error_code, bool calling_back) + int error_code) { struct pageant_conn_state *pc = container_of( plug, struct pageant_conn_state, plug); @@ -1611,7 +1611,7 @@ struct pageant_listen_state { }; static void pageant_listen_closing(Plug *plug, const char *error_msg, - int error_code, bool calling_back) + int error_code) { struct pageant_listen_state *pl = container_of( plug, struct pageant_listen_state, plug); diff --git a/proxy.c b/proxy.c index 97a4b1df..08d5afba 100644 --- a/proxy.c +++ b/proxy.c @@ -181,18 +181,16 @@ static void plug_proxy_log(Plug *plug, PlugLogType type, SockAddr *addr, plug_log(ps->plug, type, addr, port, error_msg, error_code); } -static void plug_proxy_closing (Plug *p, const char *error_msg, - int error_code, bool calling_back) +static void plug_proxy_closing(Plug *p, const char *error_msg, int error_code) { ProxySocket *ps = container_of(p, ProxySocket, plugimpl); if (ps->state != PROXY_STATE_ACTIVE) { ps->closing_error_msg = error_msg; ps->closing_error_code = error_code; - ps->closing_calling_back = calling_back; ps->negotiate(ps, PROXY_CHANGE_CLOSING); } else { - plug_closing(ps->plug, error_msg, error_code, calling_back); + plug_closing(ps->plug, error_msg, error_code); } } @@ -617,8 +615,7 @@ int proxy_http_negotiate (ProxySocket *p, int change) * a socket close, then some error must have occurred. we'll * just pass those errors up to the backend. */ - plug_closing(p->plug, p->closing_error_msg, p->closing_error_code, - p->closing_calling_back); + plug_closing(p->plug, p->closing_error_msg, p->closing_error_code); return 0; /* ignored */ } @@ -675,7 +672,7 @@ int proxy_http_negotiate (ProxySocket *p, int change) if (sscanf((char *)data, "HTTP/%i.%i %n", &maj_ver, &min_ver, &status) < 2 || status == -1) { plug_closing(p->plug, "Proxy error: HTTP response was absent", - PROXY_ERROR_GENERAL, 0); + PROXY_ERROR_GENERAL); sfree(data); return 1; } @@ -690,7 +687,7 @@ int proxy_http_negotiate (ProxySocket *p, int change) (data[eol-1] == '\r' || data[eol-1] == '\n')) data[--eol] = '\0'; buf = dupprintf("Proxy error: %s", data+status); - plug_closing(p->plug, buf, PROXY_ERROR_GENERAL, 0); + plug_closing(p->plug, buf, PROXY_ERROR_GENERAL); sfree(buf); sfree(data); return 1; @@ -741,7 +738,7 @@ int proxy_http_negotiate (ProxySocket *p, int change) } plug_closing(p->plug, "Proxy error: unexpected proxy error", - PROXY_ERROR_UNEXPECTED, 0); + PROXY_ERROR_UNEXPECTED); return 1; } @@ -807,8 +804,7 @@ int proxy_socks4_negotiate (ProxySocket *p, int change) * a socket close, then some error must have occurred. we'll * just pass those errors up to the backend. */ - plug_closing(p->plug, p->closing_error_msg, p->closing_error_code, - p->closing_calling_back); + plug_closing(p->plug, p->closing_error_msg, p->closing_error_code); return 0; /* ignored */ } @@ -860,7 +856,7 @@ int proxy_socks4_negotiate (ProxySocket *p, int change) if (data[0] != 0) { plug_closing(p->plug, "Proxy error: SOCKS proxy responded with " "unexpected reply code version", - PROXY_ERROR_GENERAL, 0); + PROXY_ERROR_GENERAL); return 1; } @@ -869,16 +865,16 @@ int proxy_socks4_negotiate (ProxySocket *p, int change) switch (data[1]) { case 92: plug_closing(p->plug, "Proxy error: SOCKS server wanted IDENTD on client", - PROXY_ERROR_GENERAL, 0); + PROXY_ERROR_GENERAL); break; case 93: plug_closing(p->plug, "Proxy error: Username and IDENTD on client don't agree", - PROXY_ERROR_GENERAL, 0); + PROXY_ERROR_GENERAL); break; case 91: default: plug_closing(p->plug, "Proxy error: Error while communicating with proxy", - PROXY_ERROR_GENERAL, 0); + PROXY_ERROR_GENERAL); break; } @@ -895,7 +891,7 @@ int proxy_socks4_negotiate (ProxySocket *p, int change) } plug_closing(p->plug, "Proxy error: unexpected proxy error", - PROXY_ERROR_UNEXPECTED, 0); + PROXY_ERROR_UNEXPECTED); return 1; } @@ -951,8 +947,7 @@ int proxy_socks5_negotiate (ProxySocket *p, int change) * a socket close, then some error must have occurred. we'll * just pass those errors up to the backend. */ - plug_closing(p->plug, p->closing_error_msg, p->closing_error_code, - p->closing_calling_back); + plug_closing(p->plug, p->closing_error_msg, p->closing_error_code); return 0; /* ignored */ } @@ -1002,7 +997,7 @@ int proxy_socks5_negotiate (ProxySocket *p, int change) if (data[0] != 5) { plug_closing(p->plug, "Proxy error: SOCKS proxy returned unexpected version", - PROXY_ERROR_GENERAL, 0); + PROXY_ERROR_GENERAL); return 1; } @@ -1012,7 +1007,7 @@ int proxy_socks5_negotiate (ProxySocket *p, int change) else if (data[1] == 0x03) p->state = 6; /* CHAP authentication */ else { plug_closing(p->plug, "Proxy error: SOCKS proxy did not accept our authentication", - PROXY_ERROR_GENERAL, 0); + PROXY_ERROR_GENERAL); return 1; } bufchain_consume(&p->pending_input_data, 2); @@ -1037,7 +1032,7 @@ int proxy_socks5_negotiate (ProxySocket *p, int change) if (data[0] != 1) { plug_closing(p->plug, "Proxy error: SOCKS password " "subnegotiation contained wrong version number", - PROXY_ERROR_GENERAL, 0); + PROXY_ERROR_GENERAL); return 1; } @@ -1045,7 +1040,7 @@ int proxy_socks5_negotiate (ProxySocket *p, int change) plug_closing(p->plug, "Proxy error: SOCKS proxy refused" " password authentication", - PROXY_ERROR_GENERAL, 0); + PROXY_ERROR_GENERAL); return 1; } @@ -1148,7 +1143,7 @@ int proxy_socks5_negotiate (ProxySocket *p, int change) if (data[0] != 5) { plug_closing(p->plug, "Proxy error: SOCKS proxy returned wrong version number", - PROXY_ERROR_GENERAL, 0); + PROXY_ERROR_GENERAL); return 1; } @@ -1171,7 +1166,7 @@ int proxy_socks5_negotiate (ProxySocket *p, int change) data[1]); break; } - plug_closing(p->plug, buf, PROXY_ERROR_GENERAL, 0); + plug_closing(p->plug, buf, PROXY_ERROR_GENERAL); return 1; } @@ -1187,7 +1182,7 @@ int proxy_socks5_negotiate (ProxySocket *p, int change) default: plug_closing(p->plug, "Proxy error: SOCKS proxy returned " "unrecognised address format", - PROXY_ERROR_GENERAL, 0); + PROXY_ERROR_GENERAL); return 1; } if (bufchain_size(&p->pending_input_data) < len) @@ -1202,7 +1197,7 @@ int proxy_socks5_negotiate (ProxySocket *p, int change) if (p->state == 4) { /* TODO: Handle GSSAPI authentication */ plug_closing(p->plug, "Proxy error: We don't support GSSAPI authentication", - PROXY_ERROR_GENERAL, 0); + PROXY_ERROR_GENERAL); return 1; } @@ -1231,7 +1226,7 @@ int proxy_socks5_negotiate (ProxySocket *p, int change) plug_closing(p->plug, "Proxy error: Server chose " "username/password authentication but we " "didn't offer it!", - PROXY_ERROR_GENERAL, 0); + PROXY_ERROR_GENERAL); return 1; } @@ -1244,7 +1239,7 @@ int proxy_socks5_negotiate (ProxySocket *p, int change) } plug_closing(p->plug, "Proxy error: Unexpected proxy error", - PROXY_ERROR_UNEXPECTED, 0); + PROXY_ERROR_UNEXPECTED); return 1; } @@ -1479,8 +1474,7 @@ int proxy_telnet_negotiate (ProxySocket *p, int change) * a socket close, then some error must have occurred. we'll * just pass those errors up to the backend. */ - plug_closing(p->plug, p->closing_error_msg, p->closing_error_code, - p->closing_calling_back); + plug_closing(p->plug, p->closing_error_msg, p->closing_error_code); return 0; /* ignored */ } @@ -1516,6 +1510,6 @@ int proxy_telnet_negotiate (ProxySocket *p, int change) } plug_closing(p->plug, "Proxy error: Unexpected proxy error", - PROXY_ERROR_UNEXPECTED, 0); + PROXY_ERROR_UNEXPECTED); return 1; } diff --git a/proxy.h b/proxy.h index f11e1e3d..9dca87d1 100644 --- a/proxy.h +++ b/proxy.h @@ -63,7 +63,6 @@ struct ProxySocket { /* closing */ const char *closing_error_msg; int closing_error_code; - bool closing_calling_back; /* receive */ bool receive_urgent; diff --git a/psocks.c b/psocks.c index 75dc85d9..50bdf714 100644 --- a/psocks.c +++ b/psocks.c @@ -95,7 +95,7 @@ static const SshChannelVtable psocks_scvt = { static void psocks_plug_log(Plug *p, PlugLogType type, SockAddr *addr, int port, const char *error_msg, int error_code); static void psocks_plug_closing(Plug *p, const char *error_msg, - int error_code, bool calling_back); + int error_code); static void psocks_plug_receive(Plug *p, int urgent, const char *data, size_t len); static void psocks_plug_sent(Plug *p, size_t bufsize); @@ -355,7 +355,7 @@ static void psocks_plug_log(Plug *plug, PlugLogType type, SockAddr *addr, } static void psocks_plug_closing(Plug *plug, const char *error_msg, - int error_code, bool calling_back) + int error_code) { psocks_connection *conn = container_of(plug, psocks_connection, plug); if (conn->connecting) { diff --git a/ssh/portfwd.c b/ssh/portfwd.c index 268935eb..9dd35ea4 100644 --- a/ssh/portfwd.c +++ b/ssh/portfwd.c @@ -109,8 +109,7 @@ static void pfl_log(Plug *plug, PlugLogType type, SockAddr *addr, int port, static void pfd_close(struct PortForwarding *pf); -static void pfd_closing(Plug *plug, const char *error_msg, int error_code, - bool calling_back) +static void pfd_closing(Plug *plug, const char *error_msg, int error_code) { struct PortForwarding *pf = container_of(plug, struct PortForwarding, plug); @@ -142,8 +141,7 @@ static void pfd_closing(Plug *plug, const char *error_msg, int error_code, static void pfl_terminate(struct PortListener *pl); -static void pfl_closing(Plug *plug, const char *error_msg, int error_code, - bool calling_back) +static void pfl_closing(Plug *plug, const char *error_msg, int error_code) { struct PortListener *pl = (struct PortListener *) plug; pfl_terminate(pl); diff --git a/ssh/server.c b/ssh/server.c index 4a3676ec..404ba77d 100644 --- a/ssh/server.c +++ b/ssh/server.c @@ -139,8 +139,7 @@ static void server_socket_log(Plug *plug, PlugLogType type, SockAddr *addr, /* FIXME */ } -static void server_closing(Plug *plug, const char *error_msg, int error_code, - bool calling_back) +static void server_closing(Plug *plug, const char *error_msg, int error_code) { server *srv = container_of(plug, server, plug); if (error_msg) { diff --git a/ssh/sesschan.c b/ssh/sesschan.c index 1ef55dde..ff4a008f 100644 --- a/ssh/sesschan.c +++ b/ssh/sesschan.c @@ -366,8 +366,7 @@ bool sesschan_run_subsystem(Channel *chan, ptrlen subsys) static void fwd_log(Plug *plug, PlugLogType type, SockAddr *addr, int port, const char *error_msg, int error_code) { /* don't expect any weirdnesses from a listening socket */ } -static void fwd_closing(Plug *plug, const char *error_msg, int error_code, - bool calling_back) +static void fwd_closing(Plug *plug, const char *error_msg, int error_code) { /* not here, either */ } static int xfwd_accepting(Plug *p, accept_fn_t constructor, accept_ctx_t ctx) diff --git a/ssh/sharing.c b/ssh/sharing.c index 920218de..92e2a786 100644 --- a/ssh/sharing.c +++ b/ssh/sharing.c @@ -937,8 +937,7 @@ static void share_disconnect(struct ssh_sharing_connstate *cs, share_begin_cleanup(cs); } -static void share_closing(Plug *plug, const char *error_msg, int error_code, - bool calling_back) +static void share_closing(Plug *plug, const char *error_msg, int error_code) { struct ssh_sharing_connstate *cs = container_of( plug, struct ssh_sharing_connstate, plug); @@ -1846,7 +1845,7 @@ static void share_sent(Plug *plug, size_t bufsize) } static void share_listen_closing(Plug *plug, const char *error_msg, - int error_code, bool calling_back) + int error_code) { ssh_sharing_state *sharestate = container_of(plug, ssh_sharing_state, plug); diff --git a/ssh/ssh.c b/ssh/ssh.c index 4e7f8c06..b2d75b09 100644 --- a/ssh/ssh.c +++ b/ssh/ssh.c @@ -609,8 +609,7 @@ static void ssh_socket_log(Plug *plug, PlugLogType type, SockAddr *addr, } } -static void ssh_closing(Plug *plug, const char *error_msg, int error_code, - bool calling_back) +static void ssh_closing(Plug *plug, const char *error_msg, int error_code) { Ssh *ssh = container_of(plug, Ssh, plug); if (error_msg) { diff --git a/ssh/x11fwd.c b/ssh/x11fwd.c index 60a9f1aa..6886dace 100644 --- a/ssh/x11fwd.c +++ b/ssh/x11fwd.c @@ -267,8 +267,7 @@ static void x11_log(Plug *p, PlugLogType type, SockAddr *addr, int port, static void x11_send_init_error(struct X11Connection *conn, const char *err_message); -static void x11_closing(Plug *plug, const char *error_msg, int error_code, - bool calling_back) +static void x11_closing(Plug *plug, const char *error_msg, int error_code) { struct X11Connection *xconn = container_of( plug, struct X11Connection, plug); diff --git a/sshproxy.c b/sshproxy.c index aea19cf6..31657645 100644 --- a/sshproxy.c +++ b/sshproxy.c @@ -244,7 +244,7 @@ static void try_send_ssh_to_socket(void *ctx) if (sp->rcvd_eof_ssh_to_socket && !sp->sent_eof_ssh_to_socket) { sp->sent_eof_ssh_to_socket = true; - plug_closing(sp->plug, sp->errmsg, 0, 0); + plug_closing(sp->plug, sp->errmsg, 0); } } @@ -325,7 +325,7 @@ static int sshproxy_get_userpass_input(Seat *seat, prompts_t *p) static void sshproxy_connection_fatal_callback(void *vctx) { SshProxy *sp = (SshProxy *)vctx; - plug_closing(sp->plug, sp->errmsg, 0, true); + plug_closing(sp->plug, sp->errmsg, 0); } static void sshproxy_connection_fatal(Seat *seat, const char *message) diff --git a/unix/fd-socket.c b/unix/fd-socket.c index d352d8e4..48d7dc8b 100644 --- a/unix/fd-socket.c +++ b/unix/fd-socket.c @@ -158,8 +158,7 @@ static void fdsocket_error_callback(void *vs) /* * An error has occurred on this socket. Pass it to the plug. */ - plug_closing(fds->plug, strerror(fds->pending_error), - fds->pending_error, 0); + plug_closing(fds->plug, strerror(fds->pending_error), fds->pending_error); } static int fdsocket_try_send(FdSocket *fds) @@ -271,9 +270,9 @@ static void fdsocket_select_result_input(int fd, int event) fds->infd = -1; if (retd < 0) { - plug_closing(fds->plug, strerror(errno), errno, 0); + plug_closing(fds->plug, strerror(errno), errno); } else { - plug_closing(fds->plug, NULL, 0, 0); + plug_closing(fds->plug, NULL, 0); } } } diff --git a/unix/network.c b/unix/network.c index bd6ebb1d..d2d426ed 100644 --- a/unix/network.c +++ b/unix/network.c @@ -1101,7 +1101,7 @@ static void socket_error_callback(void *vs) /* * An error has occurred on this socket. Pass it to the plug. */ - plug_closing(s->plug, strerror(s->pending_error), s->pending_error, 0); + plug_closing(s->plug, strerror(s->pending_error), s->pending_error); } /* @@ -1298,7 +1298,7 @@ static void net_select_result(int fd, int event) if (ret <= 0) { plug_closing(s->plug, ret == 0 ? "Internal networking trouble" : - strerror(errno), errno, 0); + strerror(errno), errno); } else { /* * Receiving actual data on a socket means we can @@ -1384,11 +1384,11 @@ static void net_select_result(int fd, int event) } } if (ret < 0) { - plug_closing(s->plug, strerror(errno), errno, 0); + plug_closing(s->plug, strerror(errno), errno); } else if (0 == ret) { s->incomingeof = true; /* stop trying to read now */ uxsel_tell(s); - plug_closing(s->plug, NULL, 0, 0); + plug_closing(s->plug, NULL, 0); } else { /* * Receiving actual data on a socket means we can @@ -1438,7 +1438,7 @@ static void net_select_result(int fd, int event) err = try_connect(s); } if (err) { - plug_closing(s->plug, strerror(err), err, 0); + plug_closing(s->plug, strerror(err), err); return; /* socket is now presumably defunct */ } if (!s->connected) diff --git a/unix/pageant.c b/unix/pageant.c index 7402ac60..a0b2e9e2 100644 --- a/unix/pageant.c +++ b/unix/pageant.c @@ -249,8 +249,7 @@ static void x11_log(Plug *p, PlugLogType type, SockAddr *addr, int port, const char *error_msg, int error_code) {} static void x11_receive(Plug *plug, int urgent, const char *data, size_t len) {} static void x11_sent(Plug *plug, size_t bufsize) {} -static void x11_closing(Plug *plug, const char *error_msg, int error_code, - bool calling_back) +static void x11_closing(Plug *plug, const char *error_msg, int error_code) { time_to_die = true; } diff --git a/unix/psusan.c b/unix/psusan.c index 2017685b..8fcef33a 100644 --- a/unix/psusan.c +++ b/unix/psusan.c @@ -273,8 +273,7 @@ static void server_log(Plug *plug, PlugLogType type, SockAddr *addr, int port, log_to_stderr(-1, error_msg); } -static void server_closing(Plug *plug, const char *error_msg, int error_code, - bool calling_back) +static void server_closing(Plug *plug, const char *error_msg, int error_code) { log_to_stderr(-1, error_msg); } diff --git a/unix/uppity.c b/unix/uppity.c index 5d0a1b1c..0701ddab 100644 --- a/unix/uppity.c +++ b/unix/uppity.c @@ -482,8 +482,7 @@ static void server_log(Plug *plug, PlugLogType type, SockAddr *addr, int port, log_to_stderr((unsigned)-1, error_msg); } -static void server_closing(Plug *plug, const char *error_msg, int error_code, - bool calling_back) +static void server_closing(Plug *plug, const char *error_msg, int error_code) { log_to_stderr((unsigned)-1, error_msg); } diff --git a/windows/handle-socket.c b/windows/handle-socket.c index a024807e..066d2373 100644 --- a/windows/handle-socket.c +++ b/windows/handle-socket.c @@ -53,10 +53,10 @@ static size_t handle_gotdata( HandleSocket *hs = (HandleSocket *)handle_get_privdata(h); if (err) { - plug_closing(hs->plug, "Read error from handle", 0, 0); + plug_closing(hs->plug, "Read error from handle", 0); return 0; } else if (len == 0) { - plug_closing(hs->plug, NULL, 0, 0); + plug_closing(hs->plug, NULL, 0); return 0; } else { assert(hs->frozen != FROZEN && hs->frozen != THAWING); @@ -107,7 +107,7 @@ static void handle_sentdata(struct handle *h, size_t new_backlog, int err, } if (err) { - plug_closing(hs->plug, win_strerror(err), err, 0); + plug_closing(hs->plug, win_strerror(err), err); return; } diff --git a/windows/network.c b/windows/network.c index 3b4da3cc..17c80cb4 100644 --- a/windows/network.c +++ b/windows/network.c @@ -1353,7 +1353,7 @@ static void socket_error_callback(void *vs) * An error has occurred on this socket. Pass it to the plug. */ plug_closing(s->plug, winsock_error_string(s->pending_error), - s->pending_error, 0); + s->pending_error); } /* @@ -1528,7 +1528,7 @@ void select_result(WPARAM wParam, LPARAM lParam) } } if (err != 0) - plug_closing(s->plug, winsock_error_string(err), err, 0); + plug_closing(s->plug, winsock_error_string(err), err); return; } @@ -1590,9 +1590,9 @@ void select_result(WPARAM wParam, LPARAM lParam) } } if (ret < 0) { - plug_closing(s->plug, winsock_error_string(err), err, 0); + plug_closing(s->plug, winsock_error_string(err), err); } else if (0 == ret) { - plug_closing(s->plug, NULL, 0, 0); + plug_closing(s->plug, NULL, 0); } else { plug_receive(s->plug, atmark ? 0 : 1, buf, ret); } @@ -1608,7 +1608,7 @@ void select_result(WPARAM wParam, LPARAM lParam) noise_ultralight(NOISE_SOURCE_IOLEN, ret); if (ret <= 0) { int err = p_WSAGetLastError(); - plug_closing(s->plug, winsock_error_string(err), err, 0); + plug_closing(s->plug, winsock_error_string(err), err); } else { plug_receive(s->plug, 2, buf, ret); } @@ -1631,12 +1631,12 @@ void select_result(WPARAM wParam, LPARAM lParam) err = p_WSAGetLastError(); if (err == WSAEWOULDBLOCK) break; - plug_closing(s->plug, winsock_error_string(err), err, 0); + plug_closing(s->plug, winsock_error_string(err), err); } else { if (ret) plug_receive(s->plug, 0, buf, ret); else - plug_closing(s->plug, NULL, 0, 0); + plug_closing(s->plug, NULL, 0); } } while (ret > 0); return;