Skip to contentSkip to conversation

Add support for -R option in nfs4_getfacl so we can list the ACLs of all files and directories recursively.

PATCH In review Kenneth Dsouza 2 participants 4 messages Feb 7, 2018 – Feb 22, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add support for -R option in nfs4_getfacl so we can list the ACLs of all files and directories recursively.

---
 libnfs4acl/nfs4_acl_for_path.c |  4 ++--
 man/man1/nfs4_getfacl.1        | 10 ++++++++--
 nfs4_getfacl/nfs4_getfacl.c    | 41 ++++++++++++++++++++++++++++++++---------
 3 files changed, 42 insertions(+), 13 deletions(-)
libnfs4acl/nfs4_acl_for_path.c +2 -2
index 7461005..a51dc34 100644
@@ -95,11 +95,11 @@ static int nfs4_getxattr(const char *path, void *value, size_t size)
 		fprintf(stderr,"An internal NFS server error code (%d) was returned; this should never happen.\n",res);
 	} else if (res < 0) {
 		if (errno == ENOATTR)
-			fprintf(stderr,"Attribute not found on file.\n");
+			fprintf(stderr,"Attribute not found on file: %s\n", path);
 		else if (errno == EREMOTEIO)
 		    fprintf(stderr,"An NFS server error occurred.\n");
 		else if (errno == EOPNOTSUPP)
-			fprintf(stderr,"Operation to request attribute not supported.\n");
+			fprintf(stderr,"Operation to request attribute not supported: %s\n", path);
 		else
 			perror("Failed getxattr operation");
 	}
man/man1/nfs4_getfacl.1 +8 -2
index 81c542d..f85d50e 100644
@@ -8,7 +8,7 @@
 .SH NAME
 nfs4_getfacl \- get NFSv4 file/directory access control lists
 .SH SYNOPSIS
-.B nfs4_getfacl [-H]
+.B nfs4_getfacl [-HR]
 file ...
 .SH DESCRIPTION
 .B nfs4_getfacl 
@@ -18,9 +18,15 @@ support ACLs.
 
 If the 
 .BR -H / --more-help
+flag is specified,
+.B nfs4_getfacl
+will print some information about NFSv4 ACLs and the fields used in ACEs.
+
+If the
+.BR -R / --recursive
 flag is specified, 
 .B nfs4_getfacl
-will print some information about NFSv4 ACLs and the fields used in ACEs.  
+will list the NFSv4 ACLs of all files and directories recursively.
 
 The output format for an NFSv4 file ACL, e.g., is:
 .RS
nfs4_getfacl/nfs4_getfacl.c +32 -9

71 lines not on this page · raw message

Signature · 1 line
2.9.5
#1 lore raw

People have been request recursive operation and I keep not getting around to it, thanks for doing this.

How are you testing this?

--b.

#2 lore raw
Quoted 4 lines · J. Bruce Fields

People have been request recursive operation and I keep not getting around to it, thanks for doing this.

How are you testing this?

Also, on top of this patch (which I've committed, thanks) it might also be nice to:

- add -L and -P options to choose whether you want to follow symlinks, as "getfacl" does. I think this is just a matter of passing the right flags to nftw.
- switch to using getopt instead of parsing the flags by hand (looks like nfs4_setfacl already does this).

--b.

#3 lore raw

Thanks for the commit.
I will try to work on (-L and -P) options.
Using getopt sounds good :)

Quoted 16 lines · J. Bruce Fields
Quoted 4 lines · J. Bruce Fields

People have been request recursive operation and I keep not getting around to it, thanks for doing this.

How are you testing this?

Also, on top of this patch (which I've committed, thanks) it might also be nice to:

- add -L and -P options to choose whether you want to follow symlinks, as "getfacl" does. I think this is just a matter of passing the right flags to nftw.
- switch to using getopt instead of parsing the flags by hand (looks like nfs4_setfacl already does this).

--b.