diff mbox series

[2/6] libnfs4acl: Add support for the NFS4.1 ACE_INHERITED_ACE flag

Message ID 20220514144436.4298-3-trondmy@kernel.org (mailing list archive)
State New
Headers show
Series Allow nfs4-acl-tools to access 'dacl' and 'sacl' | expand

Commit Message

trondmy@kernel.org May 14, 2022, 2:44 p.m. UTC
From: Trond Myklebust <trond.myklebust@hammerspace.com>

Use the letter 'I' to represent an inherited ACE.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
---
 include/libacl_nfs4.h             | 1 +
 include/nfs4.h                    | 1 +
 libnfs4acl/nfs4_ace_from_string.c | 3 +++
 libnfs4acl/nfs4_get_ace_flags.c   | 2 ++
 nfs4_getfacl/nfs4_getfacl.c       | 1 +
 5 files changed, 8 insertions(+)
diff mbox series

Patch

diff --git a/include/libacl_nfs4.h b/include/libacl_nfs4.h
index 76bbe90af54d..d54d82f94f97 100644
--- a/include/libacl_nfs4.h
+++ b/include/libacl_nfs4.h
@@ -54,6 +54,7 @@ 
 #define FLAG_SUCCESSFUL_ACCESS		'S'
 #define FLAG_FAILED_ACCESS		'F'
 #define FLAG_GROUP			'g'
+#define FLAG_INHERITED			'I'
 
 #define PERM_READ_DATA			'r'
 #define PERM_WRITE_DATA			'w'
diff --git a/include/nfs4.h b/include/nfs4.h
index da6eefb7fbc6..20bfa6b99634 100644
--- a/include/nfs4.h
+++ b/include/nfs4.h
@@ -62,6 +62,7 @@ 
 #define NFS4_ACE_SUCCESSFUL_ACCESS_ACE_FLAG   0x00000010
 #define NFS4_ACE_FAILED_ACCESS_ACE_FLAG       0x00000020
 #define NFS4_ACE_IDENTIFIER_GROUP             0x00000040
+#define NFS4_ACE_INHERITED_ACE                0x00000080
 
 #define NFS4_ACE_READ_DATA                    0x00000001
 #define NFS4_ACE_LIST_DIRECTORY               0x00000001
diff --git a/libnfs4acl/nfs4_ace_from_string.c b/libnfs4acl/nfs4_ace_from_string.c
index ab8401ae0629..7f1315434435 100644
--- a/libnfs4acl/nfs4_ace_from_string.c
+++ b/libnfs4acl/nfs4_ace_from_string.c
@@ -209,6 +209,9 @@  struct nfs4_ace * nfs4_ace_from_string(char *ace_buf, int is_dir)
 			case FLAG_GROUP:
 				flags |= NFS4_ACE_IDENTIFIER_GROUP;
 				break;
+			case FLAG_INHERITED:
+				flags |= NFS4_ACE_INHERITED_ACE;
+				break;
 			default:
 				fprintf(stderr,"Bad Ace Flag:%c\n", *field);
 				goto out_free;
diff --git a/libnfs4acl/nfs4_get_ace_flags.c b/libnfs4acl/nfs4_get_ace_flags.c
index 1d28ed4b5196..1f27d17ad4cd 100644
--- a/libnfs4acl/nfs4_get_ace_flags.c
+++ b/libnfs4acl/nfs4_get_ace_flags.c
@@ -53,6 +53,8 @@  char* nfs4_get_ace_flags(struct nfs4_ace *ace, char *buf)
 		*buf++ = FLAG_FAILED_ACCESS;;
 	if (flags & NFS4_ACE_IDENTIFIER_GROUP)
 		*buf++ = FLAG_GROUP;
+	if (flags & NFS4_ACE_INHERITED_ACE)
+		*buf++ = FLAG_INHERITED;
 	*buf = '\0';
 
 	return bp;
diff --git a/nfs4_getfacl/nfs4_getfacl.c b/nfs4_getfacl/nfs4_getfacl.c
index e068095b0d6b..1222dd907c9e 100644
--- a/nfs4_getfacl/nfs4_getfacl.c
+++ b/nfs4_getfacl/nfs4_getfacl.c
@@ -170,6 +170,7 @@  static void more_help()
 	"        'S'  successful-access\n"
 	"        'F'  failed-access\n"
 	"        'g'  group (denotes that <principal> is a group)\n"
+	"        'I'  inherited\n"
 	"\n"
 	"    * <principal> - named user or group, or one of: \"OWNER@\", \"GROUP@\", \"EVERYONE@\"\n"
 	"\n"