MFC rev 1.6:
When removing the local domain, only do so when the result will be a host name. This is matches the documented behaviro. The previous behavior would remove the domain name even if the result retained a dot. This fixes rsh connections from a.example.com to example.com. This is also reported to fix rsh connections from host xxx to yyy.example.com. PR: 88301
This commit is contained in:
parent
2f3fb440a3
commit
f3e6c8a71c
@ -75,18 +75,16 @@ trimdomain(char *fullhost, int hostsize)
|
|||||||
|
|
||||||
s = fullhost;
|
s = fullhost;
|
||||||
end = s + hostsize + 1;
|
end = s + hostsize + 1;
|
||||||
for (; (s = memchr(s, '.', (size_t)(end - s))) != NULL; s++) {
|
if ((s = memchr(s, '.', (size_t)(end - s))) != NULL) {
|
||||||
if (strncasecmp(s + 1, domain, dlen) == 0) {
|
if (strncasecmp(s + 1, domain, dlen) == 0) {
|
||||||
if (s[dlen + 1] == '\0') {
|
if (s[dlen + 1] == '\0') {
|
||||||
/* Found -- lose the domain. */
|
/* Found -- lose the domain. */
|
||||||
*s = '\0';
|
*s = '\0';
|
||||||
break;
|
|
||||||
} else if (s[dlen + 1] == ':' &&
|
} else if (s[dlen + 1] == ':' &&
|
||||||
isDISP(s + dlen + 2) &&
|
isDISP(s + dlen + 2) &&
|
||||||
(len = strlen(s + dlen + 1)) < (size_t)(end - s)) {
|
(len = strlen(s + dlen + 1)) < (size_t)(end - s)) {
|
||||||
/* Found -- shuffle the DISPLAY back. */
|
/* Found -- shuffle the DISPLAY back. */
|
||||||
memmove(s, s + dlen + 1, len + 1);
|
memmove(s, s + dlen + 1, len + 1);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user