- if (new_cache) {
- int i;
- /* return static nfs_export with details filled in */
- char *n;
- free(my_client.m_hostname);
- if (use_ipaddr) {
- my_client.m_hostname =
- strdup(inet_ntoa(caller->sin_addr));
- } else {
- n = client_compose(hp);
- *error = unknown_host;
- if (!n)
- my_client.m_hostname = NULL;
- else if (*n)
- my_client.m_hostname = n;
- else {
- free(n);
- my_client.m_hostname = strdup("DEFAULT");
- }
+ free(my_client.m_hostname);
+
+ my_client.m_hostname = get_client_hostname(caller, ai, error);
+ if (my_client.m_hostname == NULL)
+ return NULL;
+
+ my_client.m_naddr = 1;
+ set_addrlist_in(&my_client, 0, caller);
+ 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, ai))
+ continue;
+ break;