- 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/daemon_debug.h b/daemon/daemon_debug.h
- index f484d58..85b0507 100644
- --- a/daemon/daemon_debug.h
- +++ b/daemon/daemon_debug.h
- @@ -34,6 +34,11 @@
- #define DEFAULT_DEBUG_LEVEL 1
- +#define DASSERT(exp) \
- + if (!(exp)) { \
- + dprintf(0, "ASSERTION '%s' in %s/%ld failed.\n", \
- + __FILE__, (long)__LINE__, ""#exp""); }
- +
- /* daemon_debug.h */
- void set_debug_level(int level);
- void dprintf(int level, LPCSTR format, ...);
- 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..18a763a 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..67c9bf6 100644
- --- a/daemon/nfs41_xdr.c
- +++ b/daemon/nfs41_xdr.c
- @@ -1802,19 +1802,33 @@ 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;
- + }
- + DASSERT(owner_len > 0);
- + DASSERT(owner_len < sizeof(info->owner_group_buf));
- 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;
- + }
- + DASSERT(owner_group_len > 0);
- + DASSERT(owner_group_len < sizeof(info->owner_group_buf));
- 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..d1220b3 100644
- --- a/daemon/open.c
- +++ b/daemon/open.c
- @@ -664,32 +664,19 @@ 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];
- + char owner[NFS4_OPAQUE_LIMIT], owner_group[NFS4_OPAQUE_LIMIT];
- nfsacl41 acl = { 0 };
- - /*
- - * gisburn:
- - * 1. We should cache owner/group information
- - * 2. We should always ask for
- - * FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP with the other
- - * attributes
- - */
- - 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;
- - 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);
- - }
- -
- uid_t map_uid = -1;
- gid_t gid_dummy = -1;
- gid_t map_gid = -1;
- char *at_ch; /* pointer to '@' */
- + DASSERT(info.owner != NULL);
- + DASSERT(info.owner_group != NULL);
- + (void)strcpy(owner, info.owner?info.owner:"<FIXME_OWNER>");
- + (void)strcpy(owner_group, info.owner_group?info.owner_group:"<FIXME_GROUP>");
- +
- /*
- * Map owner to local uid
- *
- @@ -697,12 +684,12 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
- * ("gisburn") or username@domain ("gisburn@sun.com")
- */
- /* stomp over '@' */
- - if (at_ch = strchr(og_info.owner, '@'))
- + if (at_ch = strchr(owner, '@'))
- *at_ch = '\0';
- if (nfs41_idmap_name_to_ids(
- nfs41dg->idmapper,
- - og_info.owner,
- + owner,
- &map_uid,
- &gid_dummy) == 0) {
- args->owner_local_uid = map_uid;
- @@ -711,7 +698,7 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
- args->owner_local_uid = NFS_USER_NOBODY_UID;
- eprintf("get_stat_data: "
- "no username mapping for '%s', fake uid=%d\n",
- - og_info.owner, args->owner_local_uid);
- + owner, args->owner_local_uid);
- }
- /*
- @@ -721,12 +708,12 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
- * ("gisgrp") or username@domain ("gisgrp@sun.com")
- */
- /* stomp over '@' */
- - if (at_ch = strchr(og_info.owner_group, '@'))
- + if (at_ch = strchr(owner_group, '@'))
- *at_ch = '\0';
- if (nfs41_idmap_group_to_gid(
- nfs41dg->idmapper,
- - og_info.owner_group,
- + owner_group,
- &map_gid) == 0) {
- args->owner_group_local_gid = map_gid;
- }
- @@ -734,12 +721,12 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
- args->owner_group_local_gid = NFS_GROUP_NOGROUP_GID;
- eprintf("get_stat_data: "
- "no group mapping for '%s', fake gid=%d\n",
- - og_info.owner_group, args->owner_group_local_gid);
- + owner_group, args->owner_group_local_gid);
- }
- dprintf(1, "handle_open: stat: owner=%u/'%s', owner_group=%u/'%s'\n",
- - (unsigned int)args->owner_local_uid, og_info.owner,
- - (unsigned int)args->owner_group_local_gid, og_info.owner_group);
- + (unsigned int)args->owner_local_uid, owner,
- + (unsigned int)args->owner_group_local_gid, owner_group);
- #endif /* NFS41_DRIVER_FEATURE_LOCAL_UIDGID_IN_NFSV3ATTRIBUTES */
- } else {
- nfs41_file_info createattrs = { 0 };
- 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 18:05
raw | new post
view followups (newest first): msnfs41client: owner/group name caching prototype by Anonymous
modification of post by Anonymous (view diff)
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.