]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
2000-08-02 H.J. Lu <hjl@lucon.org>
authorhjl <hjl>
Thu, 10 Aug 2000 03:02:40 +0000 (03:02 +0000)
committerhjl <hjl>
Thu, 10 Aug 2000 03:02:40 +0000 (03:02 +0000)
* utils/mountd/auth.c (auth_authenticate_internal): Try to
avoid the reverse name lookup.

ChangeLog
utils/mountd/auth.c

index 44bef0a5bb2292cac148b689d24551c38145e4c1..b56dd18ea60170d40ef1f4edc0d38f10282a5d14 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2000-08-02  H.J. Lu <hjl@lucon.org>
+
+       * utils/mountd/auth.c (auth_authenticate_internal): Try to
+       avoid the reverse name lookup.
+
 2000-07-04  H.J. Lu <hjl@lucon.org>
 
        * utils/statd/log.c: Include <stdlib.h> for exit ().
index 98c3944767767744091db7954824643b6a73d1bc..49567c93158b384a592ebed479a689c733dea593 100644 (file)
@@ -78,10 +78,19 @@ auth_authenticate_internal(char *what, struct sockaddr_in *caller,
        }
        auth_fixpath(path);
 
-       if (!(*hpp = gethostbyaddr((const char *)&addr, sizeof(addr), AF_INET)))
-               *hpp = get_hostent((const char *)&addr, sizeof(addr),
-                                  AF_INET);
-       else {
+       /* 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;
+               return NULL;
+           } else {
                /* must make sure the hostent is authorative. */
                char **sp;
                struct hostent *forward = NULL;
@@ -113,12 +122,14 @@ auth_authenticate_internal(char *what, struct sockaddr_in *caller,
                        *hpp = hostent_dup (*hpp);
                        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;