- if (path[0] != '/') {
- *error = bad_path;
- return NULL;
- }
- 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 {
- /* must make sure the hostent is authorative. */
- char **sp;
- struct hostent *forward = NULL;
- char *tmpname;
-
- *hpp = hostent_dup (*hpp);
- 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++) {
- if (memcmp(*sp, &addr, forward->h_length)==0)
- break;
- }
-
- if (!*sp) {
- /* it was a FAKE */
- *error = faked_hostent;
+ if (new_cache) {
+ int i;
+ /* return static nfs_export with details filled in */
+ if (my_client.m_naddr != 1 ||
+ my_client.m_addrlist[0].s_addr != caller->sin_addr.s_addr) {
+ /* different client to last time, so do a lookup */
+ char *n;
+ my_client.m_naddr = 0;
+ my_client.m_addrlist[0] = caller->sin_addr;
+ n = client_compose(caller->sin_addr);
+ *error = unknown_host;
+ if (!n)