Sshd writes connected host into utmp directly. If the connection is
via IPv6, the hostname is trimed due to the length of IPv6 address. This change saves it as possible. I have a grudge against the shortage of UT_HOSTSIZE.
This commit is contained in:
parent
0fc3455bb5
commit
3f52ad52cc
@ -131,13 +131,20 @@ realhostname_sa(char *host, size_t hsize, struct sockaddr *addr, int addrlen)
|
||||
freeaddrinfo(ores);
|
||||
goto numeric;
|
||||
}
|
||||
if (strlen(ores->ai_canonname) > hsize &&
|
||||
addr->sa_family == AF_INET) {
|
||||
freeaddrinfo(ores);
|
||||
goto numeric;
|
||||
}
|
||||
strncpy(host, ores->ai_canonname,
|
||||
hsize);
|
||||
if (strlen(ores->ai_canonname) > hsize) {
|
||||
if (addr->sa_family == AF_INET) {
|
||||
freeaddrinfo(ores);
|
||||
goto numeric;
|
||||
}
|
||||
strncpy(buf,
|
||||
ores->ai_canonname,
|
||||
sizeof(buf));
|
||||
trimdomain(buf, hsize);
|
||||
strncpy(host, buf, hsize);
|
||||
} else
|
||||
strncpy(host,
|
||||
ores->ai_canonname,
|
||||
hsize);
|
||||
break;
|
||||
}
|
||||
((struct sockinet *)addr)->si_port = port;
|
||||
|
Loading…
Reference in New Issue
Block a user