Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Aug 2008 18:51:27 GMT
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 148266 for review
Message-ID:  <200808241851.m7OIpRjH043035@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=148266

Change 148266 by trasz@trasz_traszkan on 2008/08/24 18:51:01

	Fix a case when there is more than one file name given
	in the setfacl(1) command line.

Affected files ...

.. //depot/projects/soc2008/trasz_nfs4acl/TODO#44 edit
.. //depot/projects/soc2008/trasz_nfs4acl/bin/setfacl/setfacl.c#13 edit

Differences ...

==== //depot/projects/soc2008/trasz_nfs4acl/TODO#44 (text+ko) ====

@@ -2,6 +2,9 @@
 
 - Add support for NFS4 ACLs to tar(1).
 
+- Add unit test to verify correct operation if several file names
+  are given to getfacl(1) and setfacl(1).
+
 - Clean up #defines.  For example, make VREAD_NAMED_ATTRS equal
   to ACL_READ_NAMED_ATTRS, so there is no need for translation
   between the two in kern/subr_acl_nfs4.c.

==== //depot/projects/soc2008/trasz_nfs4acl/bin/setfacl/setfacl.c#13 (text+ko) ====

@@ -65,16 +65,6 @@
 	acl_t acl = NULL;
 	struct stat sb;
 
-	if (pathconf(filename, _PC_EXTENDED_SECURITY_NP)) {
-		if (type == ACL_TYPE_ACCESS) {
-			type = ACL_TYPE_NFS4;
-		} else {
-			warnx("%s: there are no default entries in NFS4 ACLs",
-			    filename);
-			return (NULL);
-		}
-	}
-
 	switch (type) {
 	case ACL_TYPE_ACCESS:
 	case ACL_TYPE_NFS4:
@@ -252,15 +242,24 @@
 
 	/* cycle through each file */
 	TAILQ_FOREACH(file, &filelist, next) {
+		local_error = 0;
+
+		if (pathconf(file->filename, _PC_EXTENDED_SECURITY_NP)) {
+			if (acl_type == ACL_TYPE_DEFAULT) {
+				warnx("%s: there are no default entries "
+			           "in NFS4 ACLs", file->filename);
+				continue;
+			}
+
+			acl_type = ACL_TYPE_NFS4;
+
+		} else if (acl_type == ACL_TYPE_NFS4)
+				acl_type = ACL_TYPE_ACCESS;
+
 		acl = get_file_acl(file->filename, acl_type, h_flag);
 		if (acl == NULL)
 			continue;
 
-		local_error = 0;
-
-		if (acl_type != ACL_TYPE_DEFAULT && pathconf(file->filename, _PC_EXTENDED_SECURITY_NP))
-			acl_type = ACL_TYPE_NFS4;
-
 		/* cycle through each option */
 		TAILQ_FOREACH(entry, &entrylist, next) {
 			if (local_error)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200808241851.m7OIpRjH043035>