diff --git a/daemon/mount.c b/daemon/mount.c index 73d8b29..0f76e69 100644 --- a/daemon/mount.c +++ b/daemon/mount.c @@ -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); diff --git a/daemon/namespace.c b/daemon/namespace.c index f24a745..203f5a7 100644 --- a/daemon/namespace.c +++ b/daemon/namespace.c @@ -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; diff --git a/daemon/nfs41.h b/daemon/nfs41.h index 5eabaad..004505e 100644 --- a/daemon/nfs41.h +++ b/daemon/nfs41.h @@ -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( diff --git a/daemon/nfs41_client.c b/daemon/nfs41_client.c index ad88096..6482c45 100644 --- a/daemon/nfs41_client.c +++ b/daemon/nfs41_client.c @@ -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) {