- diff --git a/daemon/acl.c b/daemon/acl.c
- index 1d1eac4..4297722 100644
- --- a/daemon/acl.c
- +++ b/daemon/acl.c
- @@ -223,6 +223,18 @@ static int map_name_2_sid(nfs41_daemon_globals *nfs41dg, int query, DWORD *sid_l
- name = "roland_mainz";
- dprintf(ACLLVL, "map_name_2_sid: remap 1616 --> roland_mainz\n");
- }
- + else if (!strcmp(name, "swulsch")) {
- + name = "siegfried_wulsch";
- + dprintf(ACLLVL, "map_name_2_sid: remap swulsch --> siegfried_wulsch\n");
- + }
- + else if (!strcmp(name, "197609")) {
- + name = "siegfried_wulsch";
- + dprintf(ACLLVL, "map_name_2_sid: remap 197609 --> siegfried_wulsch\n");
- + }
- + else if (!strcmp(name, "1818")) {
- + name = "siegfried_wulsch";
- + dprintf(ACLLVL, "map_name_2_sid: remap 1818 --> siegfried_wulsch\n");
- + }
- }
- #endif /* NFS41_DRIVER_FEATURE_MAP_UNMAPPED_USER_TO_UNIXUSER_SID */
- diff --git a/daemon/getattr.c b/daemon/getattr.c
- index 7c5f241..e56f8ca 100644
- --- a/daemon/getattr.c
- +++ b/daemon/getattr.c
- @@ -59,8 +59,19 @@ int nfs41_cached_getattr(
- static int parse_getattr(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall)
- {
- int status;
- +#if 1
- + EASSERT(length > 4);
- + if (length <= 4) {
- + status = ERROR_INVALID_PARAMETER;
- + goto out;
- + }
- + EASSERT(upcall->state_ref != NULL);
- + if (upcall->state_ref == NULL) {
- + status = ERROR_INVALID_PARAMETER;
- + goto out;
- + }
- +#endif
- getattr_upcall_args *args = &upcall->args.getattr;
- -
- status = safe_read(&buffer, &length, &args->query_class, sizeof(args->query_class));
- if (status) goto out;
- status = safe_read(&buffer, &length, &args->buf_len, sizeof(args->buf_len));
- @@ -80,6 +91,21 @@ static int handle_getattr(void *daemon_context, nfs41_upcall *upcall)
- nfs41_open_state *state = upcall->state_ref;
- nfs41_file_info info = { 0 };
- +#if 1
- + if (((char *)state->session) == ((char *)0xdddddddddddddddd)) {
- + eprintf("handle_getattr: Invalid session pointer 0xdddddddddddddddd\n");
- + status = ERROR_INVALID_PARAMETER;
- + goto out;
- + }
- +
- + EASSERT(state->file.fh.superblock != NULL);
- + if (state->file.fh.superblock == NULL) {
- + /* gisburn: fixme: maybe this should be |ERROR_INTERNAL_ERROR| ? */
- + status = ERROR_INVALID_PARAMETER;
- + goto out;
- + }
- +#endif
- +
- status = nfs41_cached_getattr(state->session, &state->file, &info);
- if (status) {
- eprintf("nfs41_cached_getattr() failed with %d\n", status);
- diff --git a/daemon/idmap.c b/daemon/idmap.c
- index 00af1fe..6947b6c 100644
- --- a/daemon/idmap.c
- +++ b/daemon/idmap.c
- @@ -133,7 +133,7 @@ static const struct config_option g_options[] = {
- OPT_ATTR("ldap_attr_gidNumber", "gidNumber", ATTR_GID),
- /* caching configuration */
- - OPT_INT("cache_ttl", "60", cache_ttl),
- + OPT_INT("cache_ttl", "6000", cache_ttl),
- };
- diff --git a/daemon/open.c b/daemon/open.c
- index 3071041..23e9017 100644
- --- a/daemon/open.c
- +++ b/daemon/open.c
- @@ -99,6 +99,24 @@ static void open_state_free(
- void nfs41_open_state_ref(
- IN nfs41_open_state *state)
- {
- +#if 1
- + /*
- + * gisburn: fixme: sometimes this happens under high parallel
- + * usage with multiple mounts - but why ?
- + * 0:038> kp
- + * Child-SP RetAddr Call Site
- + * 0000006d`431fde10 00007ff7`32f7d905 nfsd!nfs41_open_state_ref(struct __nfs41_open_state * state = 0x00000000`00000000)+0x31
- + * 0000006d`431fdf30 00007ff7`32f4d284 nfsd!upcall_parse(unsigned char * buffer = 0x0000006d`431fe180 "???", unsigned int length = 8, struct __nfs41_upcall * upcall = 0x0000006d`431ff1e0)+0x2e5
- + * 0000006d`431fe0b0 00007ffc`1ca24c7c nfsd!thread_main(void * args = 0x00007ff7`32fb6080)+0x144
- + * 0000006d`431ffe00 00007ffc`4d4b7344 ucrtbased!thread_start<unsigned int (void * parameter = 0x0000025d`a9c6def0)+0x9c
- + * 0000006d`431ffe60 00007ffc`4efc26b1 KERNEL32!BaseThreadInitThunk+0x14
- + * 0000006d`431ffe90 00000000`00000000 ntdll!RtlUserThreadStart+0x21
- + */
- + EASSERT(state != NULL);
- + if (state == NULL)
- + return;
- +#endif
- +
- const LONG count = InterlockedIncrement(&state->ref_count);
- dprintf(2, "nfs41_open_state_ref(%s) count %d\n", state->path.path, count);
- diff --git a/daemon/upcall.c b/daemon/upcall.c
- index bd13c61..6303147 100644
- --- a/daemon/upcall.c
- +++ b/daemon/upcall.c
- @@ -121,6 +121,7 @@ int upcall_parse(
- /* parse the operation's arguments */
- op = g_upcall_op_table[upcall->opcode];
- if (op && op->parse) {
- + EASSERT(length > 0);
- status = op->parse(buffer, length, upcall);
- if (status) {
- eprintf("parsing of upcall '%s' failed with %d.\n",
- diff --git a/sys/nfs41_build_features.h b/sys/nfs41_build_features.h
- index 93ee7a9..d43334a 100644
- --- a/sys/nfs41_build_features.h
- +++ b/sys/nfs41_build_features.h
- @@ -32,19 +32,19 @@
- /*
- * NFS41_DRIVER_FEATURE_LOCAL_UIDGID_IN_NFSV3ATTRIBUTES - return local uid/gid values
- */
- -// #define NFS41_DRIVER_FEATURE_LOCAL_UIDGID_IN_NFSV3ATTRIBUTES 1
- +#define NFS41_DRIVER_FEATURE_LOCAL_UIDGID_IN_NFSV3ATTRIBUTES 1
- /*
- * NFS41_DRIVER_FEATURE_MAP_UNMAPPED_USER_TO_UNIXUSER_SID - give NFS
- * files which do not map to a local account a SID in the
- * Unix_User+x/Unix_Group+x range
- */
- -// #define NFS41_DRIVER_FEATURE_MAP_UNMAPPED_USER_TO_UNIXUSER_SID 1
- +#define NFS41_DRIVER_FEATURE_MAP_UNMAPPED_USER_TO_UNIXUSER_SID 1
- /*
- * NFS41_DRIVER_FEATURE_NAMESERVICE_CYGWIN - use Cygwin /usr/bin/getent
- * as "name service"
- */
- -// #define NFS41_DRIVER_FEATURE_NAMESERVICE_CYGWIN 1
- +#define NFS41_DRIVER_FEATURE_NAMESERVICE_CYGWIN 1
- #endif /* !_NFS41_DRIVER_BUILDFEATURES_ */
- diff --git a/sys/nfs41_driver.c b/sys/nfs41_driver.c
- index 0368732..ff0a54f 100644
- --- a/sys/nfs41_driver.c
- +++ b/sys/nfs41_driver.c
- @@ -1008,7 +1008,11 @@ NTSTATUS marshal_nfs41_filequery(
- if (status) goto out;
- else tmp += *len;
- - header_len = *len + 2 * sizeof(ULONG);
- + header_len = *len + 2 * sizeof(ULONG)
- +#if 1
- ++ 2*sizeof(HANDLE)
- +#endif
- + ;
- if (header_len > buf_len) {
- status = STATUS_INSUFFICIENT_RESOURCES;
- goto out;
- @@ -1484,6 +1488,7 @@ NTSTATUS nfs41_UpcallWaitForReply(
- /* 02/15/2011 cbodley: added NFS41_UNLOCK for the same reason. locking
- * tests were triggering an interrupted unlock, which led to a bugcheck
- * in CloseSrvOpen() */
- +retry_wait:
- #define MAKE_WAITONCLOSE_NONITERRUPTABLE
- #ifdef MAKE_WAITONCLOSE_NONITERRUPTABLE
- if (entry->opcode == NFS41_CLOSE || entry->opcode == NFS41_UNLOCK)
- @@ -1509,9 +1514,12 @@ NTSTATUS nfs41_UpcallWaitForReply(
- goto out;
- switch(status) {
- - case STATUS_SUCCESS: break;
- case STATUS_USER_APC:
- case STATUS_ALERTED:
- + DbgP("retry waiting for '%s' entry=%p xid=%lld\n",
- + opcode2string(entry->opcode), entry, entry->xid);
- + goto retry_wait;
- + case STATUS_SUCCESS: break;
- default:
- ExAcquireFastMutex(&entry->lock);
- if (entry->state == NFS41_DONE_PROCESSING) {
- @@ -2502,7 +2510,11 @@ NTSTATUS _nfs41_CreateSrvCall(
- }
- /* Let's create our own representation of the server */
- - pServerEntry = (PNFS41_SERVER_ENTRY)RxAllocatePoolWithTag(PagedPool,
- +#if 1
- + pServerEntry = (PNFS41_SERVER_ENTRY)RxAllocatePoolWithTag(PagedPool,
- +#else
- + pServerEntry = (PNFS41_SERVER_ENTRY)RxAllocatePoolWithTag(NonPagedPool,
- +#endif
- sizeof(NFS41_SERVER_ENTRY), NFS41_MM_POOLTAG);
- if (pServerEntry == NULL) {
- status = STATUS_INSUFFICIENT_RESOURCES;
- @@ -5278,9 +5290,24 @@ NTSTATUS nfs41_QueryFileInformation(
- DbgEn();
- print_debug_filedirquery_header(RxContext);
- #endif
- + DbgP("--> nfs41_QueryFileInformation, RxContext->Info.LengthRemaining=%ld, "
- + "RxContext->LowIoContext.ParamsFor.IoCtl.InputBufferLength=%ld\n",
- + (long)RxContext->Info.LengthRemaining,
- + (long)RxContext->LowIoContext.ParamsFor.IoCtl.InputBufferLength);
- status = check_nfs41_dirquery_args(RxContext);
- - if (status) goto out;
- + if (status) {
- + print_error("check_nfs41_dirquery_args failed.\n");
- + goto out;
- + }
- +
- + RtlZeroMemory(RxContext->Info.Buffer, RxContext->Info.LengthRemaining);
- +
- + DbgP("nfs41_QueryFileInformation, RxContext->Info.LengthRemaining=%ld, "
- + "RxContext->LowIoContext.ParamsFor.IoCtl.{InputBufferLength=%ld,OutputBufferLength=%ld}\n",
- + (long)RxContext->Info.LengthRemaining,
- + (long)RxContext->LowIoContext.ParamsFor.IoCtl.InputBufferLength,
- + (long)RxContext->LowIoContext.ParamsFor.IoCtl.OutputBufferLength);
- switch (InfoClass) {
- case FileEaInformation:
- @@ -5307,19 +5334,27 @@ NTSTATUS nfs41_QueryFileInformation(
- status = nfs41_UpcallCreate(NFS41_FILE_QUERY, &nfs41_fobx->sec_ctx,
- pVNetRootContext->session, nfs41_fobx->nfs41_open_state,
- pNetRootContext->nfs41d_version, SrvOpen->pAlreadyPrefixedName, &entry);
- - if (status) goto out;
- + if (status) {
- + print_error("nfs41_UpcallCreate() failed, status=%d\n", status);
- + goto out;
- + }
- entry->u.QueryFile.InfoClass = InfoClass;
- entry->buf = RxContext->Info.Buffer;
- entry->buf_len = RxContext->Info.LengthRemaining;
- status = nfs41_UpcallWaitForReply(entry, pVNetRootContext->timeout);
- - if (status) goto out;
- -
- + if (status) {
- + print_error("nfs41_UpcallWaitForReply() failed, status=%d\n", status);
- + goto out;
- + }
- +
- if (entry->status == STATUS_BUFFER_TOO_SMALL) {
- RxContext->InformationToReturn = entry->buf_len;
- + print_error("entry->status == STATUS_BUFFER_TOO_SMALL\n");
- status = STATUS_BUFFER_TOO_SMALL;
- } else if (entry->status == STATUS_SUCCESS) {
- + print_error("entry->status == STATUS_SUCCESS\n");
- BOOLEAN DeletePending = FALSE;
- #ifdef ENABLE_TIMINGS
- InterlockedIncrement(&getattr.sops);
- @@ -5375,9 +5410,12 @@ NTSTATUS nfs41_QueryFileInformation(
- print_std_info(1, &nfs41_fcb->StandardInfo);
- #endif
- break;
- + default:
- + print_error("Unhandled/unsupported InfoClass(%d)\n", (int)InfoClass);
- }
- } else {
- status = map_queryfile_error(entry->status);
- + print_error("status(0x%lx) = map_queryfile_error(entry->status(0x%lx));\n", (long)status, (long)entry->status);
- }
- RxFreePool(entry);
- out:
- @@ -5393,6 +5431,7 @@ out:
- #ifdef DEBUG_FILE_QUERY
- DbgEx();
- #endif
- + DbgP("<-- nfs41_QueryFileInformation, status=0x%lx\n", (long)status);
- return status;
- }
Test patches for getattr
Posted by Anonymous on Sat 4th Nov 2023 14:01
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.