- diff --git a/daemon/lookup.c b/daemon/lookup.c
- index f747e8a..2312e06 100644
- --- a/daemon/lookup.c
- +++ b/daemon/lookup.c
- @@ -141,11 +141,13 @@ static int lookup_rpc(
- nfs41_session_sequence(&args->sequence, session, 0);
- if (dir == &res->root) {
- -#ifdef USE_PUBFH
- + if (session->client->root->is_pubfh) {
- compound_add_op(&compound, OP_PUTPUBFH, NULL, &res->putfh);
- -#else
- + }
- + else {
- compound_add_op(&compound, OP_PUTROOTFH, NULL, &res->putfh);
- -#endif
- + }
- +
- compound_add_op(&compound, OP_GETFH, NULL, &res->getrootfh);
- compound_add_op(&compound, OP_GETATTR, &args->getrootattr,
- &res->getrootattr);
- diff --git a/daemon/mount.c b/daemon/mount.c
- index cc9053b..516f0e6 100644
- --- a/daemon/mount.c
- +++ b/daemon/mount.c
- @@ -50,11 +50,13 @@ static int parse_mount(unsigned char *buffer, uint32_t length, nfs41_upcall *upc
- if (status) goto out;
- status = safe_read(&buffer, &length, &args->wsize, sizeof(DWORD));
- if (status) goto out;
- + status = safe_read(&buffer, &length, &args->is_pubfh, sizeof(DWORD));
- + if (status) goto out;
- DPRINTF(1, ("parsing NFS41_MOUNT: hostport='%s' root='%s' "
- - "sec_flavor='%s' rsize=%d wsize=%d\n",
- + "sec_flavor='%s' rsize=%d wsize=%d is_pubfh=%d\n",
- args->hostport, args->path, secflavorop2name(args->sec_flavor),
- - args->rsize, args->wsize));
- + args->rsize, args->wsize, args->is_pubfh));
- return status;
- out:
- DPRINTF(1, ("parsing NFS41_MOUNT: failed %d\n", status));
- @@ -83,9 +85,11 @@ static int handle_mount(void *daemon_context, nfs41_upcall *upcall)
- (void)get_token_authenticationid(upcall->currentthread_token,
- &authenticationid);
- - logprintf("mount(hostport='%s', path='%s', "
- + logprintf("mount(hostport='%s', "
- + "is_pubfh=%d, path='%s', "
- "authid=(0x%lx.0x%lx)) request\n",
- args->hostport?args->hostport:"<NULL>",
- + (int)args->is_pubfh,
- args->path?args->path:"<NULL>",
- (long)authenticationid.HighPart,
- (long)authenticationid.LowPart);
- @@ -143,7 +147,8 @@ static int handle_mount(void *daemon_context, nfs41_upcall *upcall)
- root = upcall->root_ref;
- } else {
- // create root
- - status = nfs41_root_create(hostname, port, args->sec_flavor,
- + status = nfs41_root_create(hostname, port,
- + args->is_pubfh?true:false, args->sec_flavor,
- args->wsize + WRITE_OVERHEAD, args->rsize + READ_OVERHEAD, &root);
- if (status) {
- eprintf("nfs41_root_create(hostname='%s', port=%d) failed %d\n",
- @@ -187,32 +192,37 @@ static int handle_mount(void *daemon_context, nfs41_upcall *upcall)
- out:
- if (status == 0) {
- #ifdef NFS41_DRIVER_USE_AUTHENTICATIONID_FOR_MOUNT_NAMESPACE
- - logprintf("mount(hostport='%s', path='%s', "
- + logprintf("mount(hostport='%s', is_pubfh=%d, path='%s', "
- "authid=(0x%lx.0x%lx)) success, root=0x%p\n",
- args->hostport?args->hostport:"<NULL>",
- + (int)args->is_pubfh,
- args->path?args->path:"<NULL>",
- (long)authenticationid.HighPart,
- (long)authenticationid.LowPart,
- root);
- #else
- - logprintf("mount(hostport='%s', path='%s') success, root=0x%p\n",
- + logprintf("mount(hostport='%s', is_pubfh=%d, path='%s') success, "
- + "root=0x%p\n",
- args->hostport?args->hostport:"<NULL>",
- + (int)args->is_pubfh,
- args->path?args->path:"<NULL>",
- root);
- #endif /* NFS41_DRIVER_USE_AUTHENTICATIONID_FOR_MOUNT_NAMESPACE */
- }
- else {
- #ifdef NFS41_DRIVER_USE_AUTHENTICATIONID_FOR_MOUNT_NAMESPACE
- - logprintf("mount(hostport='%s', path='%s', "
- + logprintf("mount(hostport='%s', is_pubfh=%d, path='%s', "
- "authid=(0x%lx.0x%lx))) failed, status=%d\n",
- args->hostport?args->hostport:"<NULL>",
- + (int)args->is_pubfh,
- args->path?args->path:"<NULL>",
- (long)authenticationid.HighPart,
- (long)authenticationid.LowPart,
- (int)status);
- #else
- - logprintf("mount(hostport='%s', path='%s') failed, status=%d\n",
- + logprintf("mount(hostport='%s', is_pubfh=%d, path='%s') failed, status=%d\n",
- args->hostport?args->hostport:"<NULL>",
- + (int)args->is_pubfh,
- args->path?args->path:"<NULL>",
- (int)status);
- #endif /* NFS41_DRIVER_USE_AUTHENTICATIONID_FOR_MOUNT_NAMESPACE */
- diff --git a/daemon/namespace.c b/daemon/namespace.c
- index e490aad..ec44311 100644
- --- a/daemon/namespace.c
- +++ b/daemon/namespace.c
- @@ -37,6 +37,7 @@
- int nfs41_root_create(
- IN const char *name,
- IN uint32_t port,
- + IN bool is_pubfh,
- IN uint32_t sec_flavor,
- IN uint32_t wsize,
- IN uint32_t rsize,
- @@ -54,6 +55,7 @@ int nfs41_root_create(
- }
- list_init(&root->clients);
- + root->is_pubfh = is_pubfh;
- root->wsize = wsize;
- root->rsize = rsize;
- InitializeCriticalSection(&root->lock);
- @@ -61,7 +63,7 @@ int nfs41_root_create(
- root->sec_flavor = sec_flavor;
- /* generate a unique client_owner */
- - status = nfs41_client_owner(name, port, sec_flavor, &root->client_owner);
- + status = nfs41_client_owner(name, port, is_pubfh, sec_flavor, &root->client_owner);
- if (status) {
- eprintf("nfs41_client_owner() failed with %d\n", status);
- free(root);
- diff --git a/daemon/nfs41.h b/daemon/nfs41.h
- index f1617a9..41b3838 100644
- --- a/daemon/nfs41.h
- +++ b/daemon/nfs41.h
- @@ -299,6 +299,7 @@ typedef struct __nfs41_root {
- client_owner4 client_owner;
- CRITICAL_SECTION lock;
- struct list_entry clients;
- + bool is_pubfh;
- uint32_t wsize;
- uint32_t rsize;
- #pragma warning( push )
- @@ -316,6 +317,7 @@ typedef struct __nfs41_root {
- int nfs41_root_create(
- IN const char *name,
- IN uint32_t port,
- + IN bool is_pubfh,
- IN uint32_t sec_flavor,
- IN uint32_t wsize,
- IN uint32_t rsize,
- @@ -434,6 +436,7 @@ void nfs41_server_addrs(
- int nfs41_client_owner(
- IN const char *name,
- IN uint32_t port,
- + IN bool is_pubfh,
- IN uint32_t sec_flavor,
- OUT client_owner4 *owner);
- diff --git a/daemon/nfs41_client.c b/daemon/nfs41_client.c
- index 847aa0c..00e340b 100644
- --- a/daemon/nfs41_client.c
- +++ b/daemon/nfs41_client.c
- @@ -362,6 +362,7 @@ out:
- int nfs41_client_owner(
- IN const char *name,
- IN uint32_t port,
- + IN bool is_pubfh,
- IN uint32_t sec_flavor,
- OUT client_owner4 *owner)
- {
- @@ -420,6 +421,12 @@ int nfs41_client_owner(
- goto out_context;
- }
- + if (!CryptHashData(hash, (const BYTE*)&is_pubfh, (DWORD)sizeof(bool), 0)) {
- + status = GetLastError();
- + eprintf("CryptHashData() failed with %d\n", status);
- + goto out_hash;
- + }
- +
- if (!CryptHashData(hash, (const BYTE*)&sec_flavor, (DWORD)sizeof(sec_flavor), 0)) {
- status = GetLastError();
- eprintf("CryptHashData() failed with %d\n", status);
- diff --git a/daemon/nfs41_ops.c b/daemon/nfs41_ops.c
- index 9ab7cef..5125cc8 100644
- --- a/daemon/nfs41_ops.c
- +++ b/daemon/nfs41_ops.c
- @@ -1154,11 +1154,12 @@ int nfs41_getattr(
- putfh_args.file = file;
- putfh_args.in_recovery = 0;
- } else {
- -#ifdef USE_PUBFH
- + if (session->client->root->is_pubfh) {
- compound_add_op(&compound, OP_PUTPUBFH, NULL, &putfh_res);
- -#else
- + }
- + else {
- compound_add_op(&compound, OP_PUTROOTFH, NULL, &putfh_res);
- -#endif
- + }
- }
- compound_add_op(&compound, OP_GETATTR, &getattr_args, &getattr_res);
- @@ -1901,11 +1902,12 @@ int nfs41_secinfo(
- nfs41_session_sequence(&sequence_args, session, 0);
- if (file == NULL) {
- -#ifdef USE_PUBFH
- + if (session->client->root->is_pubfh) {
- compound_add_op(&compound, OP_PUTPUBFH, NULL, &putfh_res);
- -#else
- + }
- + else {
- compound_add_op(&compound, OP_PUTROOTFH, NULL, &putfh_res);
- -#endif
- + }
- }
- else {
- compound_add_op(&compound, OP_PUTFH, &putfh_args, &putfh_res);
- @@ -1948,11 +1950,12 @@ int nfs41_secinfo_noname(
- nfs41_session_sequence(&sequence_args, session, 0);
- if (file == NULL) {
- -#ifdef USE_PUBFH
- + if (session->client->root->is_pubfh) {
- compound_add_op(&compound, OP_PUTPUBFH, NULL, &putfh_res);
- -#else
- + }
- + else {
- compound_add_op(&compound, OP_PUTROOTFH, NULL, &putfh_res);
- -#endif
- + }
- }
- else {
- compound_add_op(&compound, OP_PUTFH, &putfh_args, &putfh_res);
- diff --git a/daemon/upcall.h b/daemon/upcall.h
- index 50b62be..5fd9d96 100644
- --- a/daemon/upcall.h
- +++ b/daemon/upcall.h
- @@ -35,6 +35,7 @@ typedef struct __mount_upcall_args {
- DWORD sec_flavor;
- DWORD rsize;
- DWORD wsize;
- + DWORD is_pubfh;
- DWORD lease_time;
- FILE_FS_ATTRIBUTE_INFORMATION FsAttrs;
- } mount_upcall_args;
- diff --git a/dll/nfs41_np.c b/dll/nfs41_np.c
- index 1720558..6e24e21 100644
- --- a/dll/nfs41_np.c
- +++ b/dll/nfs41_np.c
- @@ -638,8 +638,10 @@ NPAddConnection3(
- #endif
- #ifdef NFS41_DRIVER_MOUNT_DOES_NFS4_PREFIX
- - if (wcsncmp(&p[i], L"\\nfs4", 5) != 0) {
- - DbgP((L"Connection name '%s' not prefixed with '\\nfs41'\n",
- + if (wcsncmp(&p[i], L"\\nfs4", 5) &&
- + wcsncmp(&p[i], L"\\pubnfs4", 8)) {
- + DbgP((L"Connection name '%s' not prefixed with "
- + "'\\nfs41' or '\\pubnfs41'\n",
- &p[i]));
- Status = WN_BAD_NETNAME;
- goto out;
- diff --git a/mount/enum.c b/mount/enum.c
- index 8a30260..7719c45 100644
- --- a/mount/enum.c
- +++ b/mount/enum.c
- @@ -21,6 +21,7 @@
- #include <Windows.h>
- #include <tchar.h>
- +#include <stdbool.h>
- #include <stdio.h>
- #include <malloc.h>
- @@ -38,13 +39,17 @@ void PrintMountLine(
- LPCTSTR remote)
- {
- TCHAR *cygwin_unc_buffer = alloca((_tcslen(remote)+32)*sizeof(TCHAR));
- - char *cygwin_nfsurl_buffer = alloca(((_tcslen(remote)+32)*3)+8);
- + char *cygwin_nfsurl_buffer = alloca(
- + ((_tcslen(remote)+32)*3)+8 +
- + 9 /* "?public=1" */
- + );
- TCHAR *b;
- LPCTSTR s;
- TCHAR sc;
- #ifndef NFS41_DRIVER_MOUNT_DOES_NFS4_PREFIX
- unsigned int backslash_counter;
- #endif
- + bool is_pubfh = false;
- for(b = cygwin_unc_buffer, s = remote
- #ifndef NFS41_DRIVER_MOUNT_DOES_NFS4_PREFIX
- @@ -127,7 +132,22 @@ void PrintMountLine(
- */
- if (slash_counter == 1) {
- *us++ = uc;
- + if (*utf8unc_p == 'p') {
- + /* Skip "pubnfs4" */
- + utf8unc_p += 7;
- + is_pubfh = true;
- + }
- + else if (*utf8unc_p == 'n') {
- + /* Skip "nfs4" */
- utf8unc_p += 4;
- + }
- + else {
- + (void)fwprintf(stderr,
- + L"PrintMountLine: ## Internal error, "
- + "unknown provider prefix\n");
- + return;
- + }
- +
- continue;
- }
- @@ -151,6 +171,17 @@ void PrintMountLine(
- }
- *us = '\0';
- + if (is_pubfh) {
- +#pragma warning( push )
- + /*
- + * Disable "'strcat': This function or variable may be unsafe",
- + * in this context it is safe to use
- + */
- +#pragma warning (disable : 4996)
- + (void)strcat(cygwin_nfsurl_buffer, "?public=1");
- +#pragma warning( pop )
- + }
- +
- (void)_tprintf(TEXT("%-8s\t%-50s\t%-50s\t%-50S\n"),
- local, remote, cygwin_unc_buffer, cygwin_nfsurl_buffer);
- diff --git a/mount/mount.c b/mount/mount.c
- index c4d8170..d04090e 100644
- --- a/mount/mount.c
- +++ b/mount/mount.c
- @@ -30,6 +30,7 @@
- #include <strsafe.h>
- #include <Winnetwk.h> /* for WNet*Connection */
- #include <stdlib.h>
- +#include <stdbool.h>
- #include <stdio.h>
- #include "nfs41_build_features.h"
- @@ -51,6 +52,7 @@ DWORD EnumMounts(
- IN LPNETRESOURCE pContainer);
- static DWORD ParseRemoteName(
- + IN bool is_pubfh,
- IN LPTSTR pRemoteName,
- IN OUT PMOUNT_OPTION_LIST pOptions,
- OUT LPTSTR pParsedRemoteName,
- @@ -91,6 +93,8 @@ static VOID PrintUsage(LPTSTR pProcess)
- TEXT("\t-w\tAlias for -o rw (read-write mount)\n")
- TEXT("* Mount options:\n")
- + TEXT("\tpublic\tconnect to the server using the public file handle lookup protocol.\n")
- + TEXT("\t\t(See WebNFS Client Specification, RFC 2054).\n")
- TEXT("\tro\tmount as read-only\n")
- TEXT("\trw\tmount as read-write (default)\n")
- TEXT("\tport=#\tTCP port to use (defaults to 2049)\n")
- @@ -176,6 +180,8 @@ DWORD __cdecl _tmain(DWORD argc, LPTSTR argv[])
- goto out;
- }
- + bool is_pubfh = false;
- +
- /* parse command line */
- for (i = 1; i < argc; i++)
- {
- @@ -218,6 +224,20 @@ DWORD __cdecl _tmain(DWORD argc, LPTSTR argv[])
- }
- mntopts[num_mntopts++] = argv[i];
- +
- + /*
- + * Extract "public" option here, as we need this for
- + * |ParseRemoteName()|. General parsing of -o options
- + * happens *AFTER* |ParseRemoteName()|, so any
- + * settings from a nfs://-URL can be overridden
- + * via -o options.
- + */
- + if (wcsstr(argv[i], L"public=0")) {
- + is_pubfh = false;
- + }
- + else if (wcsstr(argv[i], L"public")) {
- + is_pubfh = true;
- + }
- }
- else if (_tcscmp(argv[i], TEXT("-r")) == 0) /* mount option */
- {
- @@ -333,7 +353,7 @@ DWORD __cdecl _tmain(DWORD argc, LPTSTR argv[])
- * options for a NFS mount point, which can be overridden via
- * -o below.
- */
- - result = ParseRemoteName(pRemoteName, &Options,
- + result = ParseRemoteName(is_pubfh, pRemoteName, &Options,
- szParsedRemoteName, szRemoteName, NFS41_SYS_MAX_PATH_LEN);
- if (result)
- goto out;
- @@ -411,6 +431,7 @@ wchar_t *utf8str2wcs(const char *utf8str)
- }
- static DWORD ParseRemoteName(
- + IN bool is_pubfh,
- IN LPTSTR pRemoteName,
- IN OUT PMOUNT_OPTION_LIST pOptions,
- OUT LPTSTR pParsedRemoteName,
- @@ -712,7 +733,8 @@ static DWORD ParseRemoteName(
- if (FAILED(result))
- goto out;
- #ifdef NFS41_DRIVER_MOUNT_DOES_NFS4_PREFIX
- - result = StringCbCat(pConnectionName, cchConnectionLen, TEXT("\\nfs4"));
- + result = StringCbCat(pConnectionName, cchConnectionLen,
- + (is_pubfh?(TEXT("\\pubnfs4")):(TEXT("\\nfs4"))));
- if (FAILED(result))
- goto out;
- #endif /* NFS41_DRIVER_MOUNT_DOES_NFS4_PREFIX */
- @@ -723,9 +745,10 @@ static DWORD ParseRemoteName(
- #ifdef DEBUG_MOUNT
- (void)_ftprintf(stderr,
- - TEXT("pConnectionName='%s', pParsedRemoteName='%s'\n"),
- + TEXT("pConnectionName='%s', pParsedRemoteName='%s', is_pubfh='%d'\n"),
- pConnectionName,
- - pParsedRemoteName);
- + pParsedRemoteName,
- + (int)is_pubfh);
- #endif
- out:
- diff --git a/sys/nfs41_driver.c b/sys/nfs41_driver.c
- index 613f7df..5b18e10 100644
- --- a/sys/nfs41_driver.c
- +++ b/sys/nfs41_driver.c
- @@ -189,6 +189,7 @@ typedef struct _updowncall_entry {
- DWORD rsize;
- DWORD wsize;
- DWORD lease_time;
- + DWORD is_pubfh;
- } Mount;
- struct {
- PMDL MdlAddress;
- @@ -276,9 +277,13 @@ nfs41_updowncall_list upcall, downcall;
- -/* In order to cooperate with other network providers,
- - * we only claim paths of the format '\\server\nfs4\path' */
- +/*
- + * In order to cooperate with other network providers,
- + * we only claim paths of the format '\\server\nfs4\path' or
- + * '\\server\pubnfs4\path'
- + */
- DECLARE_CONST_UNICODE_STRING(NfsPrefix, L"\\nfs4");
- +DECLARE_CONST_UNICODE_STRING(PubNfsPrefix, L"\\pubnfs4");
- DECLARE_CONST_UNICODE_STRING(AUTH_SYS_NAME, L"sys");
- DECLARE_CONST_UNICODE_STRING(AUTHGSS_KRB5_NAME, L"krb5");
- DECLARE_CONST_UNICODE_STRING(AUTHGSS_KRB5I_NAME, L"krb5i");
- @@ -294,6 +299,7 @@ DECLARE_CONST_UNICODE_STRING(EMPTY_STRING, L"");
- #define UPCALL_TIMEOUT_DEFAULT 50 /* in seconds */
- typedef struct _NFS41_MOUNT_CONFIG {
- + BOOLEAN is_pubfh;
- DWORD ReadSize;
- DWORD WriteSize;
- BOOLEAN ReadOnly;
- @@ -682,7 +688,7 @@ NTSTATUS marshal_nfs41_mount(
- goto out;
- }
- header_len = *len + length_as_utf8(entry->u.Mount.srv_name) +
- - length_as_utf8(entry->u.Mount.root) + 3 * sizeof(DWORD);
- + length_as_utf8(entry->u.Mount.root) + 4 * sizeof(DWORD);
- if (header_len > buf_len) {
- status = STATUS_INSUFFICIENT_RESOURCES;
- goto out;
- @@ -696,15 +702,18 @@ NTSTATUS marshal_nfs41_mount(
- RtlCopyMemory(tmp, &entry->u.Mount.rsize, sizeof(DWORD));
- tmp += sizeof(DWORD);
- RtlCopyMemory(tmp, &entry->u.Mount.wsize, sizeof(DWORD));
- + tmp += sizeof(DWORD);
- + RtlCopyMemory(tmp, &entry->u.Mount.is_pubfh, sizeof(DWORD));
- *len = header_len;
- #ifdef DEBUG_MARSHAL_DETAIL
- DbgP("marshal_nfs41_mount: server name='%wZ' mount point='%wZ' "
- - "sec_flavor='%s' rsize=%d wsize=%d\n",
- + "sec_flavor='%s' rsize=%d wsize=%d is_pubfh=%d\n",
- entry->u.Mount.srv_name, entry->u.Mount.root,
- - secflavorop2name(entry->u.Mount.sec_flavor), entry->u.Mount.rsize,
- - entry->u.Mount.wsize);
- + secflavorop2name(entry->u.Mount.sec_flavor),
- + (int)entry->u.Mount.rsize, (int)entry->u.Mount.wsize,
- + (int)entry->u.Mount.is_pubfh);
- #endif
- out:
- return status;
- @@ -2812,6 +2821,7 @@ NTSTATUS nfs41_mount(
- entry->u.Mount.root = &config->MntPt;
- entry->u.Mount.rsize = config->ReadSize;
- entry->u.Mount.wsize = config->WriteSize;
- + entry->u.Mount.is_pubfh = config->is_pubfh;
- entry->u.Mount.sec_flavor = sec_flavor;
- entry->u.Mount.FsAttrs = FsAttrs;
- @@ -2846,6 +2856,7 @@ void nfs41_MountConfig_InitDefaults(
- Config->ReadSize = MOUNT_CONFIG_RW_SIZE_DEFAULT;
- Config->WriteSize = MOUNT_CONFIG_RW_SIZE_DEFAULT;
- + Config->is_pubfh = FALSE;
- Config->ReadOnly = FALSE;
- Config->write_thru = FALSE;
- Config->nocache = FALSE;
- @@ -2992,6 +3003,15 @@ NTSTATUS nfs41_MountConfig_ParseOptions(
- &Config->WriteSize, MOUNT_CONFIG_RW_SIZE_MIN,
- MOUNT_CONFIG_RW_SIZE_MAX);
- }
- + else if (wcsncmp(L"public", Name, NameLen) == 0) {
- + /*
- + + We ignore this value here, and instead rely on the
- + * /pubnfs4 prefix
- + */
- + BOOLEAN dummy;
- + status = nfs41_MountConfig_ParseBoolean(Option, &usValue,
- + FALSE, &dummy);
- + }
- else if (wcsncmp(L"srvname", Name, NameLen) == 0) {
- if (usValue.Length > Config->SrvName.MaximumLength)
- status = STATUS_NAME_TOO_LONG;
- @@ -3107,7 +3127,8 @@ out:
- NTSTATUS has_nfs_prefix(
- IN PUNICODE_STRING SrvCallName,
- - IN PUNICODE_STRING NetRootName)
- + IN PUNICODE_STRING NetRootName,
- + OUT BOOLEAN *pubfh_prefix)
- {
- NTSTATUS status = STATUS_BAD_NETWORK_NAME;
- @@ -3140,20 +3161,42 @@ NTSTATUS has_nfs_prefix(
- }
- }
- - if ((state == 3) &&
- - (!memcmp(&NetRootName->Buffer[i], L"\\nfs4",
- + if (state == 3) {
- + if (!memcmp(&NetRootName->Buffer[i], L"\\nfs4",
- (4*sizeof(wchar_t))))) {
- + *pubfh_prefix = FALSE;
- status = STATUS_SUCCESS;
- }
- + if ((NetRootName->Length >=
- + (SrvCallName->Length + PubNfsPrefix.Length)) &&
- + (!memcmp(&NetRootName->Buffer[i], L"\\pubnfs4",
- + (4*sizeof(wchar_t))))) {
- + *pubfh_prefix = TRUE;
- + status = STATUS_SUCCESS;
- + }
- + }
- }
- #else
- - if (NetRootName->Length == SrvCallName->Length + NfsPrefix.Length) {
- + if (NetRootName->Length ==
- + (SrvCallName->Length + NfsPrefix.Length)) {
- const UNICODE_STRING NetRootPrefix = {
- NfsPrefix.Length,
- NetRootName->MaximumLength - SrvCallName->Length,
- &NetRootName->Buffer[SrvCallName->Length/2]
- };
- - if (RtlCompareUnicodeString(&NetRootPrefix, &NfsPrefix, FALSE) == 0)
- + if (!RtlCompareUnicodeString(&NetRootPrefix, &NfsPrefix, FALSE))
- + *pubfh_prefix = FALSE;
- + status = STATUS_SUCCESS;
- + }
- + else if (NetRootName->Length ==
- + (SrvCallName->Length + PubNfsPrefix.Length)) {
- + const UNICODE_STRING PubNetRootPrefix = {
- + PubNfsPrefix.Length,
- + NetRootName->MaximumLength - SrvCallName->Length,
- + &NetRootName->Buffer[SrvCallName->Length/2]
- + };
- + if (!RtlCompareUnicodeString(&PubNetRootPrefix, &PubNfsPrefix, FALSE))
- + *pubfh_prefix = TRUE;
- status = STATUS_SUCCESS;
- }
- #endif
- @@ -3296,12 +3339,16 @@ NTSTATUS nfs41_CreateVNetRoot(
- pVNetRootContext->session = INVALID_HANDLE_VALUE;
- - /* In order to cooperate with other network providers, we must
- - * only claim paths of the form '\\server\nfs4\path' */
- - status = has_nfs_prefix(pSrvCall->pSrvCallName, pNetRoot->pNetRootName);
- + /*
- + * In order to cooperate with other network providers, we
- + * must only claim paths of the form '\\server\nfs4\path'
- + * or '\\server\pubnfs4\path'
- + */
- + BOOLEAN pubfh_prefix = FALSE;
- + status = has_nfs_prefix(pSrvCall->pSrvCallName, pNetRoot->pNetRootName, &pubfh_prefix);
- if (status) {
- print_error("nfs41_CreateVNetRoot: NetRootName '%wZ' doesn't match "
- - "'\\nfs4'!\n", pNetRoot->pNetRootName);
- + "'\\nfs4' or '\\pubnfs4'!\n", pNetRoot->pNetRootName);
- goto out;
- }
- pNetRoot->MRxNetRootState = MRX_NET_ROOT_STATE_GOOD;
- @@ -3335,8 +3382,11 @@ NTSTATUS nfs41_CreateVNetRoot(
- pVNetRootContext->write_thru = Config->write_thru;
- pVNetRootContext->nocache = Config->nocache;
- } else {
- - /* Codepath for \\server@port\nfs4\path */
- - DbgP("Codepath for \\\\server@port\\nfs4\\path\n");
- + /*
- + * Codepath for \\server@port\nfs4\path or
- + * \\server@port\pubnfs4\path
- + */
- + DbgP("Codepath for \\\\server@port\\@(pubnfs4|nfs4)\\path\n");
- /*
- * STATUS_NFS_SHARE_NOT_MOUNTED - status code for the case
- @@ -3427,9 +3477,12 @@ NTSTATUS nfs41_CreateVNetRoot(
- pVNetRootContext->nocache = Config->nocache;
- }
- + Config->is_pubfh = pubfh_prefix;
- +
- DbgP("Config->{ "
- "MntPt='%wZ', "
- "SrvName='%wZ', "
- + "is_pubfh=%d, "
- "ReadOnly=%d, "
- "write_thru=%d, "
- "nocache=%d "
- @@ -3439,6 +3492,7 @@ NTSTATUS nfs41_CreateVNetRoot(
- "}\n",
- &Config->MntPt,
- &Config->SrvName,
- + Config->is_pubfh?1:0,
- Config->ReadOnly?1:0,
- Config->write_thru?1:0,
- Config->nocache?1:0,
- @@ -3564,7 +3618,7 @@ NTSTATUS nfs41_CreateVNetRoot(
- RtlCopyLuid(&entry->login_id, &luid);
- /*
- * Save mount config so we can use it for
- - * \\server@port\nfs4\path mounts later
- + * \\server@port\@(pubnfs4|nfs4)\path mounts later
- */
- copy_nfs41_mount_config(&entry->Config, Config);
- nfs41_AddEntry(pNetRootContext->mountLock,
pubnfs4 backup 20240712
Posted by Anonymous on Fri 12th Jul 2024 14:33
raw | new post
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.