ssh - Connection closed by UNKNOWN

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

 



Hi,

ssh clients shows "closed by UNKNOWN" message when a socket is closed by a
remote side while ssh is waiting for user's password:

$ ssh user@localhost
user@localhost's password: 
Connection closed by UNKNOWN

When the packet_read_seqnr() calls get_remote_ipaddr(), a connection's
socket is already closed and there's not been any other call of this function
yet so canonical_host_ip from canohost.c is still NULL and the function
returns "UNKNOWN". I think that it could be workarounded by calling get_remote_ipaddr() right
after packet_set_connection(), e.g. using another debug message, see bellow, or
there could be set_remote_ipaddr() in canonhost.c for that.

--- a/sshconnect.c
+++ b/sshconnect.c
@@ -62,6 +62,7 @@
 #include "monitor_fdpass.h"
 #include "ssh2.h"
 #include "version.h"
+#include "canohost.h"
 
 char *client_version_string = NULL;
 char *server_version_string = NULL;
@@ -171,6 +172,8 @@ ssh_proxy_fdpass_connect(const char *host, u_short port,
 
        /* Set the connection file descriptors. */
        packet_set_connection(sock, sock);
+       debug("Connected to %.200s [%.100s] port %d.",
+           host, get_remote_ipaddr(), get_remote_port());
 
        return 0;
 }
@@ -493,6 +496,8 @@ ssh_connect_direct(const char *host, struct addrinfo *aitop
 
        /* Set the connection. */
        packet_set_connection(sock, sock);
+       debug("Connected to %.200s [%.100s] port %d.",
+           host, get_remote_ipaddr(), get_remote_port());
 
        return 0;
 }

_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@xxxxxxxxxxx
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev




[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux