Bugzilla – Attachment 2456 Details for
Bug 2256
ssh - Connection closed by UNKNOWN
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
add set_remote_ipaddr()
set_remote_ipaddr.patch (text/plain), 2.10 KB, created by
Petr Lautrbach
on 2014-07-18 14:30:38 AEST
(
hide
)
Description:
add set_remote_ipaddr()
Filename:
MIME Type:
Creator:
Petr Lautrbach
Created:
2014-07-18 14:30:38 AEST
Size:
2.10 KB
patch
obsolete
>diff --git a/canohost.c b/canohost.c >index a61a8c9..0114da6 100644 >--- a/canohost.c >+++ b/canohost.c >@@ -321,6 +321,21 @@ clear_cached_addr(void) > cached_port = -1; > } > >+void set_remote_ipaddr(void) { >+ if (canonical_host_ip != NULL) >+ free(canonical_host_ip); >+ >+ if (packet_connection_is_on_socket()) { >+ canonical_host_ip = >+ get_peer_ipaddr(packet_get_connection_in()); >+ if (canonical_host_ip == NULL) >+ cleanup_exit(255); >+ } else { >+ /* If not on socket, return UNKNOWN. */ >+ canonical_host_ip = xstrdup("UNKNOWN"); >+ } >+} >+ > /* > * Returns the IP-address of the remote host as a string. The returned > * string must not be freed. >@@ -330,17 +345,9 @@ const char * > get_remote_ipaddr(void) > { > /* Check whether we have cached the ipaddr. */ >- if (canonical_host_ip == NULL) { >- if (packet_connection_is_on_socket()) { >- canonical_host_ip = >- get_peer_ipaddr(packet_get_connection_in()); >- if (canonical_host_ip == NULL) >- cleanup_exit(255); >- } else { >- /* If not on socket, return UNKNOWN. */ >- canonical_host_ip = xstrdup("UNKNOWN"); >- } >- } >+ if (canonical_host_ip == NULL) >+ set_remote_ipaddr(); >+ > return canonical_host_ip; > } > >diff --git a/canohost.h b/canohost.h >index 4c8636f..4079953 100644 >--- a/canohost.h >+++ b/canohost.h >@@ -13,6 +13,7 @@ > */ > > const char *get_canonical_hostname(int); >+void set_remote_ipaddr(void); > const char *get_remote_ipaddr(void); > const char *get_remote_name_or_ip(u_int, int); > >diff --git a/sshconnect.c b/sshconnect.c >index 799c8d0..08886ac 100644 >--- 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,7 @@ ssh_proxy_fdpass_connect(const char *host, u_short port, > > /* Set the connection file descriptors. */ > packet_set_connection(sock, sock); >+ set_remote_ipaddr(); > > return 0; > } >@@ -493,6 +495,7 @@ ssh_connect_direct(const char *host, struct addrinfo *aitop, > > /* Set the connection. */ > packet_set_connection(sock, sock); >+ set_remote_ipaddr(); > > return 0; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 2256
: 2456