mount: use empty mount path when no EAs are present

adds support for mounting with 'net use' and 'Map Network Drive'
if we don't have extended attributes on mount (i.e. not using nfs_mount), don't fail!  instead, use SrvName=SrvCallName and MntPt=""
updated nfs41_MountConfig_InitDefaults() to initialize SrvName and MntPt with Length=0

Signed-off-by: Casey Bodley <cbodley@umich.edu>
This commit is contained in:
Casey Bodley 2010-10-12 09:46:34 -04:00
parent 81f05b1cb8
commit 4731a97973

View file

@ -1998,10 +1998,10 @@ void nfs41_MountConfig_InitDefaults(
Config->ReadSize = MOUNT_CONFIG_RW_SIZE_DEFAULT;
Config->WriteSize = MOUNT_CONFIG_RW_SIZE_DEFAULT;
Config->ReadOnly = FALSE;
Config->SrvName.Length = SERVER_NAME_BUFFER_SIZE;
Config->SrvName.Length = 0;
Config->SrvName.MaximumLength = SERVER_NAME_BUFFER_SIZE;
Config->SrvName.Buffer = Config->srv_buffer;
Config->MntPt.Length = MAX_PATH;
Config->MntPt.Length = 0;
Config->MntPt.MaximumLength = MAX_PATH;
Config->MntPt.Buffer = Config->mntpt_buffer;
}
@ -2195,35 +2195,37 @@ NTSTATUS nfs41_CreateVNetRoot(
goto out;
}
pVNetRootContext->session = pNetRootContext->session = NULL;
nfs41_MountConfig_InitDefaults(&Config);
if (pCreateNetRootContext->RxContext->Create.EaLength) {
/* parse the extended attributes for mount options */
if (pCreateNetRootContext->RxContext->Create.EaLength)
{
status = nfs41_MountConfig_ParseOptions(
pCreateNetRootContext->RxContext->Create.EaBuffer,
pCreateNetRootContext->RxContext->Create.EaLength,
&Config);
if (status != STATUS_SUCCESS)
goto out;
} else {
/* use the SRV_CALL name (without leading \) as the hostname */
Config.SrvName.Buffer = pSrvCall->pSrvCallName->Buffer + 1;
Config.SrvName.Length =
pSrvCall->pSrvCallName->Length - sizeof(WCHAR);
Config.SrvName.MaximumLength =
pSrvCall->pSrvCallName->MaximumLength - sizeof(WCHAR);
}
/* send the mount upcall */
DbgP("Server Name %wZ Mount Point %wZ\n",
&Config.SrvName, &Config.MntPt);
pVNetRootContext->session = pNetRootContext->session = NULL;
status = nfs41_mount(&Config.SrvName, &Config.MntPt,
&pVNetRootContext->session);
if (status == STATUS_SUCCESS)
pNetRootContext->session = pVNetRootContext->session;
else
if (status != STATUS_SUCCESS)
goto out;
} else {
DbgP("We dont have a valid existing session and we don't have a mount point!\n");
status = STATUS_UNEXPECTED_NETWORK_ERROR;
pNetRootContext->session = NULL;
goto out;
}
DbgP("Saving point to nfs41_session 0x%x\n", pVNetRootContext->session);
pNetRootContext->session = pVNetRootContext->session;
DbgP("Saving new session 0x%x\n", pVNetRootContext->session);
out:
/* AGLO do we need to worry about handling new netroot vs using existing one */