|
Jakub Jelen |
132f8f |
diff -up openssh-6.8p1/canohost.c.set_remote_ipaddr openssh-6.8p1/canohost.c
|
|
Jakub Jelen |
132f8f |
--- openssh-6.8p1/canohost.c.set_remote_ipaddr 2015-03-18 12:40:03.702925550 +0100
|
|
Jakub Jelen |
132f8f |
+++ openssh-6.8p1/canohost.c 2015-03-18 12:40:03.749925432 +0100
|
|
Jakub Jelen |
132f8f |
@@ -349,6 +349,21 @@ clear_cached_addr(void)
|
|
Petr Lautrbach |
0a3f4e |
cached_port = -1;
|
|
Petr Lautrbach |
0a3f4e |
}
|
|
Petr Lautrbach |
0a3f4e |
|
|
Petr Lautrbach |
0a3f4e |
+void set_remote_ipaddr(void) {
|
|
Petr Lautrbach |
0a3f4e |
+ if (canonical_host_ip != NULL)
|
|
Petr Lautrbach |
0a3f4e |
+ free(canonical_host_ip);
|
|
Petr Lautrbach |
0a3f4e |
+
|
|
Jakub Jelen |
054365 |
+ if (active_state != NULL && packet_connection_is_on_socket()) {
|
|
Petr Lautrbach |
0a3f4e |
+ canonical_host_ip =
|
|
Petr Lautrbach |
0a3f4e |
+ get_peer_ipaddr(packet_get_connection_in());
|
|
Petr Lautrbach |
0a3f4e |
+ if (canonical_host_ip == NULL)
|
|
Petr Lautrbach |
0a3f4e |
+ cleanup_exit(255);
|
|
Petr Lautrbach |
0a3f4e |
+ } else {
|
|
Petr Lautrbach |
0a3f4e |
+ /* If not on socket, return UNKNOWN. */
|
|
Petr Lautrbach |
0a3f4e |
+ canonical_host_ip = xstrdup("UNKNOWN");
|
|
Petr Lautrbach |
0a3f4e |
+ }
|
|
Petr Lautrbach |
0a3f4e |
+}
|
|
Petr Lautrbach |
0a3f4e |
+
|
|
Petr Lautrbach |
0a3f4e |
/*
|
|
Petr Lautrbach |
0a3f4e |
* Returns the IP-address of the remote host as a string. The returned
|
|
Petr Lautrbach |
0a3f4e |
* string must not be freed.
|
|
Jakub Jelen |
132f8f |
@@ -358,17 +373,9 @@ const char *
|
|
Petr Lautrbach |
0a3f4e |
get_remote_ipaddr(void)
|
|
Petr Lautrbach |
0a3f4e |
{
|
|
Petr Lautrbach |
0a3f4e |
/* Check whether we have cached the ipaddr. */
|
|
Petr Lautrbach |
0a3f4e |
- if (canonical_host_ip == NULL) {
|
|
Petr Lautrbach |
0a3f4e |
- if (packet_connection_is_on_socket()) {
|
|
Petr Lautrbach |
0a3f4e |
- canonical_host_ip =
|
|
Petr Lautrbach |
0a3f4e |
- get_peer_ipaddr(packet_get_connection_in());
|
|
Petr Lautrbach |
0a3f4e |
- if (canonical_host_ip == NULL)
|
|
Petr Lautrbach |
0a3f4e |
- cleanup_exit(255);
|
|
Petr Lautrbach |
0a3f4e |
- } else {
|
|
Petr Lautrbach |
0a3f4e |
- /* If not on socket, return UNKNOWN. */
|
|
Petr Lautrbach |
0a3f4e |
- canonical_host_ip = xstrdup("UNKNOWN");
|
|
Petr Lautrbach |
0a3f4e |
- }
|
|
Petr Lautrbach |
0a3f4e |
- }
|
|
Petr Lautrbach |
0a3f4e |
+ if (canonical_host_ip == NULL)
|
|
Petr Lautrbach |
0a3f4e |
+ set_remote_ipaddr();
|
|
Petr Lautrbach |
0a3f4e |
+
|
|
Petr Lautrbach |
0a3f4e |
return canonical_host_ip;
|
|
Petr Lautrbach |
0a3f4e |
}
|
|
Petr Lautrbach |
0a3f4e |
|
|
Jakub Jelen |
132f8f |
diff -up openssh-6.8p1/canohost.h.set_remote_ipaddr openssh-6.8p1/canohost.h
|
|
Jakub Jelen |
132f8f |
--- openssh-6.8p1/canohost.h.set_remote_ipaddr 2015-03-17 06:49:20.000000000 +0100
|
|
Jakub Jelen |
132f8f |
+++ openssh-6.8p1/canohost.h 2015-03-18 12:40:03.749925432 +0100
|
|
Petr Lautrbach |
0a3f4e |
@@ -13,6 +13,7 @@
|
|
Petr Lautrbach |
0a3f4e |
*/
|
|
Petr Lautrbach |
0a3f4e |
|
|
Petr Lautrbach |
0a3f4e |
const char *get_canonical_hostname(int);
|
|
Petr Lautrbach |
0a3f4e |
+void set_remote_ipaddr(void);
|
|
Petr Lautrbach |
0a3f4e |
const char *get_remote_ipaddr(void);
|
|
Petr Lautrbach |
0a3f4e |
const char *get_remote_name_or_ip(u_int, int);
|
|
Petr Lautrbach |
0a3f4e |
|
|
Jakub Jelen |
132f8f |
diff -up openssh-6.8p1/sshconnect.c.set_remote_ipaddr openssh-6.8p1/sshconnect.c
|
|
Jakub Jelen |
132f8f |
--- openssh-6.8p1/sshconnect.c.set_remote_ipaddr 2015-03-17 06:49:20.000000000 +0100
|
|
Jakub Jelen |
132f8f |
+++ openssh-6.8p1/sshconnect.c 2015-03-18 12:40:58.096788804 +0100
|
|
Jakub Jelen |
132f8f |
@@ -65,6 +65,7 @@
|
|
Petr Lautrbach |
0a3f4e |
#include "version.h"
|
|
Jakub Jelen |
132f8f |
#include "authfile.h"
|
|
Jakub Jelen |
132f8f |
#include "ssherr.h"
|
|
Petr Lautrbach |
0a3f4e |
+#include "canohost.h"
|
|
Petr Lautrbach |
0a3f4e |
|
|
Petr Lautrbach |
0a3f4e |
char *client_version_string = NULL;
|
|
Petr Lautrbach |
0a3f4e |
char *server_version_string = NULL;
|
|
Jakub Jelen |
132f8f |
@@ -174,6 +175,7 @@ ssh_proxy_fdpass_connect(const char *hos
|
|
Petr Lautrbach |
0a3f4e |
|
|
Petr Lautrbach |
0a3f4e |
/* Set the connection file descriptors. */
|
|
Petr Lautrbach |
0a3f4e |
packet_set_connection(sock, sock);
|
|
Petr Lautrbach |
0a3f4e |
+ set_remote_ipaddr();
|
|
Petr Lautrbach |
0a3f4e |
|
|
Petr Lautrbach |
0a3f4e |
return 0;
|
|
Petr Lautrbach |
0a3f4e |
}
|
|
Jakub Jelen |
132f8f |
@@ -496,6 +498,7 @@ ssh_connect_direct(const char *host, str
|
|
Petr Lautrbach |
0a3f4e |
|
|
Petr Lautrbach |
0a3f4e |
/* Set the connection. */
|
|
Petr Lautrbach |
0a3f4e |
packet_set_connection(sock, sock);
|
|
Petr Lautrbach |
0a3f4e |
+ set_remote_ipaddr();
|
|
Petr Lautrbach |
0a3f4e |
|
|
Petr Lautrbach |
0a3f4e |
return 0;
|
|
Petr Lautrbach |
0a3f4e |
}
|