test_compat_solaris_tar_acl.c (313570) | test_compat_solaris_tar_acl.c (315432) |
---|---|
1/*- 2 * Copyright (c) 2003-2009 Tim Kientzle 3 * Copyright (c) 2016 Martin Matuska 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 10 unchanged lines hidden (view full) --- 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26#include "test.h" | 1/*- 2 * Copyright (c) 2003-2009 Tim Kientzle 3 * Copyright (c) 2016 Martin Matuska 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 10 unchanged lines hidden (view full) --- 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26#include "test.h" |
27__FBSDID("$FreeBSD: stable/11/contrib/libarchive/libarchive/test/test_compat_solaris_tar_acl.c 313570 2017-02-11 00:54:16Z mm $"); | 27__FBSDID("$FreeBSD: stable/11/contrib/libarchive/libarchive/test/test_compat_solaris_tar_acl.c 315432 2017-03-16 23:07:35Z mm $"); |
28 29/* 30 * Verify reading entries with POSIX.1e and NFSv4 ACLs from archives created 31 * with Solaris tar. 32 * 33 * This should work on all systems, regardless of whether local filesystems 34 * support ACLs or not. 35 */ --- 186 unchanged lines hidden (view full) --- 222 assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, name, 223 10240)); 224 225 /* First item has access ACLs */ 226 assertA(0 == archive_read_next_header(a, &ae)); 227 failure("One extended ACL should flag all ACLs to be returned."); 228 assertEqualInt(7, archive_entry_acl_reset(ae, 229 ARCHIVE_ENTRY_ACL_TYPE_ACCESS)); | 28 29/* 30 * Verify reading entries with POSIX.1e and NFSv4 ACLs from archives created 31 * with Solaris tar. 32 * 33 * This should work on all systems, regardless of whether local filesystems 34 * support ACLs or not. 35 */ --- 186 unchanged lines hidden (view full) --- 222 assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, name, 223 10240)); 224 225 /* First item has access ACLs */ 226 assertA(0 == archive_read_next_header(a, &ae)); 227 failure("One extended ACL should flag all ACLs to be returned."); 228 assertEqualInt(7, archive_entry_acl_reset(ae, 229 ARCHIVE_ENTRY_ACL_TYPE_ACCESS)); |
230 archive_test_compare_acls(ae, acls0, sizeof(acls0)/sizeof(acls0[0]), | 230 assertEntryCompareAcls(ae, acls0, sizeof(acls0)/sizeof(acls0[0]), |
231 ARCHIVE_ENTRY_ACL_TYPE_ACCESS, 0644); 232 failure("Basic ACLs should set mode to 0644, not %04o", 233 archive_entry_mode(ae)&0777); 234 assert((archive_entry_mode(ae) & 0777) == 0644); 235 236 /* Second item has default and access ACLs */ 237 assertA(0 == archive_read_next_header(a, &ae)); 238 assertEqualInt(6, archive_entry_acl_reset(ae, 239 ARCHIVE_ENTRY_ACL_TYPE_ACCESS)); | 231 ARCHIVE_ENTRY_ACL_TYPE_ACCESS, 0644); 232 failure("Basic ACLs should set mode to 0644, not %04o", 233 archive_entry_mode(ae)&0777); 234 assert((archive_entry_mode(ae) & 0777) == 0644); 235 236 /* Second item has default and access ACLs */ 237 assertA(0 == archive_read_next_header(a, &ae)); 238 assertEqualInt(6, archive_entry_acl_reset(ae, 239 ARCHIVE_ENTRY_ACL_TYPE_ACCESS)); |
240 archive_test_compare_acls(ae, acls1, sizeof(acls1)/sizeof(acls1[0]), | 240 assertEntryCompareAcls(ae, acls1, sizeof(acls1)/sizeof(acls1[0]), |
241 ARCHIVE_ENTRY_ACL_TYPE_ACCESS, 0750); 242 failure("Basic ACLs should set mode to 0750, not %04o", 243 archive_entry_mode(ae)&0777); 244 assert((archive_entry_mode(ae) & 0777) == 0750); 245 assertEqualInt(6, archive_entry_acl_reset(ae, 246 ARCHIVE_ENTRY_ACL_TYPE_DEFAULT)); | 241 ARCHIVE_ENTRY_ACL_TYPE_ACCESS, 0750); 242 failure("Basic ACLs should set mode to 0750, not %04o", 243 archive_entry_mode(ae)&0777); 244 assert((archive_entry_mode(ae) & 0777) == 0750); 245 assertEqualInt(6, archive_entry_acl_reset(ae, 246 ARCHIVE_ENTRY_ACL_TYPE_DEFAULT)); |
247 archive_test_compare_acls(ae, acls2, sizeof(acls2)/sizeof(acls2[0]), | 247 assertEntryCompareAcls(ae, acls2, sizeof(acls2)/sizeof(acls2[0]), |
248 ARCHIVE_ENTRY_ACL_TYPE_DEFAULT, 0750); 249 250 /* Third item has NFS4 ACLs */ 251 assertA(0 == archive_read_next_header(a, &ae)); 252 assertEqualInt(6, archive_entry_acl_reset(ae, 253 ARCHIVE_ENTRY_ACL_TYPE_NFS4)); | 248 ARCHIVE_ENTRY_ACL_TYPE_DEFAULT, 0750); 249 250 /* Third item has NFS4 ACLs */ 251 assertA(0 == archive_read_next_header(a, &ae)); 252 assertEqualInt(6, archive_entry_acl_reset(ae, 253 ARCHIVE_ENTRY_ACL_TYPE_NFS4)); |
254 archive_test_compare_acls(ae, acls3, sizeof(acls3)/sizeof(acls3[0]), | 254 assertEntryCompareAcls(ae, acls3, sizeof(acls3)/sizeof(acls3[0]), |
255 ARCHIVE_ENTRY_ACL_TYPE_NFS4, 0); 256 257 /* Fourth item has NFS4 ACLs and inheritance flags */ 258 assertA(0 == archive_read_next_header(a, &ae)); 259 assertEqualInt(5, archive_entry_acl_reset(ae, 260 ARCHIVE_ENTRY_ACL_TYPE_NFS4)); | 255 ARCHIVE_ENTRY_ACL_TYPE_NFS4, 0); 256 257 /* Fourth item has NFS4 ACLs and inheritance flags */ 258 assertA(0 == archive_read_next_header(a, &ae)); 259 assertEqualInt(5, archive_entry_acl_reset(ae, 260 ARCHIVE_ENTRY_ACL_TYPE_NFS4)); |
261 archive_test_compare_acls(ae, acls4, sizeof(acls4)/sizeof(acls0[4]), | 261 assertEntryCompareAcls(ae, acls4, sizeof(acls4)/sizeof(acls0[4]), |
262 ARCHIVE_ENTRY_ACL_TYPE_NFS4, 0); 263 264 /* Close the archive. */ 265 assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); 266 assertEqualInt(ARCHIVE_OK, archive_read_free(a)); 267} | 262 ARCHIVE_ENTRY_ACL_TYPE_NFS4, 0); 263 264 /* Close the archive. */ 265 assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); 266 assertEqualInt(ARCHIVE_OK, archive_read_free(a)); 267} |