creating nfs client per security flavor
This commit is contained in:
parent
3b9f37d5a1
commit
f7a9932cb3
5 changed files with 50 additions and 23 deletions
|
|
@ -66,7 +66,7 @@ static int handle_mount(nfs41_upcall *upcall)
|
|||
goto out;
|
||||
}
|
||||
// create root
|
||||
status = nfs41_root_create(args->hostname,
|
||||
status = nfs41_root_create(args->hostname, args->sec_flavor,
|
||||
NFS41_MAX_FILEIO_SIZE + WRITE_OVERHEAD,
|
||||
NFS41_MAX_FILEIO_SIZE + READ_OVERHEAD, &root);
|
||||
if (status) {
|
||||
|
|
@ -76,7 +76,7 @@ static int handle_mount(nfs41_upcall *upcall)
|
|||
// add a mount
|
||||
root->uid = upcall->uid;
|
||||
root->gid = upcall->gid;
|
||||
root->sec_flavor = args->sec_flavor;
|
||||
|
||||
status = nfs41_root_mount_addrs(root, &addrs, 0, 0, &client);
|
||||
if (status) {
|
||||
eprintf("nfs41_root_mount() failed with %d\n", status);
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
/* nfs41_root */
|
||||
int nfs41_root_create(
|
||||
IN const char *name,
|
||||
IN uint32_t sec_flavor,
|
||||
IN uint32_t wsize,
|
||||
IN uint32_t rsize,
|
||||
OUT nfs41_root **root_out)
|
||||
|
|
@ -58,9 +59,10 @@ int nfs41_root_create(
|
|||
root->rsize = rsize;
|
||||
InitializeCriticalSection(&root->lock);
|
||||
root->ref_count = 1;
|
||||
root->sec_flavor = sec_flavor;
|
||||
|
||||
/* generate a unique client_owner */
|
||||
status = nfs41_client_owner(name, &root->client_owner);
|
||||
status = nfs41_client_owner(name, sec_flavor, &root->client_owner);
|
||||
if (status) {
|
||||
eprintf("nfs41_client_owner() failed with %d\n", status);
|
||||
goto out;
|
||||
|
|
|
|||
|
|
@ -191,6 +191,7 @@ typedef struct __nfs41_root {
|
|||
/* nfs41_namespace.c */
|
||||
int nfs41_root_create(
|
||||
IN const char *name,
|
||||
IN uint32_t sec_flavor,
|
||||
IN uint32_t wsize,
|
||||
IN uint32_t rsize,
|
||||
OUT nfs41_root **root_out);
|
||||
|
|
@ -298,6 +299,7 @@ void nfs41_server_addrs(
|
|||
/* nfs41_client.c */
|
||||
int nfs41_client_owner(
|
||||
IN const char *name,
|
||||
IN uint32_t sec_flavor,
|
||||
OUT client_owner4 *owner);
|
||||
|
||||
uint32_t nfs41_exchange_id_flags(
|
||||
|
|
|
|||
|
|
@ -365,6 +365,7 @@ out:
|
|||
|
||||
int nfs41_client_owner(
|
||||
IN const char *name,
|
||||
IN uint32_t sec_flavor,
|
||||
OUT client_owner4 *owner)
|
||||
{
|
||||
HCRYPTPROV context;
|
||||
|
|
@ -391,6 +392,12 @@ int nfs41_client_owner(
|
|||
goto out_context;
|
||||
}
|
||||
|
||||
if (!CryptHashData(hash, (const BYTE*)&sec_flavor, (DWORD)sizeof(sec_flavor), 0)) {
|
||||
status = GetLastError();
|
||||
eprintf("CryptHashData() failed with %d\n", status);
|
||||
goto out_hash;
|
||||
}
|
||||
|
||||
if (!CryptHashData(hash, (const BYTE*)name, (DWORD)strlen(name), 0)) {
|
||||
status = GetLastError();
|
||||
eprintf("CryptHashData() failed with %d\n", status);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue