- diff --git a/daemon/acl.c b/daemon/acl.c
- index 54a5815..26dc42e 100644
- --- a/daemon/acl.c
- +++ b/daemon/acl.c
- @@ -100,6 +100,118 @@ static int check_4_special_identifiers(char *who, PSID *sid, DWORD *sid_len,
- return status;
- }
- +static void map_nfs4acemask2winaccessmask(uint32_t nfs4_mask, int file_type, ACCESS_MASK *winmask)
- +{
- + DPRINTF(0,
- + ("--> map_nfs4acemask2winaccessmask("
- + "nfs4_mask=0x%x,file_type=%d)\n",
- + (int)nfs4_mask, file_type));
- + print_nfs_access_mask(1, nfs4_mask);
- + bool is_generic = false;
- +
- + /*
- + * Generic masks
- + * (|ACE4_GENERIC_*| contain multiple bits
- + */
- + if ((nfs4_mask & ACE4_GENERIC_READ) == ACE4_GENERIC_READ) {
- + *winmask |= GENERIC_READ;
- + is_generic = true;
- + }
- + if ((nfs4_mask & ACE4_GENERIC_WRITE) == ACE4_GENERIC_WRITE) {
- + *winmask |= GENERIC_WRITE;
- + is_generic = true;
- + }
- + if ((nfs4_mask & ACE4_GENERIC_EXECUTE) == ACE4_GENERIC_EXECUTE) {
- + *winmask |= GENERIC_EXECUTE;
- + is_generic = true;
- + }
- + if (file_type == NF4DIR) {
- + if ((nfs4_mask & ACE4_ALL_DIR) == ACE4_ALL_DIR) {
- + *winmask |= GENERIC_ALL;
- + is_generic = true;
- + }
- + }
- + else {
- + if ((nfs4_mask & ACE4_ALL_FILE) == ACE4_ALL_FILE) {
- + *winmask |= GENERIC_ALL;
- + is_generic = true;
- + }
- + }
- +#if 0
- + if (is_generic)
- + goto mapping_done;
- +#endif
- + /* Individual flags */
- + if (file_type == NF4DIR) {
- + if (nfs4_mask & ACE4_LIST_DIRECTORY) {
- + *winmask |= FILE_LIST_DIRECTORY;
- + }
- + if (nfs4_mask & ACE4_ADD_FILE) {
- + *winmask |= FILE_ADD_FILE;
- + }
- + if (nfs4_mask & ACE4_ADD_SUBDIRECTORY) {
- + *winmask |= FILE_ADD_SUBDIRECTORY;
- + }
- + if (nfs4_mask & ACE4_DELETE_CHILD) {
- + *winmask |= FILE_DELETE_CHILD;
- + }
- + if (nfs4_mask & ACE4_EXECUTE) {
- + *winmask |= FILE_TRAVERSE;
- + }
- + }
- + else {
- + if (nfs4_mask & ACE4_READ_DATA) {
- + *winmask |= FILE_READ_DATA;
- + }
- + if (nfs4_mask & ACE4_WRITE_DATA) {
- + *winmask |= FILE_WRITE_DATA;
- + }
- + if (nfs4_mask & ACE4_APPEND_DATA) {
- + *winmask |= FILE_APPEND_DATA;
- + }
- + if (nfs4_mask & ACE4_EXECUTE) {
- + *winmask |= FILE_EXECUTE;
- + }
- + }
- +
- +#ifdef NOT_IMPLEMENTED_YET
- + if (nfs4_mask & ACE4_READ_NAMED_ATTRS) {
- + *winmask |= xxx;
- + }
- + if (nfs4_mask & ACE4_WRITE_NAMED_ATTRS) {
- + *winmask |= xxx;
- + }
- +#endif /* NOT_IMPLEMENTED_YET */
- + if (nfs4_mask & ACE4_READ_ATTRIBUTES) {
- + *winmask |= FILE_READ_ATTRIBUTES;
- + }
- + if (nfs4_mask & ACE4_WRITE_ATTRIBUTES) {
- + *winmask |= FILE_WRITE_ATTRIBUTES;
- + }
- + if (nfs4_mask & ACE4_READ_ACL) {
- + *winmask |= READ_CONTROL;
- + }
- + if (nfs4_mask & ACE4_WRITE_ACL) {
- + *winmask |= WRITE_DAC;
- + }
- + if (nfs4_mask & ACE4_WRITE_OWNER) {
- + *winmask |= WRITE_OWNER;
- + }
- + if (nfs4_mask & ACE4_SYNCHRONIZE) {
- + *winmask |= SYNCHRONIZE;
- + }
- + if (nfs4_mask & ACE4_DELETE) {
- + *winmask |= DELETE;
- + }
- +
- +mapping_done:
- + print_windows_access_mask(1, *winmask);
- + DPRINTF(0,
- + ("<-- map_nfs4acemask2winaccessmask("
- + "nfs4_mask=0x%x,file_type=%d,*winmask=0x%x)\n",
- + (int)nfs4_mask, file_type, (int)*winmask));
- +}
- +
- static int convert_nfs4acl_2_dacl(nfs41_daemon_globals *nfs41dg,
- nfsacl41 *acl, int file_type, PACL *dacl_out, PSID **sids_out)
- {
- @@ -162,8 +274,14 @@ static int convert_nfs4acl_2_dacl(nfs41_daemon_globals *nfs41dg,
- for (i = 0; i < acl->count; i++) {
- win_aceflags = 0;
- +#if 0
- // nfs4 acemask should be exactly the same as file access mask
- mask = acl->aces[i].acemask;
- +#else
- + mask = 0;
- + map_nfs4acemask2winaccessmask(acl->aces[i].acemask,
- + file_type, &mask);
- +#endif
- map_nfs4aceflags2winaceflags(acl->aces[i].aceflag, &win_aceflags);
- DPRINTF(ACLLVL, ("aces[%d].who='%s': "
- @@ -523,34 +641,104 @@ static void map_nfs4aceflags2winaceflags(uint32_t nfs4_aceflags, DWORD *win_acef
- (int)nfs4_aceflags, (int)*win_aceflags));
- }
- -static void map_winaccessmask2nfs4acemask(ACCESS_MASK mask, int file_type, uint32_t *nfs4_mask)
- +static void map_winaccessmask2nfs4acemask(ACCESS_MASK winmask, int file_type, uint32_t *nfs4_mask)
- {
- - DPRINTF(ACLLVL,
- - ("--> map_winaccessmask2nfs4acemask(mask=0x%x)\n",
- - (int)mask));
- - print_windows_access_mask(ACLLVL, mask);
- + DPRINTF(0,
- + ("--> map_winaccessmask2nfs4acemask("
- + "winmask=0x%x,file_type=%d)\n",
- + (int)winmask, file_type));
- + print_windows_access_mask(1, winmask);
- /* check if any GENERIC bits set */
- - if (mask & 0xf000000) {
- - if (mask & GENERIC_ALL) {
- + if (winmask & 0xf000000) {
- + if (winmask & GENERIC_ALL) {
- if (file_type == NF4DIR)
- *nfs4_mask |= ACE4_ALL_DIR;
- else
- *nfs4_mask |= ACE4_ALL_FILE;
- } else {
- - if (mask & GENERIC_READ)
- + if (winmask & GENERIC_READ)
- *nfs4_mask |= ACE4_GENERIC_READ;
- - if (mask & GENERIC_WRITE)
- + if (winmask & GENERIC_WRITE)
- *nfs4_mask |= ACE4_GENERIC_WRITE;
- - if (mask & GENERIC_EXECUTE)
- + if (winmask & GENERIC_EXECUTE)
- *nfs4_mask |= ACE4_GENERIC_EXECUTE;
- }
- }
- - else /* ignoring generic and reserved bits */
- + else {
- +#if 0
- + /* ignoring generic and reserved bits */
- *nfs4_mask = mask & 0x00ffffff;
- - print_nfs_access_mask(ACLLVL, *nfs4_mask);
- - DPRINTF(ACLLVL,
- - ("<-- map_winaccessmask2nfs4acemask(mask=0x%x, *nfs4_mask=0x%x)\n",
- - (int)mask, (int)*nfs4_mask));
- +#else
- + /* Individual flags */
- + if (file_type == NF4DIR) {
- + if (winmask & FILE_LIST_DIRECTORY) {
- + *nfs4_mask |= ACE4_LIST_DIRECTORY;
- + }
- + if (winmask & FILE_ADD_FILE) {
- + *nfs4_mask |= ACE4_ADD_FILE;
- + }
- + if (winmask & FILE_ADD_SUBDIRECTORY) {
- + *nfs4_mask |= ACE4_ADD_SUBDIRECTORY;
- + }
- + if (winmask & FILE_DELETE_CHILD) {
- + *nfs4_mask |= ACE4_DELETE_CHILD;
- + }
- + if (winmask & FILE_TRAVERSE) {
- + *nfs4_mask |= ACE4_EXECUTE;
- + }
- + }
- + else {
- + if (winmask & FILE_READ_DATA) {
- + *nfs4_mask |= ACE4_READ_DATA;
- + }
- + if (winmask & FILE_WRITE_DATA) {
- + *nfs4_mask |= ACE4_WRITE_DATA;
- + }
- + if (winmask & FILE_APPEND_DATA) {
- + *nfs4_mask |= ACE4_APPEND_DATA;
- + }
- + if (winmask & FILE_EXECUTE) {
- + *nfs4_mask |= ACE4_EXECUTE;
- + }
- + }
- + }
- +
- +#ifdef NOT_IMPLEMENTED_YET
- + if (winmask & xxx) {
- + *nfs4_mask |= ACE4_READ_NAMED_ATTRS;
- + }
- + if (winmask & xxx) {
- + *nfs4_mask |= ACE4_WRITE_NAMED_ATTRS;
- + }
- +#endif /* NOT_IMPLEMENTED_YET */
- + if (winmask & FILE_READ_ATTRIBUTES) {
- + *nfs4_mask |= ACE4_READ_ATTRIBUTES;
- + }
- + if (winmask & FILE_WRITE_ATTRIBUTES) {
- + *nfs4_mask |= ACE4_WRITE_ATTRIBUTES;
- + }
- + if (winmask & READ_CONTROL) {
- + *nfs4_mask |= ACE4_READ_ACL;
- + }
- + if (winmask & WRITE_DAC) {
- + *nfs4_mask |= ACE4_WRITE_ACL;
- + }
- + if (winmask & WRITE_OWNER) {
- + *nfs4_mask |= ACE4_WRITE_OWNER;
- + }
- + if (winmask & SYNCHRONIZE) {
- + *nfs4_mask |= ACE4_SYNCHRONIZE;
- + }
- + if (winmask & DELETE) {
- + *nfs4_mask |= ACE4_DELETE;
- + }
- +#endif
- +
- + print_nfs_access_mask(1, *nfs4_mask);
- + DPRINTF(0,
- + ("<-- map_winaccessmask2nfs4acemask("
- + "winmask=0x%x,file_type=%d,*nfs4_mask=0x%x)\n",
- + (int)winmask, file_type, (int)*nfs4_mask));
- }
- static int map_nfs4ace_who(PSID sid, PSID owner_sid, PSID group_sid, char *who_out, char *domain, SID_NAME_USE *sid_type_out)
- diff --git a/daemon/daemon_debug.c b/daemon/daemon_debug.c
- index ab4cee6..685ecce 100644
- --- a/daemon/daemon_debug.c
- +++ b/daemon/daemon_debug.c
- @@ -805,7 +805,7 @@ void print_windows_access_mask(int on, ACCESS_MASK m)
- {
- if (!on)
- return;
- - if (!DPRINTF_LEVEL_ENABLED(1))
- + if (!DPRINTF_LEVEL_ENABLED(0))
- return;
- dprintf_out("--> print_windows_access_mask: %x\n", m);
- @@ -878,7 +878,7 @@ void print_windows_access_mask(int on, ACCESS_MASK m)
- void print_nfs_access_mask(int on, int m)
- {
- if (!on) return;
- - if (!DPRINTF_LEVEL_ENABLED(1))
- + if (!DPRINTF_LEVEL_ENABLED(0))
- return;
- dprintf_out("--> print_nfs_access_mask: %x\n", m);
- diff --git a/daemon/nfs41_const.h b/daemon/nfs41_const.h
- index 5010816..9613ea9 100644
- --- a/daemon/nfs41_const.h
- +++ b/daemon/nfs41_const.h
- @@ -373,30 +373,30 @@ enum nfs_ftype4 {
- #define ACE4_WRITE_OWNER 0x00080000
- #define ACE4_SYNCHRONIZE 0x00100000
- -#define ACE4_ALL_FILE ACE4_READ_DATA|ACE4_WRITE_DATA|ACE4_APPEND_DATA| \
- +#define ACE4_ALL_FILE (ACE4_READ_DATA|ACE4_WRITE_DATA|ACE4_APPEND_DATA| \
- ACE4_READ_NAMED_ATTRS|ACE4_WRITE_NAMED_ATTRS|ACE4_EXECUTE| \
- ACE4_READ_ATTRIBUTES|ACE4_WRITE_ATTRIBUTES| \
- ACE4_DELETE|ACE4_READ_ACL|ACE4_WRITE_ACL|ACE4_WRITE_OWNER| \
- - ACE4_SYNCHRONIZE
- -#define ACE4_ALL_DIR ACE4_READ_DATA|ACE4_WRITE_DATA|ACE4_APPEND_DATA| \
- + ACE4_SYNCHRONIZE)
- +#define ACE4_ALL_DIR (ACE4_READ_DATA|ACE4_WRITE_DATA|ACE4_APPEND_DATA| \
- ACE4_READ_NAMED_ATTRS|ACE4_WRITE_NAMED_ATTRS|ACE4_EXECUTE| \
- ACE4_DELETE_CHILD|ACE4_READ_ATTRIBUTES|ACE4_WRITE_ATTRIBUTES| \
- ACE4_DELETE|ACE4_READ_ACL|ACE4_WRITE_ACL|ACE4_WRITE_OWNER| \
- - ACE4_SYNCHRONIZE
- + ACE4_SYNCHRONIZE)
- -#define ACE4_GENERIC_READ ACE4_READ_DATA|ACE4_READ_NAMED_ATTRS| \
- - ACE4_READ_ATTRIBUTES|ACE4_READ_ACL|ACE4_SYNCHRONIZE
- -#define ACE4_GENERIC_WRITE ACE4_WRITE_DATA|ACE4_WRITE_NAMED_ATTRS| \
- - ACE4_WRITE_ATTRIBUTES|ACE4_READ_ACL|ACE4_SYNCHRONIZE
- -#define ACE4_GENERIC_EXECUTE ACE4_EXECUTE|ACE4_READ_ATTRIBUTES| \
- - ACE4_READ_ACL|ACE4_SYNCHRONIZE
- +#define ACE4_GENERIC_READ (ACE4_READ_DATA|ACE4_READ_NAMED_ATTRS| \
- + ACE4_READ_ATTRIBUTES|ACE4_READ_ACL|ACE4_SYNCHRONIZE)
- +#define ACE4_GENERIC_WRITE (ACE4_WRITE_DATA|ACE4_WRITE_NAMED_ATTRS| \
- + ACE4_WRITE_ATTRIBUTES|ACE4_READ_ACL|ACE4_SYNCHRONIZE)
- +#define ACE4_GENERIC_EXECUTE (ACE4_EXECUTE|ACE4_READ_ATTRIBUTES| \
- + ACE4_READ_ACL|ACE4_SYNCHRONIZE)
- -#define ACE4_FILE_ALL_ACCESS ACE4_READ_DATA|ACE4_LIST_DIRECTORY| \
- +#define ACE4_FILE_ALL_ACCESS (ACE4_READ_DATA|ACE4_LIST_DIRECTORY| \
- ACE4_WRITE_DATA|ACE4_ADD_FILE|ACE4_APPEND_DATA|ACE4_ADD_SUBDIRECTORY| \
- ACE4_READ_NAMED_ATTRS|ACE4_WRITE_NAMED_ATTRS|ACE4_EXECUTE| \
- - ACE4_READ_ATTRIBUTES|ACE4_WRITE_ATTRIBUTES
- + ACE4_READ_ATTRIBUTES|ACE4_WRITE_ATTRIBUTES)
- /* ACLS aceflag4 field constants */
- #define ACE4_FILE_INHERIT_ACE 0x00000001
- diff --git a/sys/nfs41_driver.c b/sys/nfs41_driver.c
- index 58a312c..ae86c2a 100644
- --- a/sys/nfs41_driver.c
- +++ b/sys/nfs41_driver.c
- @@ -371,7 +371,11 @@ typedef struct _NFS41_NETROOT_EXTENSION {
- (PNFS41_NETROOT_EXTENSION)((pNetRoot)->Context))
- /* FileSystemName as reported by FileFsAttributeInfo query */
- +#if 1
- #define FS_NAME L"NFS"
- +#else
- +#define FS_NAME L"NFS41"
- +#endif
- #define FS_NAME_LEN (sizeof(FS_NAME) - sizeof(WCHAR))
- #define FS_ATTR_LEN (sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + FS_NAME_LEN)
ACL work, backup 2024-06-15
Posted by Anonymous on Sat 15th Jun 2024 14:11
raw | new post
view followups (newest first): ACL work, backup 2024-06-18 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.