Date: Thu, 14 Aug 2008 18:28:59 GMT From: Edward Tomasz Napierala <trasz@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 147402 for review Message-ID: <200808141828.m7EISxvn023915@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=147402 Change 147402 by trasz@trasz_traszkan on 2008/08/14 18:28:04 Make inheritance in UFS work just as in ZFS. There is some non-standard behaviour, but 1. it is the same thing ZFS does and 2. it does not elevate privileges or loosen restrictions in any way; actually it does the reverse. Affected files ... .. //depot/projects/soc2008/trasz_nfs4acl/sys/kern/subr_acl_nfs4.c#25 edit Differences ... ==== //depot/projects/soc2008/trasz_nfs4acl/sys/kern/subr_acl_nfs4.c#25 (text+ko) ==== @@ -804,7 +804,7 @@ const struct acl *parent_aclp, mode_t mode, int file_owner_id, int is_directory) { - int i, error; + int i, error, flags; const struct acl_entry *parent_entry; struct acl_entry *entry, *copy; @@ -822,14 +822,30 @@ */ for (i = 0; i < parent_aclp->acl_cnt; i++) { parent_entry = &(parent_aclp->acl_entry[i]); + flags = parent_entry->ae_flags; + + /* + * Entry is not inheritable at all. + */ + if ((flags & (ACL_ENTRY_DIRECTORY_INHERIT | + ACL_ENTRY_FILE_INHERIT)) == 0) + continue; - if (((parent_entry->ae_flags & - ACL_ENTRY_FILE_INHERIT) == 0) && !is_directory) + /* + * We're creating a file, but entry is not inheritable + * by files. + */ + if (!is_directory && (flags & ACL_ENTRY_FILE_INHERIT) == 0) continue; - if ((parent_entry->ae_flags & - (ACL_ENTRY_DIRECTORY_INHERIT | - ACL_ENTRY_FILE_INHERIT)) == 0) + /* + * Entry is inheritable only by files, but has NO_PROPAGATE + * flag set, and we're creating a directory, so it wouldn't + * propagate to any file in that directory anyway. + */ + if (is_directory && + (flags & ACL_ENTRY_DIRECTORY_INHERIT) == 0 && + (flags & ACL_ENTRY_LIMIT_INHERIT)) continue; KASSERT(child_aclp->acl_cnt + 1 <= ACL_MAX_ENTRIES, @@ -846,6 +862,16 @@ entry = &(child_aclp->acl_entry[i]); /* + * This is not in the specification, but SunOS + * apparently does that. + */ + if (((entry->ae_flags & ACL_ENTRY_LIMIT_INHERIT) || + (entry->ae_flags & ACL_ENTRY_DIRECTORY_INHERIT) == 0 || + !is_directory) && + entry->ae_extended == ACL_EXTENDED_ALLOW) + entry->ae_perm &= ~(ACL_WRITE_ACL | ACL_WRITE_OWNER); + + /* * 2.A. If the ACL_ENTRY_LIMIT_INHERIT is set, or if the object * being created is not a directory, then clear the * following flags: ACL_ENTRY_LIMIT_INHERIT, @@ -859,14 +885,6 @@ ACL_ENTRY_ONLY_INHERIT); /* - * This is not in the specification, but SunOS - * apparently does that. - */ - if (entry->ae_extended == ACL_EXTENDED_ALLOW) - entry->ae_perm &= ~(ACL_WRITE_ACL | - ACL_WRITE_OWNER); - - /* * Continue on to the next ACE. */ continue;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200808141828.m7EISxvn023915>