X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/7555d6a50b05d96de39b5e95cf11a8f05f0c4fd9..881da16842e210236b12a040a19bf480de3a5a92:/rlogin.c diff --git a/rlogin.c b/rlogin.c index a6dad0e4..c9e7c5ec 100644 --- a/rlogin.c +++ b/rlogin.c @@ -1,3 +1,7 @@ +/* + * Rlogin backend. + */ + #include #include #include @@ -20,6 +24,7 @@ typedef struct rlogin_tag { Socket s; int bufsize; int firstbyte; + int cansize; int term_width, term_height; void *frontend; } *Rlogin; @@ -73,8 +78,10 @@ static int rlogin_receive(Plug plug, int urgent, char *data, int len) c = *data++; len--; - if (c == '\x80') + if (c == '\x80') { + rlogin->cansize = 1; rlogin_size(rlogin, rlogin->term_width, rlogin->term_height); + } /* * We should flush everything (aka Telnet SYNCH) if we see * 0x02, and we should turn off and on _local_ flow control @@ -136,6 +143,7 @@ static const char *rlogin_init(void *frontend_handle, void **backend_handle, rlogin->term_width = cfg->width; rlogin->term_height = cfg->height; rlogin->firstbyte = 1; + rlogin->cansize = 0; *backend_handle = rlogin; /* @@ -189,6 +197,22 @@ static const char *rlogin_init(void *frontend_handle, void **backend_handle, rlogin->bufsize = sk_write(rlogin->s, &z, 1); } + if (*cfg->loghost) { + char *colon; + + sfree(*realhost); + *realhost = dupstr(cfg->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++ = '\0'; + } + } + return NULL; } @@ -243,7 +267,7 @@ static void rlogin_size(void *handle, int width, int height) rlogin->term_width = width; rlogin->term_height = height; - if (rlogin->s == NULL) + if (rlogin->s == NULL || !rlogin->cansize) return; b[6] = rlogin->term_width >> 8; @@ -272,10 +296,10 @@ static const struct telnet_special *rlogin_get_specials(void *handle) return NULL; } -static Socket rlogin_socket(void *handle) +static int rlogin_connected(void *handle) { Rlogin rlogin = (Rlogin) handle; - return rlogin->s; + return rlogin->s != NULL; } static int rlogin_sendok(void *handle) @@ -333,7 +357,7 @@ Backend rlogin_backend = { rlogin_size, rlogin_special, rlogin_get_specials, - rlogin_socket, + rlogin_connected, rlogin_exitcode, rlogin_sendok, rlogin_ldisc, @@ -341,5 +365,7 @@ Backend rlogin_backend = { rlogin_provide_logctx, rlogin_unthrottle, rlogin_cfg_info, - 1 + "rlogin", + PROT_RLOGIN, + 513 };