- }
- auth_fixpath(path);
-
- 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;
-
- forward = gethostbyname((*hpp)->h_name);
- 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;
- *hpp = hostent_dup (*hpp);
- return NULL;
- }
- *hpp = hostent_dup (forward);
+
+ my_client.m_naddr = 1;
+ my_client.m_addrlist[0] = caller->sin_addr;
+ my_exp.m_client = &my_client;
+
+ exp = NULL;
+ for (i = 0; !exp && i < MCL_MAXTYPES; i++)
+ for (exp = exportlist[i].p_head; exp; exp = exp->m_next) {
+ if (strcmp(path, exp->m_export.e_path))
+ continue;
+ if (!use_ipaddr && !client_member(my_client.m_hostname, exp->m_client->m_hostname))
+ continue;
+ if (use_ipaddr && !client_check(exp->m_client, hp))
+ continue;
+ break;
+ }
+ *error = not_exported;
+ if (!exp)
+ return NULL;
+
+ my_exp.m_export = exp->m_export;
+ exp = &my_exp;
+ return exp;
+}
+
+static nfs_export *
+auth_authenticate_internal(char *what, struct sockaddr_in *caller,
+ char *path, struct hostent *hp,
+ enum auth_error *error)
+{
+ nfs_export *exp;
+
+ if (new_cache) {
+ exp = auth_authenticate_newcache(what, caller, path, hp, error);
+ if (!exp)
+ return NULL;
+ } else {
+ if (!(exp = export_find(hp, path))) {
+ *error = no_entry;
+ return NULL;