Date: Wed, 2 Jul 2008 11:09:45 GMT From: Edward Tomasz Napierala <trasz@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 144480 for review Message-ID: <200807021109.m62B9jHc014393@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=144480 Change 144480 by trasz@trasz_traszkan on 2008/07/02 11:09:31 Add support for the new ACLs to ls(1). Affected files ... .. //depot/projects/soc2008/trasz_nfs4acl/bin/ls/print.c#2 edit Differences ... ==== //depot/projects/soc2008/trasz_nfs4acl/bin/ls/print.c#2 (text+ko) ==== @@ -616,9 +616,8 @@ aclmode(char *buf, const FTSENT *p, int *haveacls) { char name[MAXPATHLEN + 1]; - int entries, ret; + int type = ACL_TYPE_ACCESS, ret; acl_t facl; - acl_entry_t ae; /* * Add a + after the standard rwxrwxrwx mode if the file has an @@ -638,29 +637,34 @@ *haveacls = 1; return; } - if ((ret = pathconf(name, _PC_ACL_EXTENDED)) <= 0) { - if (ret < 0 && errno != EINVAL) - warn("%s", name); - else - *haveacls = 0; + + *haveacls = 0; + + ret = pathconf(name, _PC_ACL_EXTENDED); + if (ret > 0) { + type = ACL_TYPE_ACCESS; + *haveacls = 1; + } else if (ret < 0 && errno != EINVAL) { + warn("%s", name); + return; + } + + ret = pathconf(name, _PC_EXTENDED_SECURITY_NP); + if (ret > 0) { + type = ACL_TYPE_NFS4; + *haveacls = 1; + } else if (ret < 0 && errno != EINVAL) { + warn("%s", name); return; } - *haveacls = 1; - if ((facl = acl_get_file(name, ACL_TYPE_ACCESS)) != NULL) { - if (acl_get_entry(facl, ACL_FIRST_ENTRY, &ae) == 1) { - entries = 1; - while (acl_get_entry(facl, ACL_NEXT_ENTRY, &ae) == 1) - if (++entries > 3) - break; - /* - * POSIX.1e requires that ACLs of type ACL_TYPE_ACCESS - * must have at least three entries (owner, group, - * and other). So anything with more than 3 ACLs looks - * interesting to us. - */ - if (entries > 3) - buf[10] = '+'; - } + + if (*haveacls == 0) + return; + + if ((facl = acl_get_file(name, type)) != NULL) { + if (!acl_is_trivial_np(facl)) + buf[10] = '+'; + acl_free(facl); } else warn("%s", name);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200807021109.m62B9jHc014393>