Here's a new set of patches to fix up "showmount -a", based on the approach
suggested by Neil. This first patch is fairly simple. It just stops
the current caching of my_client.
For an explanation, consider this situation with the current code:
1) Client mounts an NFS export from server that is restricted to a particular
hostname or netgroup.
2) DNS or netgroup changes so that the client would be denied.
3) Client attempts mount again. Mount succeeds, even though it shouldn't due
to the fact that mountd relies on cached info in my_client.
This situation can occur as long as no other client attempts a mount between
1 and 3 above. The patch below removes this caching, and causes a new
invocation of client_compose for each pass through auth_authenticate:
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Neil Brown <neilb@suse.de>
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)
- return NULL;
- strcpy(my_client.m_hostname, *n?n:"DEFAULT");
- free(n);
- my_client.m_naddr = 1;
- }
-
+ char *n;
+ my_client.m_addrlist[0] = caller->sin_addr;
+ n = client_compose(caller->sin_addr);
+ *error = unknown_host;
+ if (!n)
+ return NULL;
+ strcpy(my_client.m_hostname, *n?n:"DEFAULT");
+ free(n);
+ my_client.m_naddr = 1;
my_exp.m_client = &my_client;
exp = NULL;