each mount has unique client_owner

add the netroot name to the hash for generating its client_owner

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
This commit is contained in:
Casey Bodley 2010-10-26 14:35:30 -04:00
parent f61bd10560
commit 4930e7caca
4 changed files with 13 additions and 2 deletions

View file

@ -63,7 +63,8 @@ int handle_mount(nfs41_upcall *upcall)
goto out;
}
// create root
status = nfs41_root_create(NFS41_MAX_FILEIO_SIZE + WRITE_OVERHEAD,
status = nfs41_root_create(args->hostname,
NFS41_MAX_FILEIO_SIZE + WRITE_OVERHEAD,
NFS41_MAX_FILEIO_SIZE + READ_OVERHEAD, &root);
if (status) {
eprintf("nfs41_rpc_clnt_create failed %d\n", status);

View file

@ -37,6 +37,7 @@
/* nfs41_root */
int nfs41_root_create(
IN const char *name,
IN uint32_t wsize,
IN uint32_t rsize,
OUT nfs41_root **root_out)
@ -58,7 +59,7 @@ int nfs41_root_create(
InitializeCriticalSection(&root->lock);
/* generate a unique client_owner */
status = nfs41_client_owner(&root->client_owner);
status = nfs41_client_owner(name, &root->client_owner);
if (status) {
eprintf("nfs41_client_owner() failed with %d\n", status);
goto out;

View file

@ -171,6 +171,7 @@ typedef struct __nfs41_root {
/* nfs41_namespace.c */
int nfs41_root_create(
IN const char *name,
IN uint32_t wsize,
IN uint32_t rsize,
OUT nfs41_root **root_out);
@ -274,6 +275,7 @@ void nfs41_server_addrs(
/* nfs41_client.c */
int nfs41_client_owner(
IN const char *name,
OUT client_owner4 *owner);
uint32_t nfs41_exchange_id_flags(

View file

@ -379,6 +379,7 @@ out:
}
int nfs41_client_owner(
IN const char *name,
OUT client_owner4 *owner)
{
HCRYPTPROV context;
@ -405,6 +406,12 @@ int nfs41_client_owner(
goto out_context;
}
if (!CryptHashData(hash, (const BYTE*)name, (DWORD)strlen(name), 0)) {
status = GetLastError();
eprintf("CryptHashData() failed with %d\n", status);
goto out_hash;
}
/* add the mac address from each applicable adapter to the hash */
status = hash_mac_addrs(hash);
if (status) {