]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - utils/exportfs/exportfs.c
call gethostbyaddr to make sure that we have canonical hostname
[nfs-utils.git] / utils / exportfs / exportfs.c
index 050470987c8e8ec883715a9fd44033ed92816940..c012961871cd86bc4d96d9d4d992c986c47780a9 100644 (file)
@@ -228,7 +228,14 @@ exportfs(char *arg, char *options, int verbose)
 
        if ((htype = client_gettype(hname)) == MCL_FQDN &&
            (hp = gethostbyname(hname)) != NULL) {
-               hp = hostent_dup (hp);
+               struct hostent *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;
                exp = export_find(hp, path);
        } else {
                exp = export_lookup(hname, path);