- diff --git a/daemon/acl.c b/daemon/acl.c
- index 1d1eac4..9c30eeb 100644
- --- a/daemon/acl.c
- +++ b/daemon/acl.c
- @@ -223,6 +223,19 @@ 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/lookup.c b/daemon/lookup.c
- index ea0a9d2..a2862de 100644
- --- a/daemon/lookup.c
- +++ b/daemon/lookup.c
- @@ -85,7 +85,8 @@ static void init_component_args(
- args->attr_request.arr[1] = FATTR4_WORD1_MODE
- | FATTR4_WORD1_NUMLINKS | FATTR4_WORD1_SYSTEM
- | FATTR4_WORD1_TIME_ACCESS | FATTR4_WORD1_TIME_CREATE
- - | FATTR4_WORD1_TIME_MODIFY;
- + | FATTR4_WORD1_TIME_MODIFY
- + | FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP;
- args->getrootattr.attr_request = &args->attr_request;
- res->root.path = path;
- diff --git a/daemon/name_cache.c b/daemon/name_cache.c
- index eaa0f36..3770214 100644
- --- a/daemon/name_cache.c
- +++ b/daemon/name_cache.c
- @@ -401,7 +401,11 @@ struct nfs41_name_cache {
- static __inline bool_t name_cache_enabled(
- IN struct nfs41_name_cache *cache)
- {
- +#if 1
- + return 0; /* fixme: caching of owner/owner_group not supported yet */
- +#else
- return cache->expiration > 0;
- +#endif
- }
- static __inline void name_cache_entry_rename(
- diff --git a/daemon/nfs41_types.h b/daemon/nfs41_types.h
- index c5bad79..abdf2c2 100644
- --- a/daemon/nfs41_types.h
- +++ b/daemon/nfs41_types.h
- @@ -236,6 +236,10 @@ typedef struct __nfs41_file_info {
- char *owner;
- char *owner_group;
- uint32_t aclsupport;
- +
- + /* Buffers */
- + char owner_buf[NFS4_OPAQUE_LIMIT+1];
- + char owner_group_buf[NFS4_OPAQUE_LIMIT+1];
- } nfs41_file_info;
- #endif /* !__NFS41_DAEMON_TYPES_H__ */
- diff --git a/daemon/nfs41_xdr.c b/daemon/nfs41_xdr.c
- index 176b613..94f6d4a 100644
- --- a/daemon/nfs41_xdr.c
- +++ b/daemon/nfs41_xdr.c
- @@ -1802,19 +1802,31 @@ static bool_t decode_file_attrs(
- return FALSE;
- }
- if (attrs->attrmask.arr[1] & FATTR4_WORD1_OWNER) {
- - char *ptr = &info->owner[0];
- + if (info->owner == NULL)
- + info->owner = info->owner_buf;
- +
- + char *ptr = info->owner;
- uint32_t owner_len;
- if (!xdr_bytes(xdr, &ptr, &owner_len,
- - NFS4_OPAQUE_LIMIT))
- + NFS4_OPAQUE_LIMIT)) {
- + info->owner = NULL;
- return FALSE;
- + }
- + /* fixme: add assert |owner_len < buffer size| */
- info->owner[owner_len] = '\0';
- }
- if (attrs->attrmask.arr[1] & FATTR4_WORD1_OWNER_GROUP) {
- - char *ptr = &info->owner_group[0];
- + if (info->owner_group == NULL)
- + info->owner_group = info->owner_group_buf;
- +
- + char *ptr = info->owner_group;
- uint32_t owner_group_len;
- if (!xdr_bytes(xdr, &ptr, &owner_group_len,
- - NFS4_OPAQUE_LIMIT))
- + NFS4_OPAQUE_LIMIT)) {
- + info->owner_group = NULL;
- return FALSE;
- + }
- + /* fixme: add assert |owner_len < buffer size| */
- info->owner_group[owner_group_len] = '\0';
- }
- if (attrs->attrmask.arr[1] & FATTR4_WORD1_SPACE_AVAIL) {
- diff --git a/daemon/open.c b/daemon/open.c
- index 13e82b2..1b60296 100644
- --- a/daemon/open.c
- +++ b/daemon/open.c
- @@ -665,9 +665,11 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
- #ifdef NFS41_DRIVER_FEATURE_LOCAL_UIDGID_IN_NFSV3ATTRIBUTES
- bitmap4 og_attr_request = { 0 };
- nfs41_file_info og_info = { 0 };
- - char owner[NFS4_OPAQUE_LIMIT], group[NFS4_OPAQUE_LIMIT];
- nfsacl41 acl = { 0 };
- +#if 1
- + (void)memcpy(&og_info, &info, sizeof(nfs41_file_info));
- +#else
- /*
- * gisburn:
- * 1. We should cache owner/group information
- @@ -677,14 +679,16 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
- */
- og_attr_request.count = 2;
- og_attr_request.arr[1] = FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP;
- - og_info.owner = owner;
- - og_info.owner_group = group;
- + /* nfs41_getattr() will give us |og_info.owner_buf| on success */
- + og_info.owner = NULL;
- + /* nfs41_getattr() will give us |og_info.owner_group_buf| on success */
- + og_info.owner_group = NULL;
- status = nfs41_getattr(state->session, &state->file, &og_attr_request, &og_info);
- if (status) {
- eprintf("get_stat_data: nfs41_cached_getattr() failed with %d\n",
- status);
- }
- -
- +#endif
- uid_t map_uid = -1;
- gid_t gid_dummy = -1;
- gid_t map_gid = -1;
- 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_ */
msnfs41client: owner/group name caching prototype
Posted by Anonymous on Thu 19th Oct 2023 15:13
raw | new post
view followups (newest first): msnfs41client: owner/group name caching prototype by Anonymous
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.