Bugzilla – Attachment 3068 Details for
Bug 2763
Broken parsing of link-local addresses when interface contains upper-case letter
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
don't lowercase hostnames that look like addresses
bz2763.diff (text/plain), 1.29 KB, created by
Damien Miller
on 2017-10-20 11:55:04 AEDT
(
hide
)
Description:
don't lowercase hostnames that look like addresses
Filename:
MIME Type:
Creator:
Damien Miller
Created:
2017-10-20 11:55:04 AEDT
Size:
1.29 KB
patch
obsolete
>diff --git a/ssh.c b/ssh.c >index ae37432b..d9b0462d 100644 >--- a/ssh.c >+++ b/ssh.c >@@ -267,6 +267,32 @@ resolve_host(const char *name, int port, int logerr, char *cname, size_t clen) > return res; > } > >+/* Returns non-zero if name/port represents a single address */ >+static int >+is_addr(const char *name, int port) >+{ >+ char strport[NI_MAXSERV]; >+ struct addrinfo hints, *res; >+ int gaierr; >+ >+ if (port <= 0) >+ port = default_ssh_port(); >+ snprintf(strport, sizeof strport, "%u", port); >+ memset(&hints, 0, sizeof(hints)); >+ hints.ai_family = options.address_family == -1 ? >+ AF_UNSPEC : options.address_family; >+ hints.ai_socktype = SOCK_STREAM; >+ hints.ai_flags = AI_NUMERICHOST|AI_NUMERICSERV; >+ if ((gaierr = getaddrinfo(name, strport, &hints, &res)) != 0) >+ return 0; >+ if (res == NULL || res->ai_next != NULL) { >+ freeaddrinfo(res); >+ return 0; >+ } >+ freeaddrinfo(res); >+ return 1; >+} >+ > /* > * Attempt to resolve a numeric host address / port to a single address. > * Returns a canonical address string. >@@ -1027,7 +1053,8 @@ main(int ac, char **av) > } > > /* If canonicalization requested then try to apply it */ >- lowercase(host); >+ if (!is_addr(host, options.port)) >+ lowercase(host); > if (options.canonicalize_hostname != SSH_CANONICALISE_NO) > addrs = resolve_canonicalize(&host, options.port); >
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
Flags:
dtucker
:
ok+
Actions:
View
|
Diff
Attachments on
bug 2763
:
3068
|
3086