]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - utils/mountd/auth.c
* utils/mountd/auth.c (auth_authenticate_internal): Reverse
[nfs-utils.git] / utils / mountd / auth.c
index 6b6b7d74cf4fb1afe788b5055e303dde627f54a8..d88c46f31b52563827aac1aedfe5703e7fbc182f 100644 (file)
@@ -78,20 +78,10 @@ auth_authenticate_internal(char *what, struct sockaddr_in *caller,
        }
        auth_fixpath(path);
 
-       /* First try it w/o doing a hostname lookup... */
-       *hpp = get_hostent((const char *)&addr, sizeof(addr), AF_INET);
-       exp = export_find(*hpp, path);
-
-       if (!exp) {
-           /* Ok, that didn't fly.  Try it with a reverse lookup. */
-           free (*hpp);
-           *hpp = gethostbyaddr((const char *)&addr, sizeof(addr),
-                                AF_INET);
-           if (!(*hpp)) {
-               *error = no_entry;
-               *hpp = get_hostent((const char *)&addr, sizeof(addr), AF_INET);
-               return NULL;
-           } else {
+       if (!(*hpp = gethostbyaddr((const char *)&addr, sizeof(addr), AF_INET)))
+               *hpp = get_hostent((const char *)&addr, sizeof(addr),
+                                  AF_INET);
+       else {
                /* must make sure the hostent is authorative. */
                char **sp;
                struct hostent *forward = NULL;
@@ -123,14 +113,12 @@ auth_authenticate_internal(char *what, struct sockaddr_in *caller,
                        *error = no_forward_dns;
                        return NULL;
                }
-           }
+       }
 
-           if (!(exp = export_find(*hpp, path))) {
+       if (!(exp = export_find(*hpp, path))) {
                *error = no_entry;
                return NULL;
-           }
        }
-
        if (!exp->m_mayexport) {
                *error = not_exported;
                return NULL;