View | Details | Raw Unified | Return to bug 2257 | Differences between
and this patch

Collapse All | Expand All

(-)a/canohost.c (-11 / +18 lines)
Lines 321-326 clear_cached_addr(void) Link Here
321
	cached_port = -1;
321
	cached_port = -1;
322
}
322
}
323
323
324
void set_remote_ipaddr(void) {
325
	if (canonical_host_ip != NULL)
326
		free(canonical_host_ip);
327
328
	if (packet_connection_is_on_socket()) {
329
		canonical_host_ip =
330
		    get_peer_ipaddr(packet_get_connection_in());
331
		if (canonical_host_ip == NULL)
332
			cleanup_exit(255);
333
	} else {
334
		/* If not on socket, return UNKNOWN. */
335
		canonical_host_ip = xstrdup("UNKNOWN");
336
	}
337
}
338
324
/*
339
/*
325
 * Returns the IP-address of the remote host as a string.  The returned
340
 * Returns the IP-address of the remote host as a string.  The returned
326
 * string must not be freed.
341
 * string must not be freed.
Lines 330-346 const char * Link Here
330
get_remote_ipaddr(void)
345
get_remote_ipaddr(void)
331
{
346
{
332
	/* Check whether we have cached the ipaddr. */
347
	/* Check whether we have cached the ipaddr. */
333
	if (canonical_host_ip == NULL) {
348
	if (canonical_host_ip == NULL)
334
		if (packet_connection_is_on_socket()) {
349
		set_remote_ipaddr();
335
			canonical_host_ip =
350
336
			    get_peer_ipaddr(packet_get_connection_in());
337
			if (canonical_host_ip == NULL)
338
				cleanup_exit(255);
339
		} else {
340
			/* If not on socket, return UNKNOWN. */
341
			canonical_host_ip = xstrdup("UNKNOWN");
342
		}
343
	}
344
	return canonical_host_ip;
351
	return canonical_host_ip;
345
}
352
}
346
353
(-)a/canohost.h (+1 lines)
Lines 13-18 Link Here
13
 */
13
 */
14
14
15
const char	*get_canonical_hostname(int);
15
const char	*get_canonical_hostname(int);
16
void		 set_remote_ipaddr(void);
16
const char	*get_remote_ipaddr(void);
17
const char	*get_remote_ipaddr(void);
17
const char	*get_remote_name_or_ip(u_int, int);
18
const char	*get_remote_name_or_ip(u_int, int);
18
19
(-)a/sshconnect.c (+3 lines)
Lines 62-67 Link Here
62
#include "monitor_fdpass.h"
62
#include "monitor_fdpass.h"
63
#include "ssh2.h"
63
#include "ssh2.h"
64
#include "version.h"
64
#include "version.h"
65
#include "canohost.h"
65
66
66
char *client_version_string = NULL;
67
char *client_version_string = NULL;
67
char *server_version_string = NULL;
68
char *server_version_string = NULL;
Lines 171-176 ssh_proxy_fdpass_connect(const char *host, u_short port, Link Here
171
172
172
	/* Set the connection file descriptors. */
173
	/* Set the connection file descriptors. */
173
	packet_set_connection(sock, sock);
174
	packet_set_connection(sock, sock);
175
	set_remote_ipaddr();
174
176
175
	return 0;
177
	return 0;
176
}
178
}
Lines 493-498 ssh_connect_direct(const char *host, struct addrinfo *aitop, Link Here
493
495
494
	/* Set the connection. */
496
	/* Set the connection. */
495
	packet_set_connection(sock, sock);
497
	packet_set_connection(sock, sock);
498
	set_remote_ipaddr();
496
499
497
	return 0;
500
	return 0;
498
}
501
}

Return to bug 2257