1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-04-10 15:48:06 -05:00

MacTCP returns canonical names with a trailing dot. We don't want this, so

strip it off.

[originally from svn r2612]
This commit is contained in:
Ben Harris 2003-01-15 18:47:41 +00:00
parent 7b70ed6205
commit c6920b01c4

View File

@ -276,6 +276,7 @@ SockAddr mactcp_namelookup(char const *host, char **canonicalname)
OSErr err;
volatile int done = FALSE;
char *realhost;
int realhostlen;
/* Clear the structure. */
memset(ret, 0, sizeof(struct SockAddr_tag));
@ -293,9 +294,13 @@ SockAddr mactcp_namelookup(char const *host, char **canonicalname)
continue;
ret->resolved = TRUE;
if (ret->hostinfo.rtnCode == noErr)
if (ret->hostinfo.rtnCode == noErr) {
realhost = ret->hostinfo.cname;
else
/* MacTCP puts trailing dots on canonical names. */
realhostlen = strlen(realhost);
if (realhost[realhostlen - 1] == '.')
realhost[realhostlen - 1] = '\0';
} else
realhost = "";
*canonicalname = smalloc(1+strlen(realhost));
strcpy(*canonicalname, realhost);