Non-trivial ACLs only?
Dr. Rolf Jansen
rj at obsigna.com
Tue Jul 15 21:31:16 UTC 2014
Am 15.07.2014 um 02:09 schrieb Edward Tomasz Napierała <trasz at FreeBSD.org>:
> On 0714T1614, Dr. Rolf Jansen wrote:
>> Anyway, I actually start wondering whether my file system cloning tool needs to address the ACLs via the respective API at all. It doesn't want to process any ACL, but if present, only transfer it from the original to the cloned file system item. I will have a closer look now on the posix1e.acl_access, posix1e.acl_default, and nfs4.acl extended attributes. Perhaps it is as simple, to straightly copy over everything what is in the extattr system name space.
>
> Not a good idea - those are UFS-specific; this won't work with ZFS or NFSv4.
OK, I now check the file systems before skipping ACL reading, see the code snippet below.
I got another question though. Is it correct to assume that in the case of non-trivial Access/NFSv4 ACLs the acl_cnt is always greater than 3? This comes to my mind, because the standard UNIX access rights would always occupy 3 ACL entries, and any additional stuff would increase the count, right?
Best regards
Rolf
// Reading the ACLs
if (*gSourceFSType == *(int *)"ufs" && *gDestinFSType == *(int *)"ufs")
// In the case of UFS2 file systems, the ACLs have been read already
// as part of the extended attributes within the system namespace,
// and therefore it is not necessary to read them again.
xmd->acl[0] = xmd->acl[1] = NULL;
else
{
acl_t acl;
int trivial;
if ((acl = acl_get_link_np(src, ACL_TYPE_ACCESS)) &&
(acl_is_trivial_np(acl, &trivial) || trivial))
{
acl_free(acl);
acl = NULL;
}
xmd->acl[0] = acl;
if (!S_ISDIR(st->st_mode))
xmd->acl[1] = NULL;
else
{
if ((acl = acl_get_link_np(src, ACL_TYPE_DEFAULT)) &&
((uint*)acl)[1] == 0)
{
acl_free(acl);
acl = NULL;
}
xmd->acl[1] = acl;
}
}
More information about the posix1e
mailing list