( (x) != IAC && \
(telnet->opt_states[o_we_bin.index] == ACTIVE || (x) != CR))
-static char *telopt(int opt)
+static const char *telopt(int opt)
{
#define telnet_str(x,y) case TELOPT_##x: return #x;
switch (opt) {
#define SB_DELTA 1024
-static void c_write(Telnet telnet, char *buf, int len)
+static void c_write(Telnet telnet, const char *buf, int len)
{
int backlog;
backlog = from_backend(telnet->frontend, 0, buf, len);
sk_set_frozen(telnet->s, backlog > TELNET_MAX_BACKLOG);
}
-static void log_option(Telnet telnet, char *sender, int cmd, int option)
+static void log_option(Telnet telnet, const char *sender, int cmd, int option)
{
char *buf;
/*
else if (o->option == TELOPT_SGA && o->send == DO)
telnet->editing = !enabled;
if (telnet->ldisc) /* cause ldisc to notice the change */
- ldisc_send(telnet->ldisc, NULL, 0, 0);
+ ldisc_echoedit_update(telnet->ldisc);
/* Ensure we get the minimum options */
if (!telnet->activated) {
msg = dupprintf("Failed to connect to %s: %s", addrbuf, error_msg);
logevent(telnet->frontend, msg);
+ sfree(msg);
}
static int telnet_closing(Plug plug, const char *error_msg, int error_code,
* freed by the caller.
*/
static const char *telnet_init(void *frontend_handle, void **backend_handle,
- Conf *conf, char *host, int port,
+ Conf *conf, const char *host, int port,
char **realhost, int nodelay, int keepalive)
{
static const struct plug_function_table fn_table = {
sfree(*realhost);
*realhost = dupstr(loghost);
- colon = strrchr(*realhost, ':');
- if (colon) {
- /*
- * FIXME: if we ever update this aspect of ssh.c for
- * IPv6 literal management, this should change in line
- * with it.
- */
+
+ colon = host_strrchr(*realhost, ':');
+ if (colon)
*colon++ = '\0';
- }
}
return NULL;
/*
* Called to send data down the Telnet connection.
*/
-static int telnet_send(void *handle, char *buf, int len)
+static int telnet_send(void *handle, const char *buf, int len)
{
Telnet telnet = (Telnet) handle;
unsigned char *p, *end;