- diff --git a/sys/nfs41_driver.c b/sys/nfs41_driver.c
- index 94c3070..53848bc 100644
- --- a/sys/nfs41_driver.c
- +++ b/sys/nfs41_driver.c
- @@ -41,17 +41,6 @@
- #include "nfs41_build_features.h"
- -/*
- - * FIXME: NFS41_DRIVER_SETGID_NEWGRP_SUPPORT - we need the correct
- - * |TOKEN_PRIMARY_GROUP| for |setgid()|/newgrp(1)
- - * support, and |#define USE_MOUNT_SEC_CONTEXT| currently breaks
- - * that
- - */
- -#ifndef NFS41_DRIVER_SETGID_NEWGRP_SUPPORT
- -#define USE_MOUNT_SEC_CONTEXT 1
- -#define STORE_MOUNT_SEC_CONTEXT 1
- -#endif
- -
- /* debugging printout defines */
- #define DEBUG_MARSHAL_HEADER
- #define DEBUG_MARSHAL_DETAIL
- @@ -402,10 +391,6 @@ typedef struct _NFS41_V_NET_ROOT_EXTENSION {
- BOOLEAN read_only;
- BOOLEAN write_thru;
- BOOLEAN nocache;
- -
- -#ifdef STORE_MOUNT_SEC_CONTEXT
- - SECURITY_CLIENT_CONTEXT mount_sec_ctx;
- -#endif
- } NFS41_V_NET_ROOT_EXTENSION, *PNFS41_V_NET_ROOT_EXTENSION;
- #define NFS41GetVNetRootExtension(pVNetRoot) \
- (((pVNetRoot) == NULL) ? NULL : \
- @@ -3407,10 +3392,6 @@ NTSTATUS nfs41_CreateVNetRoot(
- #ifdef DEBUG_MOUNT
- DbgP("Saving new session 0x%x\n", pVNetRootContext->session);
- #endif
- -#ifdef STORE_MOUNT_SEC_CONTEXT
- - status = nfs41_get_sec_ctx(SecurityImpersonation,
- - &pVNetRootContext->mount_sec_ctx);
- -#endif
- out_free:
- RxFreePool(Config);
- @@ -3609,15 +3590,6 @@ NTSTATUS nfs41_FinalizeVNetRoot(
- if (pVNetRoot->pNetRoot->Type != NET_ROOT_DISK &&
- pVNetRoot->pNetRoot->Type != NET_ROOT_WILD)
- status = STATUS_NOT_SUPPORTED;
- -#ifdef STORE_MOUNT_SEC_CONTEXT
- - else if (pVNetRootContext->session != INVALID_HANDLE_VALUE) {
- -#ifdef DEBUG_MOUNT
- - DbgP("nfs41_FinalizeVNetRoot: deleting security context: %p\n",
- - pVNetRootContext->mount_sec_ctx.ClientToken);
- -#endif
- - SeDeleteClientSecurity(&pVNetRootContext->mount_sec_ctx);
- - }
- -#endif
- #ifdef DEBUG_MOUNT
- DbgEx();
- #endif
- @@ -3913,11 +3885,7 @@ NTSTATUS nfs41_Create(
- status = check_nfs41_create_args(RxContext);
- if (status) goto out;
- -#if defined(STORE_MOUNT_SEC_CONTEXT) && defined (USE_MOUNT_SEC_CONTEXT)
- - status = nfs41_UpcallCreate(NFS41_OPEN, &pVNetRootContext->mount_sec_ctx,
- -#else
- status = nfs41_UpcallCreate(NFS41_OPEN, NULL,
- -#endif
- pVNetRootContext->session, INVALID_HANDLE_VALUE,
- pNetRootContext->nfs41d_version,
- SrvOpen->pAlreadyPrefixedName, &entry);
- @@ -3980,12 +3948,12 @@ retry_on_link:
- }
- status = nfs41_UpcallWaitForReply(entry, pVNetRootContext->timeout);
- -#ifndef USE_MOUNT_SEC_CONTEXT
- +
- if (entry->psec_ctx == &entry->sec_ctx) {
- SeDeleteClientSecurity(entry->psec_ctx);
- }
- entry->psec_ctx = NULL;
- -#endif
- +
- if (status) goto out;
- if (entry->u.Open.EaMdl) {
- @@ -4077,13 +4045,12 @@ retry_on_link:
- #endif
- nfs41_fobx = (PNFS41_FOBX)(RxContext->pFobx)->Context;
- nfs41_fobx->nfs41_open_state = entry->open_state;
- -#ifndef USE_MOUNT_SEC_CONTEXT
- +
- status = nfs41_get_sec_ctx(SecurityImpersonation, &nfs41_fobx->sec_ctx);
- if (status)
- goto out_free;
- -#else
- - RtlCopyMemory(&nfs41_fobx->sec_ctx, &pVNetRootContext->mount_sec_ctx,
- - sizeof(nfs41_fobx->sec_ctx));
- +#if 1
- + ObReferenceObject(nfs41_fobx->sec_ctx.ClientToken);
- #endif
- // we get attributes only for data access and file (not directories)
- @@ -4384,9 +4351,17 @@ NTSTATUS nfs41_CloseSrvOpen(
- entry->u.Close.renamed = nfs41_fcb->Renamed;
- status = nfs41_UpcallWaitForReply(entry, pVNetRootContext->timeout);
- -#ifndef USE_MOUNT_SEC_CONTEXT
- +
- +#if 1
- + if (!RxContext->pFcb->OpenCount) {
- + ObDereferenceObject(nfs41_fobx->sec_ctx.ClientToken);
- + SeDeleteClientSecurity(&nfs41_fobx->sec_ctx);
- + nfs41_fobx->sec_ctx.ClientToken = NULL;
- + }
- +#else
- SeDeleteClientSecurity(&nfs41_fobx->sec_ctx);
- #endif
- +
- if (status) goto out;
- /* map windows ERRORs to NTSTATUS */
- @@ -7179,6 +7154,12 @@ VOID fcbopen_main(PVOID ctx)
- cur->ChangeTime, cur->skip);
- #endif
- if (cur->skip) goto out;
- +
- +#if 1
- + if (cur->nfs41_fobx->sec_ctx.ClientToken == NULL) {
- + goto out;
- + }
- +#endif
- pNetRootContext =
- NFS41GetNetRootExtension(cur->fcb->pNetRoot);
- /* place an upcall for this srv_open */
non-working fix for crash in |fcbopen_main()|
Posted by Anonymous on Fri 10th May 2024 10: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.