Changeset View
Changeset View
Standalone View
Standalone View
security/openssh-portable/files/patch-ssh.c
--- UTC | --- ssh.c.orig 2018-04-02 05:38:28 UTC | ||||
r99054 | des | 2002-06-29 05:57:53 -0500 (Sat, 29 Jun 2002) | 4 lines | +++ ssh.c | ||||
Changed paths: | @@ -1281,6 +1281,23 @@ main(int ac, char **av) | ||||
M /head/crypto/openssh/ssh.c | ssh_digest_free(md); | ||||
conn_hash_hex = tohex(conn_hash, ssh_digest_bytes(SSH_DIGEST_SHA1)); | |||||
Canonicize the host name before looking it up in the host file. | |||||
--- ssh.c.orig 2010-08-16 09:59:31.000000000 -0600 | |||||
+++ ssh.c 2010-08-25 17:55:01.000000000 -0600 | |||||
@@ -699,6 +699,23 @@ | |||||
"h", host, (char *)NULL); | |||||
} | |||||
+ /* Find canonic host name. */ | + /* Find canonic host name. */ | ||||
+ if (strchr(host, '.') == 0) { | + if (strchr(host, '.') == 0) { | ||||
+ struct addrinfo hints; | + struct addrinfo hints; | ||||
+ struct addrinfo *ai = NULL; | + struct addrinfo *ai = NULL; | ||||
+ int errgai; | + int errgai; | ||||
+ memset(&hints, 0, sizeof(hints)); | + memset(&hints, 0, sizeof(hints)); | ||||
+ hints.ai_family = options.address_family; | + hints.ai_family = options.address_family; | ||||
+ hints.ai_flags = AI_CANONNAME; | + hints.ai_flags = AI_CANONNAME; | ||||
+ hints.ai_socktype = SOCK_STREAM; | + hints.ai_socktype = SOCK_STREAM; | ||||
+ errgai = getaddrinfo(host, NULL, &hints, &ai); | + errgai = getaddrinfo(host, NULL, &hints, &ai); | ||||
+ if (errgai == 0) { | + if (errgai == 0) { | ||||
+ if (ai->ai_canonname != NULL) | + if (ai->ai_canonname != NULL) | ||||
+ host = xstrdup(ai->ai_canonname); | + host = xstrdup(ai->ai_canonname); | ||||
+ freeaddrinfo(ai); | + freeaddrinfo(ai); | ||||
+ } | + } | ||||
+ } | + } | ||||
+ | + | ||||
if (options.local_command != NULL) { | /* | ||||
char thishost[NI_MAXHOST]; | * Expand tokens in arguments. NB. LocalCommand is expanded later, | ||||
* after port-forwarding is set up, so it may pick up any local |