X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/putty/blobdiff_plain/86916870d36cb70e7ef0ea760e75a6ae8b2d83a5..347e5401f43649bf0f3e3eed57b11d02b2fdf8be:/telnet.c diff --git a/telnet.c b/telnet.c index 2d87b310..c45f20ff 100644 --- a/telnet.c +++ b/telnet.c @@ -72,6 +72,19 @@ #define TELOPT_AUTHENTICATION 37 /* Authenticate */ #define TELOPT_ENCRYPT 38 /* Encryption option */ #define TELOPT_NEW_ENVIRON 39 /* New - Environment variables */ +#define TELOPT_TN3270E 40 /* TN3270 enhancements */ +#define TELOPT_XAUTH 41 +#define TELOPT_CHARSET 42 /* Character set */ +#define TELOPT_RSP 43 /* Remote serial port */ +#define TELOPT_COM_PORT_OPTION 44 /* Com port control */ +#define TELOPT_SLE 45 /* Suppress local echo */ +#define TELOPT_STARTTLS 46 /* Start TLS */ +#define TELOPT_KERMIT 47 /* Automatic Kermit file transfer */ +#define TELOPT_SEND_URL 48 +#define TELOPT_FORWARD_X 49 +#define TELOPT_PRAGMA_LOGON 138 +#define TELOPT_SSPI_LOGON 139 +#define TELOPT_PRAGMA_HEARTBEAT 140 #define TELOPT_EXOPL 255 /* extended-options-list */ #define TELQUAL_IS 0 /* option is... */ @@ -132,6 +145,19 @@ static char *telopt(int opt) i(AUTHENTICATION); i(ENCRYPT); i(NEW_ENVIRON); + i(TN3270E); + i(XAUTH); + i(CHARSET); + i(RSP); + i(COM_PORT_OPTION); + i(SLE); + i(STARTTLS); + i(KERMIT); + i(SEND_URL); + i(FORWARD_X); + i(PRAGMA_LOGON); + i(SSPI_LOGON); + i(PRAGMA_HEARTBEAT); i(EXOPL); #undef i return ""; @@ -689,7 +715,7 @@ static char *telnet_init(void *frontend_handle, void **backend_handle, logevent(telnet->frontend, buf); sfree(buf); } - addr = name_lookup(host, port, realhost); + addr = name_lookup(host, port, realhost, &telnet->cfg); if ((err = sk_addr_error(addr)) != NULL) return err; @@ -707,7 +733,7 @@ static char *telnet_init(void *frontend_handle, void **backend_handle, sfree(buf); } telnet->s = new_connection(addr, *realhost, port, 0, 1, - nodelay, (Plug) telnet); + nodelay, (Plug) telnet, &telnet->cfg); if ((err = sk_socket_error(telnet->s)) != NULL) return err; @@ -740,6 +766,15 @@ static char *telnet_init(void *frontend_handle, void **backend_handle, return NULL; } +static void telnet_free(void *handle) +{ + Telnet telnet = (Telnet) handle; + + sfree(telnet->sb_buf); + if (telnet->s) + sk_close(telnet->s); + sfree(telnet); +} /* * Reconfigure the Telnet backend. There's no immediate action * necessary, in this backend: we just save the fresh config for @@ -758,10 +793,10 @@ static int telnet_send(void *handle, char *buf, int len) { Telnet telnet = (Telnet) handle; unsigned char *p, *end; - static unsigned char iac[2] = { IAC, IAC }; - static unsigned char cr[2] = { CR, NUL }; + static const unsigned char iac[2] = { IAC, IAC }; + static const unsigned char cr[2] = { CR, NUL }; #if 0 - static unsigned char nl[2] = { CR, LF }; + static const unsigned char nl[2] = { CR, LF }; #endif if (telnet->s == NULL) @@ -974,6 +1009,7 @@ static int telnet_exitcode(void *handle) Backend telnet_backend = { telnet_init, + telnet_free, telnet_reconfig, telnet_send, telnet_sendbuffer,