- if (new_cache) {
- static nfs_export my_exp;
- static nfs_client my_client;
- 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);
- if (!n)
- return NULL;
- strcpy(my_client.m_hostname, *n?n:"DEFAULT");
- free(n);
- my_client.m_naddr = 1;
+ 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(&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;