+/*
+ * Telnet backend.
+ */
+
#include <stdio.h>
#include <stdlib.h>
}
/*
* If we reach here, the option was one we weren't prepared to
- * cope with. So send a negative ack.
+ * cope with. If the request was positive (WILL or DO), we send
+ * a negative ack to indicate refusal. If the request was
+ * negative (WONT / DONT), we must do nothing.
*/
- send_opt(telnet, (cmd == WILL ? DONT : WONT), option);
+ if (cmd == WILL || cmd == DO)
+ send_opt(telnet, (cmd == WILL ? DONT : WONT), option);
}
static void process_subneg(Telnet telnet)
return specials;
}
-static Socket telnet_socket(void *handle)
+static int telnet_connected(void *handle)
{
Telnet telnet = (Telnet) handle;
- return telnet->s;
+ return telnet->s != NULL;
}
static int telnet_sendok(void *handle)
telnet_size,
telnet_special,
telnet_get_specials,
- telnet_socket,
+ telnet_connected,
telnet_exitcode,
telnet_sendok,
telnet_ldisc,