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

Collapse All | Expand All

(-)ssh.c (+23 lines)
Lines 394-399 process_config_files(struct passwd *pw) Link Here
394
	}
394
	}
395
}
395
}
396
396
397
/* Rewrite the port number in an addrinfo list of addresses */
398
static void
399
set_addrinfo_port(struct addrinfo *addrs, int port)
400
{
401
	struct addrinfo *addr;
402
403
	for (addr = addrs; addr != NULL; addr = addr->ai_next) {
404
		switch (addr->ai_family) {
405
		case AF_INET:
406
			((struct sockaddr_in *)addr->ai_addr)->
407
			    sin_port = htons(port);
408
			break;
409
		case AF_INET6:
410
			((struct sockaddr_in6 *)addr->ai_addr)->
411
			    sin6_port = htons(port);
412
			break;
413
		}
414
	}
415
}
416
397
/*
417
/*
398
 * Main program for the ssh client.
418
 * Main program for the ssh client.
399
 */
419
 */
Lines 922-927 main(int ac, char **av) Link Here
922
	if (strcasecmp(host_arg, host) != 0) {
942
	if (strcasecmp(host_arg, host) != 0) {
923
		debug("Hostname has changed; re-reading configuration");
943
		debug("Hostname has changed; re-reading configuration");
924
		process_config_files(pw);
944
		process_config_files(pw);
945
		/* Port number may have changed, so reset it in address list */
946
		if (addrs != NULL && options.port > 0)
947
			set_addrinfo_port(addrs, options.port);
925
	}
948
	}
926
949
927
	/* Fill configuration defaults. */
950
	/* Fill configuration defaults. */

Return to bug 2286