From owner-svn-src-all@FreeBSD.ORG Fri Mar 6 04:21:23 2009 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 A07A410656DB; Fri, 6 Mar 2009 04:21:23 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 73DE58FC14; Fri, 6 Mar 2009 04:21:23 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n264LNDX007728; Fri, 6 Mar 2009 04:21:23 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n264LNvU007726; Fri, 6 Mar 2009 04:21:23 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903060421.n264LNvU007726@svn.freebsd.org> From: Tim Kientzle Date: Fri, 6 Mar 2009 04:21:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189427 - in head/lib/libarchive: . test 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: Fri, 06 Mar 2009 04:21:24 -0000 Author: kientzle Date: Fri Mar 6 04:21:23 2009 New Revision: 189427 URL: http://svn.freebsd.org/changeset/base/189427 Log: Merge r394,r396 from libarchive.googlecode.com: Plug some memory leaks in the ACL test, correctly mark that FreeBSD has acl_get_perm_np(). Modified: head/lib/libarchive/config_freebsd.h head/lib/libarchive/test/test_acl_freebsd.c Modified: head/lib/libarchive/config_freebsd.h ============================================================================== --- head/lib/libarchive/config_freebsd.h Fri Mar 6 01:34:30 2009 (r189426) +++ head/lib/libarchive/config_freebsd.h Fri Mar 6 04:21:23 2009 (r189427) @@ -28,6 +28,7 @@ /* FreeBSD 5.0 and later have ACL support. */ #if __FreeBSD__ > 4 #define HAVE_ACL_CREATE_ENTRY 1 +#define HAVE_ACL_GET_PERM_NP 1 #define HAVE_ACL_INIT 1 #define HAVE_ACL_SET_FD 1 #define HAVE_ACL_SET_FD_NP 1 Modified: head/lib/libarchive/test/test_acl_freebsd.c ============================================================================== --- head/lib/libarchive/test/test_acl_freebsd.c Fri Mar 6 01:34:30 2009 (r189426) +++ head/lib/libarchive/test/test_acl_freebsd.c Fri Mar 6 04:21:23 2009 (r189427) @@ -72,6 +72,8 @@ set_acls(struct archive_entry *ae, struc static int acl_match(acl_entry_t aclent, struct myacl_t *myacl) { + gid_t g, *gp; + uid_t u, *up; acl_tag_t tag_type; acl_permset_t opaque_ps; int permset = 0; @@ -97,7 +99,10 @@ acl_match(acl_entry_t aclent, struct mya case ACL_USER: if (myacl->tag != ARCHIVE_ENTRY_ACL_USER) return (0); - if ((uid_t)myacl->qual != *(uid_t *)acl_get_qualifier(aclent)) + up = acl_get_qualifier(aclent); + u = *up; + acl_free(up); + if ((uid_t)myacl->qual != u) return (0); break; case ACL_GROUP_OBJ: @@ -106,7 +111,10 @@ acl_match(acl_entry_t aclent, struct mya case ACL_GROUP: if (myacl->tag != ARCHIVE_ENTRY_ACL_GROUP) return (0); - if ((gid_t)myacl->qual != *(gid_t *)acl_get_qualifier(aclent)) + gp = acl_get_qualifier(aclent); + g = *gp; + acl_free(gp); + if ((gid_t)myacl->qual != g) return (0); break; case ACL_MASK: @@ -200,10 +208,13 @@ DEFINE_TEST(test_acl_freebsd) /* Create a test file and try to set an ACL on it. */ fd = open("pretest", O_WRONLY | O_CREAT | O_EXCL, 0777); failure("Could not create test file?!"); - if (!assert(fd >= 0)) + if (!assert(fd >= 0)) { + acl_free(acl); return; + } n = acl_set_fd(fd, acl); + acl_free(acl); if (n != 0 && errno == EOPNOTSUPP) { close(fd); skipping("ACL tests require that ACL support be enabled on the filesystem"); @@ -239,5 +250,6 @@ DEFINE_TEST(test_acl_freebsd) acl = acl_get_file("test0", ACL_TYPE_ACCESS); assert(acl != (acl_t)NULL); compare_acls(acl, acls2); + acl_free(acl); #endif }