X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=utils%2Fmountd%2Fauth.c;h=98c3944767767744091db7954824643b6a73d1bc;hp=afa2292888088afdd572661ce9b65d5c6e21f1c0;hb=08f6b0ea56f96eac00b092c7d5e1f6486eb6f457;hpb=1bae64b1475e9c1458582f26aa0e837edc4c6aca diff --git a/utils/mountd/auth.c b/utils/mountd/auth.c index afa2292..98c3944 100644 --- a/utils/mountd/auth.c +++ b/utils/mountd/auth.c @@ -16,6 +16,7 @@ #include "nfslib.h" #include "exportfs.h" #include "mountd.h" +#include "xmalloc.h" enum auth_error { @@ -83,9 +84,14 @@ auth_authenticate_internal(char *what, struct sockaddr_in *caller, else { /* must make sure the hostent is authorative. */ char **sp; - struct hostent *forward; + struct hostent *forward = NULL; + char *tmpname; - forward = gethostbyname((*hpp)->h_name); + tmpname = xstrdup((*hpp)->h_name); + if (tmpname) { + forward = gethostbyname(tmpname); + free(tmpname); + } if (forward) { /* now make sure the "addr" is in the list */ for (sp = forward->h_addr_list ; *sp ; sp++) {