From owner-svn-src-all@FreeBSD.ORG Sat Jan 30 14:54:13 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3918A1065670; Sat, 30 Jan 2010 14:54:13 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0D1928FC1A; Sat, 30 Jan 2010 14:54:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o0UEsCmK024059; Sat, 30 Jan 2010 14:54:12 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o0UEsCDb024057; Sat, 30 Jan 2010 14:54:12 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201001301454.o0UEsCDb024057@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sat, 30 Jan 2010 14:54:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203191 - stable/8/usr.bin/find X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jan 2010 14:54:13 -0000 Author: trasz Date: Sat Jan 30 14:54:12 2010 New Revision: 203191 URL: http://svn.freebsd.org/changeset/base/203191 Log: MFC r196839: Add NFSv4 ACL support to find(1). Modified: stable/8/usr.bin/find/function.c Directory Properties: stable/8/usr.bin/find/ (props changed) Modified: stable/8/usr.bin/find/function.c ============================================================================== --- stable/8/usr.bin/find/function.c Sat Jan 30 14:51:24 2010 (r203190) +++ stable/8/usr.bin/find/function.c Sat Jan 30 14:54:12 2010 (r203191) @@ -371,38 +371,48 @@ c_mXXdepth(OPTION *option, char ***argvp int f_acl(PLAN *plan __unused, FTSENT *entry) { - int match, entries; - acl_entry_t ae; acl_t facl; + acl_type_t acl_type; + int acl_supported = 0, ret, trivial; if (S_ISLNK(entry->fts_statp->st_mode)) return 0; - if ((match = pathconf(entry->fts_accpath, _PC_ACL_EXTENDED)) <= 0) { - if (match < 0 && errno != EINVAL) - warn("%s", entry->fts_accpath); - else - return 0; + ret = pathconf(entry->fts_accpath, _PC_ACL_NFS4); + if (ret > 0) { + acl_supported = 1; + acl_type = ACL_TYPE_NFS4; + } else if (ret < 0 && errno != EINVAL) { + warn("%s", entry->fts_accpath); + return (0); } - match = 0; - if ((facl = acl_get_file(entry->fts_accpath,ACL_TYPE_ACCESS)) != NULL) { - if (acl_get_entry(facl, ACL_FIRST_ENTRY, &ae) == 1) { - /* - * POSIX.1e requires that ACLs of type ACL_TYPE_ACCESS - * must have at least three entries (owner, group, - * other). - */ - entries = 1; - while (acl_get_entry(facl, ACL_NEXT_ENTRY, &ae) == 1) { - if (++entries > 3) { - match = 1; - break; - } - } + if (acl_supported == 0) { + ret = pathconf(entry->fts_accpath, _PC_ACL_EXTENDED); + if (ret > 0) { + acl_supported = 1; + acl_type = ACL_TYPE_ACCESS; + } else if (ret < 0 && errno != EINVAL) { + warn("%s", entry->fts_accpath); + return (0); } - acl_free(facl); - } else + } + if (acl_supported == 0) + return (0); + + facl = acl_get_file(entry->fts_accpath, acl_type); + if (facl == NULL) { warn("%s", entry->fts_accpath); - return match; + return (0); + } + ret = acl_is_trivial_np(facl, &trivial); + acl_free(facl); + if (ret) { + warn("%s", entry->fts_accpath); + acl_free(facl); + return (0); + } + if (trivial) + return (0); + return (1); } PLAN *