From c69020c28de49ab71da0389199c45d104f170656 Mon Sep 17 00:00:00 2001 From: neilbrown Date: Thu, 20 Dec 2001 03:09:14 +0000 Subject: [PATCH 1/1] see changelog --- ChangeLog | 6 ++++++ support/export/client.c | 11 ++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 451a783..bdd0917 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2001-12-20 NeilBrown + + * support/export/client.c(client_lookup): If a host has multiple + IP addresses, then we must always use the result of a + gethostbyname, not that of gethostbyaddr for exporting + 2001-12-20 NeilBrown * support/export/client.c (client_lookup): use strcasecmp when diff --git a/support/export/client.c b/support/export/client.c index 03f7917..6d5d306 100644 --- a/support/export/client.c +++ b/support/export/client.c @@ -57,8 +57,17 @@ client_lookup(char *hname, int canonical) hp = gethostbyaddr(hp2->h_addr, hp2->h_length, hp2->h_addrtype); if (hp) { - free(hp2); hp = hostent_dup(hp); + /* but now we might not have all addresses... */ + if (hp2->h_addr_list[1]) { + struct hostent *hp3 = + gethostbyname(hp->h_name); + if (hp3) { + free(hp); + hp = hostent_dup(hp3); + } + } + free(hp2); } else hp = hp2; -- 2.39.2