- 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/mount.c b/daemon/mount.c
- index a7b3a8c..853c55f 100644
- --- a/daemon/mount.c
- +++ b/daemon/mount.c
- @@ -73,8 +73,8 @@ static int handle_mount(void *daemon_context, nfs41_upcall *upcall)
- if ((args->path == NULL) || (strlen(args->path) == 0)) {
- eprintf("handle_mount: empty mount root\n");
- - status = ERROR_BAD_NETPATH;
- - goto out;
- +// status = ERROR_BAD_NETPATH;
- +// goto out;
- }
- (void)strcpy_s(hostname, sizeof(hostname), args->hostport);
- diff --git a/daemon/open.c b/daemon/open.c
- index 4b2a335..cba7737 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..1cdcb18 100644
- --- a/daemon/upcall.c
- +++ b/daemon/upcall.c
- @@ -45,7 +45,9 @@ extern const nfs41_upcall_op nfs41_op_volume;
- extern const nfs41_upcall_op nfs41_op_getacl;
- extern const nfs41_upcall_op nfs41_op_setacl;
- +/* keep in sync with nfs41_opcodes in sys/nfs41_driver.h */
- static const nfs41_upcall_op *g_upcall_op_table[] = {
- + NULL,
- &nfs41_op_mount,
- &nfs41_op_unmount,
- &nfs41_op_open,
- @@ -63,7 +65,9 @@ static const nfs41_upcall_op *g_upcall_op_table[] = {
- &nfs41_op_volume,
- &nfs41_op_getacl,
- &nfs41_op_setacl,
- - NULL,
- + NULL, /* reserved */
- + NULL, /* reserved */
- + NULL, /* reserved */
- NULL
- };
- static const uint32_t g_upcall_op_table_size = ARRAYSIZE(g_upcall_op_table);
- @@ -121,6 +125,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/dll/nfs41_np.c b/dll/nfs41_np.c
- index 8b259bb..0b3de6e 100644
- --- a/dll/nfs41_np.c
- +++ b/dll/nfs41_np.c
- @@ -329,6 +329,7 @@ NPGetCaps(
- break;
- case WNNC_NET_TYPE:
- + /* gisburn: should be WNNC_NET_*NFS* */
- rc = WNNC_NET_RDR2SAMPLE;
- break;
- @@ -344,7 +345,7 @@ NPGetCaps(
- break;
- case WNNC_ENUMERATION:
- - rc = WNNC_ENUM_LOCAL;
- + rc = WNNC_ENUM_GLOBAL/*WNNC_ENUM_LOCAL*/;
- break;
- case WNNC_START:
- 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 97f6445..0f80e5e 100644
- --- a/sys/nfs41_driver.c
- +++ b/sys/nfs41_driver.c
- @@ -1329,7 +1329,16 @@ NTSTATUS handle_upcall(
- ULONG cbOut = LowIoContext->ParamsFor.IoCtl.OutputBufferLength;
- unsigned char *pbOut = LowIoContext->ParamsFor.IoCtl.pOutputBuffer;
- + __try {
- status = SeImpersonateClientEx(entry->psec_ctx, NULL);
- + } __except(EXCEPTION_EXECUTE_HANDLER) {
- + NTSTATUS code;
- + code = GetExceptionCode();
- + print_error("Call to SeImpersonateClientEx() failed due to"
- + " exception 0x%0x\n", code);
- + status = STATUS_ACCESS_DENIED;
- + }
- +
- if (status != STATUS_SUCCESS) {
- print_error("SeImpersonateClientEx failed %x\n", status);
- goto out;
- @@ -2832,9 +2841,10 @@ NTSTATUS nfs41_MountConfig_ParseOptions(
- RtlCopyUnicodeString(&Config->SecFlavor, &usValue);
- }
- else {
- - status = STATUS_INVALID_PARAMETER;
- - print_error("Unrecognized option '%ls' -> '%wZ'\n",
- - Name, usValue);
- + //status = STATUS_INVALID_PARAMETER;
- + print_error("Unrecognized option '%ls' -> '%wZ' Option->NextEntryOffset=%ld\n",
- + Name, usValue, (long)Option->NextEntryOffset);
- + break;
- }
- if (Option->NextEntryOffset == 0)
- diff --git a/sys/nfs41_driver.h b/sys/nfs41_driver.h
- index f11eda8..0525eaa 100644
- --- a/sys/nfs41_driver.h
- +++ b/sys/nfs41_driver.h
- @@ -49,26 +49,27 @@
- #define IOCTL_NFS41_WRITE _RDR_CTL_CODE(7, METHOD_BUFFERED)
- #define IOCTL_NFS41_INVALCACHE _RDR_CTL_CODE(8, METHOD_BUFFERED)
- +/* keep in sync with g_upcall_op_table in daemon/upcall.c */
- typedef enum _nfs41_opcodes {
- - NFS41_MOUNT,
- - NFS41_UNMOUNT,
- - NFS41_OPEN,
- - NFS41_CLOSE,
- - NFS41_READ,
- - NFS41_WRITE,
- - NFS41_LOCK,
- - NFS41_UNLOCK,
- - NFS41_DIR_QUERY,
- - NFS41_FILE_QUERY,
- - NFS41_FILE_SET,
- - NFS41_EA_GET,
- - NFS41_EA_SET,
- - NFS41_SYMLINK,
- - NFS41_VOLUME_QUERY,
- - NFS41_ACL_QUERY,
- - NFS41_ACL_SET,
- - NFS41_SHUTDOWN,
- - INVALID_OPCODE
- + INVALID_NULL_OPCODE = 0,
- + NFS41_MOUNT = 1,
- + NFS41_UNMOUNT = 2,
- + NFS41_OPEN = 3,
- + NFS41_CLOSE = 4,
- + NFS41_READ = 5,
- + NFS41_WRITE = 6,
- + NFS41_LOCK = 7,
- + NFS41_UNLOCK = 8,
- + NFS41_DIR_QUERY = 9,
- + NFS41_FILE_QUERY = 10,
- + NFS41_FILE_SET = 11,
- + NFS41_EA_GET = 12,
- + NFS41_EA_SET = 13,
- + NFS41_SYMLINK = 14,
- + NFS41_VOLUME_QUERY = 15,
- + NFS41_ACL_QUERY = 16,
- + NFS41_ACL_SET = 17,
- + NFS41_SHUTDOWN = 18
- } nfs41_opcodes;
- enum rpcsec_flavors {
msnfs41client: Patch, Experiments 2023-11-13
Posted by Anonymous on Tue 14th Nov 2023 09:53
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.