Integrate unfix.org's IPv6 patches up to level 10, with rather a lot
[u/mdw/putty] / rlogin.c
index af3bd87..29d7be5 100644 (file)
--- a/rlogin.c
+++ b/rlogin.c
@@ -39,6 +39,7 @@ static int rlogin_closing(Plug plug, const char *error_msg, int error_code,
     if (rlogin->s) {
         sk_close(rlogin->s);
         rlogin->s = NULL;
+       notify_remote_exit(rlogin->frontend);
     }
     if (error_msg) {
        /* A socket error has occurred. */
@@ -100,7 +101,7 @@ static void rlogin_sent(Plug plug, int bufsize)
 static const char *rlogin_init(void *frontend_handle, void **backend_handle,
                               Config *cfg,
                               char *host, int port, char **realhost,
-                              int nodelay)
+                              int nodelay, int keepalive)
 {
     static const struct plug_function_table fn_table = {
        rlogin_closing,
@@ -125,11 +126,14 @@ static const char *rlogin_init(void *frontend_handle, void **backend_handle,
      */
     {
        char *buf;
-       buf = dupprintf("Looking up host \"%s\"", host);
+       buf = dupprintf("Looking up host \"%s\"%s", host,
+                       (cfg->addressfamily == ADDRTYPE_IPV4 ? " (IPv4)" :
+                        (cfg->addressfamily == ADDRTYPE_IPV6 ? " (IPv6)" :
+                         "")));
        logevent(rlogin->frontend, buf);
        sfree(buf);
     }
-    addr = name_lookup(host, port, realhost, cfg);
+    addr = name_lookup(host, port, realhost, cfg, cfg->addressfamily);
     if ((err = sk_addr_error(addr)) != NULL) {
        sk_addr_free(addr);
        return err;
@@ -149,7 +153,7 @@ static const char *rlogin_init(void *frontend_handle, void **backend_handle,
        sfree(buf);
     }
     rlogin->s = new_connection(addr, *realhost, port, 1, 0,
-                              nodelay, (Plug) rlogin, cfg);
+                              nodelay, keepalive, (Plug) rlogin, cfg);
     if ((err = sk_socket_error(rlogin->s)) != NULL)
        return err;
 
@@ -302,6 +306,14 @@ static int rlogin_exitcode(void *handle)
         return 0;
 }
 
+/*
+ * cfg_info for rlogin does nothing at all.
+ */
+static int rlogin_cfg_info(void *handle)
+{
+    return 0;
+}
+
 Backend rlogin_backend = {
     rlogin_init,
     rlogin_free,
@@ -318,5 +330,6 @@ Backend rlogin_backend = {
     rlogin_provide_ldisc,
     rlogin_provide_logctx,
     rlogin_unthrottle,
+    rlogin_cfg_info,
     1
 };