diff --git a/logging.c b/logging.c index a43ebcd1..024bb11e 100644 --- a/logging.c +++ b/logging.c @@ -31,7 +31,7 @@ static Filename *xlatlognam(Filename *s, char *hostname, int port, * isn't open, buffering data if it's in the process of being * opened asynchronously, etc. */ -static void logwrite(LogContext *ctx, void *data, int len) +static void logwrite(LogContext *ctx, const void *data, int len) { /* * In state L_CLOSED, we call logfopen, which will set the state diff --git a/network.h b/network.h index a394a356..a84df7f0 100644 --- a/network.h +++ b/network.h @@ -70,7 +70,7 @@ struct PlugVtable { /* 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()) */ - void (*receive) (Plug *p, int urgent, char *data, int len); + void (*receive) (Plug *p, int urgent, const char *data, int len); /* * - urgent==0. `data' points to `len' bytes of perfectly * ordinary data. diff --git a/nullplug.c b/nullplug.c index ca6c7c2c..25a3cc97 100644 --- a/nullplug.c +++ b/nullplug.c @@ -17,7 +17,7 @@ static void nullplug_closing(Plug *plug, const char *error_msg, int error_code, { } -static void nullplug_receive(Plug *plug, int urgent, char *data, int len) +static void nullplug_receive(Plug *plug, int urgent, const char *data, int len) { } diff --git a/pageant.c b/pageant.c index 24f4f9e3..216dc94d 100644 --- a/pageant.c +++ b/pageant.c @@ -755,7 +755,8 @@ static void pageant_conn_log(void *logctx, const char *fmt, va_list ap) sfree(formatted); } -static void pageant_conn_receive(Plug *plug, int urgent, char *data, int len) +static void pageant_conn_receive( + Plug *plug, int urgent, const char *data, int len) { struct pageant_conn_state *pc = container_of( plug, struct pageant_conn_state, plug); diff --git a/portfwd.c b/portfwd.c index e410850b..91d47802 100644 --- a/portfwd.c +++ b/portfwd.c @@ -192,7 +192,7 @@ static char *ipv6_to_string(ptrlen ipv6) (unsigned)GET_16BIT_MSB_FIRST(addr + 14)); } -static void pfd_receive(Plug *plug, int urgent, char *data, int len) +static void pfd_receive(Plug *plug, int urgent, const char *data, int len) { struct PortForwarding *pf = container_of(plug, struct PortForwarding, plug); diff --git a/proxy.c b/proxy.c index aa940e41..26373908 100644 --- a/proxy.c +++ b/proxy.c @@ -214,7 +214,7 @@ static void plug_proxy_closing (Plug *p, const char *error_msg, } } -static void plug_proxy_receive (Plug *p, int urgent, char *data, int len) +static void plug_proxy_receive (Plug *p, int urgent, const char *data, int len) { ProxySocket *ps = container_of(p, ProxySocket, plugimpl); diff --git a/proxy.h b/proxy.h index 2ecde43a..b7e2c3b3 100644 --- a/proxy.h +++ b/proxy.h @@ -68,7 +68,7 @@ struct ProxySocket { /* receive */ bool receive_urgent; - char *receive_data; + const char *receive_data; int receive_len; /* sent */ diff --git a/pscp.c b/pscp.c index 28566a5d..9e760c77 100644 --- a/pscp.c +++ b/pscp.c @@ -574,7 +574,7 @@ bool sftp_recvdata(char *buf, int len) { return ssh_scp_recv(buf, len); } -bool sftp_senddata(char *buf, int len) +bool sftp_senddata(const char *buf, int len) { backend_send(backend, buf, len); return true; diff --git a/psftp.c b/psftp.c index 21c57365..4a338da8 100644 --- a/psftp.c +++ b/psftp.c @@ -2493,7 +2493,7 @@ bool sftp_recvdata(char *buf, int len) return true; } -bool sftp_senddata(char *buf, int len) +bool sftp_senddata(const char *buf, int len) { backend_send(backend, buf, len); return true; diff --git a/raw.c b/raw.c index 90dde5d8..d448e0e6 100644 --- a/raw.c +++ b/raw.c @@ -89,7 +89,7 @@ static void raw_closing(Plug *plug, const char *error_msg, int error_code, } } -static void raw_receive(Plug *plug, int urgent, char *data, int len) +static void raw_receive(Plug *plug, int urgent, const char *data, int len) { Raw *raw = container_of(plug, Raw, plug); c_write(raw, data, len); diff --git a/rlogin.c b/rlogin.c index 46bfb7eb..27f2a0da 100644 --- a/rlogin.c +++ b/rlogin.c @@ -71,9 +71,11 @@ static void rlogin_closing(Plug *plug, const char *error_msg, int error_code, } /* Otherwise, the remote side closed the connection normally. */ } -static void rlogin_receive(Plug *plug, int urgent, char *data, int len) +static void rlogin_receive(Plug *plug, int urgent, const char *data, int len) { Rlogin *rlogin = container_of(plug, Rlogin, plug); + if (len == 0) + return; if (urgent == 2) { char c; diff --git a/sftp.h b/sftp.h index 95d70ff7..cdbea3e5 100644 --- a/sftp.h +++ b/sftp.h @@ -70,7 +70,7 @@ * sftp_sendbuffer returns the size of the backlog of data in the * transmit queue. */ -bool sftp_senddata(char *data, int len); +bool sftp_senddata(const char *data, int len); int sftp_sendbuffer(void); bool sftp_recvdata(char *data, int len); diff --git a/ssh.c b/ssh.c index bca83198..eabd3361 100644 --- a/ssh.c +++ b/ssh.c @@ -573,7 +573,7 @@ static void ssh_closing(Plug *plug, const char *error_msg, int error_code, } } -static void ssh_receive(Plug *plug, int urgent, char *data, int len) +static void ssh_receive(Plug *plug, int urgent, const char *data, int len) { Ssh *ssh = container_of(plug, Ssh, plug); diff --git a/sshserver.c b/sshserver.c index f1bcd9a7..d89e3809 100644 --- a/sshserver.c +++ b/sshserver.c @@ -133,7 +133,7 @@ static void server_closing(Plug *plug, const char *error_msg, int error_code, } } -static void server_receive(Plug *plug, int urgent, char *data, int len) +static void server_receive(Plug *plug, int urgent, const char *data, int len) { server *srv = container_of(plug, server, plug); diff --git a/sshshare.c b/sshshare.c index f10a29d6..89b57536 100644 --- a/sshshare.c +++ b/sshshare.c @@ -1754,7 +1754,7 @@ static void share_got_pkt_from_downstream(struct ssh_sharing_connstate *cs, (c) = (unsigned char)*data++; \ } while (0) -static void share_receive(Plug *plug, int urgent, char *data, int len) +static void share_receive(Plug *plug, int urgent, const char *data, int len) { ssh_sharing_connstate *cs = container_of( plug, ssh_sharing_connstate, plug); diff --git a/telnet.c b/telnet.c index ae85a4d2..8fb0f572 100644 --- a/telnet.c +++ b/telnet.c @@ -506,7 +506,7 @@ static void process_subneg(Telnet *telnet) } } -static void do_telnet_read(Telnet *telnet, char *buf, int len) +static void do_telnet_read(Telnet *telnet, const char *buf, int len) { strbuf *outbuf = strbuf_new(); @@ -654,7 +654,7 @@ static void telnet_closing(Plug *plug, const char *error_msg, int error_code, /* Otherwise, the remote side closed the connection normally. */ } -static void telnet_receive(Plug *plug, int urgent, char *data, int len) +static void telnet_receive(Plug *plug, int urgent, const char *data, int len) { Telnet *telnet = container_of(plug, Telnet, plug); if (urgent) diff --git a/unix/uxpgnt.c b/unix/uxpgnt.c index 14e4b51b..193a7dee 100644 --- a/unix/uxpgnt.c +++ b/unix/uxpgnt.c @@ -155,7 +155,7 @@ void chan_no_request_response(Channel *chan, bool success) {} */ static void x11_log(Plug *p, int type, SockAddr *addr, int port, const char *error_msg, int error_code) {} -static void x11_receive(Plug *plug, int urgent, char *data, int len) {} +static void x11_receive(Plug *plug, int urgent, const char *data, int len) {} static void x11_sent(Plug *plug, int bufsize) {} static void x11_closing(Plug *plug, const char *error_msg, int error_code, bool calling_back) diff --git a/windows/winhsock.c b/windows/winhsock.c index 71f2c188..a50989a8 100644 --- a/windows/winhsock.c +++ b/windows/winhsock.c @@ -45,7 +45,7 @@ typedef struct HandleSocket { Socket sock; } HandleSocket; -static int handle_gotdata(struct handle *h, void *data, int len) +static int handle_gotdata(struct handle *h, const void *data, int len) { HandleSocket *hs = (HandleSocket *)handle_get_privdata(h); @@ -79,7 +79,7 @@ static int handle_gotdata(struct handle *h, void *data, int len) } } -static int handle_stderr(struct handle *h, void *data, int len) +static int handle_stderr(struct handle *h, const void *data, int len) { HandleSocket *hs = (HandleSocket *)handle_get_privdata(h); diff --git a/windows/winplink.c b/windows/winplink.c index cbfdeaff..46e2afa3 100644 --- a/windows/winplink.c +++ b/windows/winplink.c @@ -205,7 +205,7 @@ char *do_select(SOCKET skt, bool startup) return NULL; } -int stdin_gotdata(struct handle *h, void *data, int len) +int stdin_gotdata(struct handle *h, const void *data, int len) { if (len < 0) { /* diff --git a/windows/winser.c b/windows/winser.c index 24c8902b..1d86006a 100644 --- a/windows/winser.c +++ b/windows/winser.c @@ -40,7 +40,7 @@ static void serial_terminate(Serial *serial) } } -static int serial_gotdata(struct handle *h, void *data, int len) +static int serial_gotdata(struct handle *h, const void *data, int len) { Serial *serial = (Serial *)handle_get_privdata(h); if (len <= 0) { diff --git a/windows/winstuff.h b/windows/winstuff.h index 5fcaf79a..617aa969 100644 --- a/windows/winstuff.h +++ b/windows/winstuff.h @@ -603,7 +603,7 @@ void init_ucs(Conf *, struct unicode_data *); #define HANDLE_FLAG_IGNOREEOF 2 #define HANDLE_FLAG_UNITBUFFER 4 struct handle; -typedef int (*handle_inputfn_t)(struct handle *h, void *data, int len); +typedef int (*handle_inputfn_t)(struct handle *h, const void *data, int len); typedef void (*handle_outputfn_t)(struct handle *h, int new_backlog); struct handle *handle_input_new(HANDLE handle, handle_inputfn_t gotdata, void *privdata, int flags); diff --git a/x11fwd.c b/x11fwd.c index af39c35a..d06e0869 100644 --- a/x11fwd.c +++ b/x11fwd.c @@ -726,7 +726,7 @@ static void x11_closing(Plug *plug, const char *error_msg, int error_code, } } -static void x11_receive(Plug *plug, int urgent, char *data, int len) +static void x11_receive(Plug *plug, int urgent, const char *data, int len) { struct X11Connection *xconn = container_of( plug, struct X11Connection, plug);