This patch should fix your problem. Please give it a try and let me
know what you get. Thanks.
-- H.J. Lu (hjl@gnu.org)--- Index: support/export/hostname.c =================================================================== RCS file: /home/work/cvs/linux/knfsd/support/export/hostname.c,v retrieving revision 1.2 diff -u -r1.2 hostname.c --- hostname.c 1998/09/23 01:45:58 1.2 +++ hostname.c 1998/10/28 05:35:55 @@ -99,21 +99,42 @@ int matchhostname (const char *h1, const char *h2) { - struct hostent *hp; - char *name; + struct hostent *hp1, *hp2; + int status; if (strcasecmp (h1, h2) == 0) return 1; - hp = gethostbyname (h1); - if (hp == NULL) + hp1 = gethostbyname (h1); + if (hp1 == NULL) return 0; - name = alloca (strlen (hp->h_name) + 1); - strcpy (name, hp->h_name); + hp1 = hostent_dup (hp1); - hp = gethostbyname (h2); - return hp && strcasecmp (name, hp->h_name) == 0; + hp2 = gethostbyname (h2); + if (hp2) + { + if (strcasecmp (hp1->h_name, hp2->h_name) == 0) + status = 1; + else + { + char **ap1, **ap2; + + status = 0; + for (ap1 = hp1->h_addr_list; *ap1 && status == 0; *ap1++) + for (ap2 = hp2->h_addr_list; *ap2; *ap2++) + if (memcmp (*ap1, *ap2, sizeof (struct in_addr)) == 0) + { + status = 1; + break; + } + } + } + else + status = 0; + + free (hp1); + return status; } #ifdef TEST @@ -150,6 +171,8 @@ print_host (cp); free (cp); } + printf ("127.0.0.1 == %s: %d\n", argv [1], + matchhostname ("127.0.0.1", argv [1])); return 0; } #endif- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/