diff options
author | neilbrown <neilbrown> | 2001-09-20 00:10:49 +0000 |
---|---|---|
committer | neilbrown <neilbrown> | 2001-09-20 00:10:49 +0000 |
commit | 4d961554071d2308017062c8bc39f37f5de55b5f (patch) | |
tree | d7cff7e32ac200615806b085b2d9ce0deac52423 /support/export/client.c | |
parent | 8d53a2630763f8f639d2de2ddd26282bff1c7cad (diff) | |
download | nfs-utils-4d961554071d2308017062c8bc39f37f5de55b5f.tar.gz nfs-utils-4d961554071d2308017062c8bc39f37f5de55b5f.tar.xz nfs-utils-4d961554071d2308017062c8bc39f37f5de55b5f.zip |
call gethostbyaddr to make sure that we have canonical hostname
for all exports
Diffstat (limited to 'support/export/client.c')
-rw-r--r-- | support/export/client.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/support/export/client.c b/support/export/client.c index 1fd4269..076b0c0 100644 --- a/support/export/client.c +++ b/support/export/client.c @@ -42,12 +42,22 @@ client_lookup(char *hname) htype = client_gettype(hname); if (htype == MCL_FQDN) { + struct hostent *hp2; hp = gethostbyname(hname); if (hp == NULL || hp->h_addrtype != AF_INET) { xlog(L_ERROR, "%s has non-inet addr", hname); return NULL; } - hp = hostent_dup (hp); + /* make sure we have canonical name */ + hp2 = hostent_dup(hp); + hp = gethostbyaddr(hp2->h_addr, hp2->h_length, + hp2->h_addrtype); + if (hp) { + free(hp2); + hp = hostent_dup(hp); + } else + hp = hp2; + hname = (char *) hp->h_name; for (clp = clientlist[htype]; clp; clp = clp->m_next) { |