test_acl_pax.c revision 228759
1/*- 2 * Copyright (c) 2003-2007 Tim Kientzle 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25#include "test.h" 26__FBSDID("$FreeBSD: head/lib/libarchive/test/test_acl_pax.c 201247 2009-12-30 05:59:21Z kientzle $"); 27 28/* 29 * Exercise the system-independent portion of the ACL support. 30 * Check that pax archive can save and restore ACL data. 31 * 32 * This should work on all systems, regardless of whether local 33 * filesystems support ACLs or not. 34 */ 35 36static unsigned char buff[16384]; 37 38static unsigned char reference[] = { 39'P','a','x','H','e','a','d','e','r','/','f','i','l','e',0,0,0,0,0,0,0,0,0, 400,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 410,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 420,0,0,'0','0','0','1','4','2',' ',0,'0','0','0','0','0','0',' ',0,'0','0', 43'0','0','0','0',' ',0,'0','0','0','0','0','0','0','0','0','6','2',' ','0', 44'0','0','0','0','0','0','0','0','0','0',' ','0','1','1','7','6','7',0,' ', 45'x',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 460,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 470,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'u','s','t','a','r', 480,'0','0',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 490,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'0','0','0', 50'0','0','0',' ',0,'0','0','0','0','0','0',' ',0,0,0,0,0,0,0,0,0,0,0,0,0,0, 510,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 520,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 530,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 540,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 550,0,0,0,0,0,'1','6',' ','S','C','H','I','L','Y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,0,0,0,'f','i','l','e',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 710,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 720,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 730,0,0,0,'0','0','0','1','4','2',' ',0,'0','0','0','0','0','0',' ',0,'0','0', 74'0','0','0','0',' ',0,'0','0','0','0','0','0','0','0','0','0','0',' ','0', 75'0','0','0','0','0','0','0','0','0','0',' ','0','1','0','0','0','6',0,' ', 76'0',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 770,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 780,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'u','s','t','a','r', 790,'0','0',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 800,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'0','0','0', 81'0','0','0',' ',0,'0','0','0','0','0','0',' ',0,0,0,0,0,0,0,0,0,0,0,0,0,0, 820,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 830,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 840,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 850,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 860,0,0,0,0,0,'P','a','x','H','e','a','d','e','r','/','f','i','l','e',0,0,0, 870,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 880,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 890,0,0,0,0,0,0,0,0,'0','0','0','1','4','2',' ',0,'0','0','0','0','0','0',' ', 900,'0','0','0','0','0','0',' ',0,'0','0','0','0','0','0','0','0','1','7','2', 91' ','0','0','0','0','0','0','0','0','0','0','0',' ','0','1','1','7','7','1', 920,' ','x',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 930,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 940,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'u','s','t', 95'a','r',0,'0','0',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 960,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'0', 97'0','0','0','0','0',' ',0,'0','0','0','0','0','0',' ',0,0,0,0,0,0,0,0,0,0, 980,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 990,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1010,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1020,0,0,0,0,0,0,0,0,0,'7','2',' ','S','C','H','I','L','Y','.','a','c','l','.', 103'a','c','c','e','s','s','=','u','s','e','r',':',':','-','-','x',',','g','r', 104'o','u','p',':',':','r','-','-',',','o','t','h','e','r',':',':','-','w','-', 105',','u','s','e','r',':','u','s','e','r','7','7',':','r','-','-',':','7','7', 10610,'1','6',' ','S','C','H','I','L','Y','.','d','e','v','=','0',10,'1','6', 107' ','S','C','H','I','L','Y','.','i','n','o','=','0',10,'1','8',' ','S','C', 108'H','I','L','Y','.','n','l','i','n','k','=','0',10,0,0,0,0,0,0,0,0,0,0,0, 1090,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1110,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1130,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1140,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1150,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1160,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1170,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1180,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1190,0,0,0,0,0,0,0,0,'f','i','l','e',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1200,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1210,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1220,0,'0','0','0','1','4','2',' ',0,'0','0','0','0','0','0',' ',0,'0','0','0', 123'0','0','0',' ',0,'0','0','0','0','0','0','0','0','0','0','0',' ','0','0', 124'0','0','0','0','0','0','0','0','0',' ','0','1','0','0','0','6',0,' ','0', 1250,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1260,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1270,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'u','s','t','a','r',0, 128'0','0',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1290,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'0','0','0', 130'0','0','0',' ',0,'0','0','0','0','0','0',' ',0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1310,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1320,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1330,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1340,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1350,0,0,0,0,0,'P','a','x','H','e','a','d','e','r','/','f','i','l','e',0,0,0, 1360,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1370,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1380,0,0,0,0,0,0,0,0,'0','0','0','5','4','3',' ',0,'0','0','0','0','0','0',' ', 1390,'0','0','0','0','0','0',' ',0,'0','0','0','0','0','0','0','0','2','4','3', 140' ','0','0','0','0','0','0','0','0','0','0','0',' ','0','1','1','7','7','5', 1410,' ','x',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1420,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1430,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'u','s','t', 144'a','r',0,'0','0',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1450,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'0', 146'0','0','0','0','0',' ',0,'0','0','0','0','0','0',' ',0,0,0,0,0,0,0,0,0,0, 1470,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1480,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1490,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1500,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1510,0,0,0,0,0,0,0,0,0,'1','1','3',' ','S','C','H','I','L','Y','.','a','c','l', 152'.','a','c','c','e','s','s','=','u','s','e','r',':',':','r','-','x',',','g', 153'r','o','u','p',':',':','r','-','-',',','o','t','h','e','r',':',':','-','w', 154'x',',','u','s','e','r',':','u','s','e','r','7','7',':','r','-','-',':','7', 155'7',',','u','s','e','r',':','u','s','e','r','7','8',':','-','-','-',':','7', 156'8',',','g','r','o','u','p',':','g','r','o','u','p','7','8',':','r','w','x', 157':','7','8',10,'1','6',' ','S','C','H','I','L','Y','.','d','e','v','=','0', 15810,'1','6',' ','S','C','H','I','L','Y','.','i','n','o','=','0',10,'1','8', 159' ','S','C','H','I','L','Y','.','n','l','i','n','k','=','0',10,0,0,0,0,0, 1600,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1610,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1620,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1630,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1640,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1650,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1660,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1670,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1680,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1690,0,0,0,0,0,0,0,0,0,0,'f','i','l','e',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1700,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1710,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1720,0,0,0,'0','0','0','5','4','3',' ',0,'0','0','0','0','0','0',' ',0,'0','0', 173'0','0','0','0',' ',0,'0','0','0','0','0','0','0','0','0','0','0',' ','0', 174'0','0','0','0','0','0','0','0','0','0',' ','0','1','0','0','1','3',0,' ', 175'0',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1760,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1770,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'u','s','t','a','r', 1780,'0','0',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1790,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'0','0','0', 180'0','0','0',' ',0,'0','0','0','0','0','0',' ',0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1810,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1820,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1830,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1840,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1850,0,0,0,0,0,'P','a','x','H','e','a','d','e','r','/','f','i','l','e',0,0,0, 1860,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1870,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1880,0,0,0,0,0,0,0,0,'0','0','0','1','4','2',' ',0,'0','0','0','0','0','0',' ', 1890,'0','0','0','0','0','0',' ',0,'0','0','0','0','0','0','0','0','0','6','2', 190' ','0','0','0','0','0','0','0','0','0','0','0',' ','0','1','1','7','6','7', 1910,' ','x',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1920,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1930,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'u','s','t', 194'a','r',0,'0','0',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1950,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'0', 196'0','0','0','0','0',' ',0,'0','0','0','0','0','0',' ',0,0,0,0,0,0,0,0,0,0, 1970,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1980,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1990,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2010,0,0,0,0,0,0,0,0,0,'1','6',' ','S','C','H','I','L','Y','.','d','e','v','=', 202'0',10,'1','6',' ','S','C','H','I','L','Y','.','i','n','o','=','0',10,'1', 203'8',' ','S','C','H','I','L','Y','.','n','l','i','n','k','=','0',10,0,0,0, 2040,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2050,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2060,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2070,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2080,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2090,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2110,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2130,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2140,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2150,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2160,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'f','i','l','e',0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2170,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2180,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2190,0,0,0,0,0,0,0,'0','0','0','1','4','2',' ',0,'0','0','0','0','0','0',' ', 2200,'0','0','0','0','0','0',' ',0,'0','0','0','0','0','0','0','0','0','0','0', 221' ','0','0','0','0','0','0','0','0','0','0','0',' ','0','1','0','0','0','6', 2220,' ','0',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2230,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2240,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'u','s','t', 225'a','r',0,'0','0',0,0,0,0,0,0,0,0,0,0,0,0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0,0,0,0,0,0,0,0, 2530,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2540,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2550,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2560,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2570,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2580,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2590,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; 260 261 262struct acl_t { 263 int type; /* Type of ACL: "access" or "default" */ 264 int permset; /* Permissions for this class of users. */ 265 int tag; /* Owner, User, Owning group, group, other, etc. */ 266 int qual; /* GID or UID of user/group, depending on tag. */ 267 const char *name; /* Name of user/group, depending on tag. */ 268}; 269 270static struct acl_t acls0[] = { 271 { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_EXECUTE, 272 ARCHIVE_ENTRY_ACL_USER_OBJ, 0, "" }, 273 { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_READ, 274 ARCHIVE_ENTRY_ACL_GROUP_OBJ, 0, "" }, 275 { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_WRITE, 276 ARCHIVE_ENTRY_ACL_OTHER, 0, "" }, 277}; 278 279static struct acl_t acls1[] = { 280 { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_EXECUTE, 281 ARCHIVE_ENTRY_ACL_USER_OBJ, -1, "" }, 282 { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_READ, 283 ARCHIVE_ENTRY_ACL_USER, 77, "user77" }, 284 { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_READ, 285 ARCHIVE_ENTRY_ACL_GROUP_OBJ, -1, "" }, 286 { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_WRITE, 287 ARCHIVE_ENTRY_ACL_OTHER, -1, "" }, 288}; 289 290static struct acl_t acls2[] = { 291 { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_EXECUTE | ARCHIVE_ENTRY_ACL_READ, 292 ARCHIVE_ENTRY_ACL_USER_OBJ, -1, "" }, 293 { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_READ, 294 ARCHIVE_ENTRY_ACL_USER, 77, "user77" }, 295 { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, 0, 296 ARCHIVE_ENTRY_ACL_USER, 78, "user78" }, 297 { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_READ, 298 ARCHIVE_ENTRY_ACL_GROUP_OBJ, -1, "" }, 299 { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, 0007, 300 ARCHIVE_ENTRY_ACL_GROUP, 78, "group78" }, 301 { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_WRITE | ARCHIVE_ENTRY_ACL_EXECUTE, 302 ARCHIVE_ENTRY_ACL_OTHER, -1, "" }, 303}; 304 305static void 306set_acls(struct archive_entry *ae, struct acl_t *acls, int n) 307{ 308 int i; 309 310 archive_entry_acl_clear(ae); 311 for (i = 0; i < n; i++) { 312 archive_entry_acl_add_entry(ae, 313 acls[i].type, acls[i].permset, acls[i].tag, acls[i].qual, 314 acls[i].name); 315 } 316} 317 318static int 319acl_match(struct acl_t *acl, int type, int permset, int tag, int qual, const char *name) 320{ 321 if (type != acl->type) 322 return (0); 323 if (permset != acl->permset) 324 return (0); 325 if (tag != acl->tag) 326 return (0); 327 if (tag == ARCHIVE_ENTRY_ACL_USER_OBJ) 328 return (1); 329 if (tag == ARCHIVE_ENTRY_ACL_GROUP_OBJ) 330 return (1); 331 if (tag == ARCHIVE_ENTRY_ACL_OTHER) 332 return (1); 333 if (qual != acl->qual) 334 return (0); 335 if (name == NULL) 336 return (acl->name == NULL || acl->name[0] == '\0'); 337 if (acl->name == NULL) 338 return (name == NULL || name[0] == '\0'); 339 return (0 == strcmp(name, acl->name)); 340} 341 342static void 343compare_acls(struct archive_entry *ae, struct acl_t *acls, int n, int mode) 344{ 345 int *marker = malloc(sizeof(marker[0]) * n); 346 int i; 347 int r; 348 int type, permset, tag, qual; 349 int matched; 350 const char *name; 351 352 for (i = 0; i < n; i++) 353 marker[i] = i; 354 355 while (0 == (r = archive_entry_acl_next(ae, 356 ARCHIVE_ENTRY_ACL_TYPE_ACCESS, 357 &type, &permset, &tag, &qual, &name))) { 358 for (i = 0, matched = 0; i < n && !matched; i++) { 359 if (acl_match(&acls[marker[i]], type, permset, 360 tag, qual, name)) { 361 /* We found a match; remove it. */ 362 marker[i] = marker[n - 1]; 363 n--; 364 matched = 1; 365 } 366 } 367 if (tag == ARCHIVE_ENTRY_ACL_USER_OBJ) { 368 if (!matched) printf("No match for user_obj perm\n"); 369 failure("USER_OBJ permset (%02o) != user mode (%02o)", 370 permset, 07 & (mode >> 6)); 371 assert((permset << 6) == (mode & 0700)); 372 } else if (tag == ARCHIVE_ENTRY_ACL_GROUP_OBJ) { 373 if (!matched) printf("No match for group_obj perm\n"); 374 failure("GROUP_OBJ permset %02o != group mode %02o", 375 permset, 07 & (mode >> 3)); 376 assert((permset << 3) == (mode & 0070)); 377 } else if (tag == ARCHIVE_ENTRY_ACL_OTHER) { 378 if (!matched) printf("No match for other perm\n"); 379 failure("OTHER permset (%02o) != other mode (%02o)", 380 permset, mode & 07); 381 assert((permset << 0) == (mode & 0007)); 382 } else { 383 failure("Could not find match for ACL " 384 "(type=%d,permset=%d,tag=%d,qual=%d,name=``%s'')", 385 type, permset, tag, qual, name); 386 assert(matched == 1); 387 } 388 } 389#if ARCHIVE_VERSION_NUMBER < 1009000 390 /* Known broken before 1.9.0. */ 391 skipping("archive_entry_acl_next() exits with ARCHIVE_EOF"); 392#else 393 assertEqualInt(ARCHIVE_EOF, r); 394#endif 395 assert((mode & 0777) == (archive_entry_mode(ae) & 0777)); 396 failure("Could not find match for ACL " 397 "(type=%d,permset=%d,tag=%d,qual=%d,name=``%s'')", 398 acls[marker[0]].type, acls[marker[0]].permset, 399 acls[marker[0]].tag, acls[marker[0]].qual, acls[marker[0]].name); 400 assert(n == 0); /* Number of ACLs not matched should == 0 */ 401 free(marker); 402} 403 404DEFINE_TEST(test_acl_pax) 405{ 406 struct archive *a; 407 struct archive_entry *ae; 408 size_t used; 409 FILE *f; 410 411 /* Write an archive to memory. */ 412 assert(NULL != (a = archive_write_new())); 413 assertA(0 == archive_write_set_format_pax(a)); 414 assertA(0 == archive_write_set_compression_none(a)); 415 assertA(0 == archive_write_set_bytes_per_block(a, 1)); 416 assertA(0 == archive_write_set_bytes_in_last_block(a, 1)); 417 assertA(0 == archive_write_open_memory(a, buff, sizeof(buff), &used)); 418 419 /* Write a series of files to the archive with different ACL info. */ 420 421 /* Create a simple archive_entry. */ 422 assert((ae = archive_entry_new()) != NULL); 423 archive_entry_set_pathname(ae, "file"); 424 archive_entry_set_mode(ae, S_IFREG | 0777); 425 426 /* Basic owner/owning group should just update mode bits. */ 427 set_acls(ae, acls0, sizeof(acls0)/sizeof(acls0[0])); 428 assertA(0 == archive_write_header(a, ae)); 429 430 /* With any extended ACL entry, we should read back a full set. */ 431 set_acls(ae, acls1, sizeof(acls1)/sizeof(acls1[0])); 432 assertA(0 == archive_write_header(a, ae)); 433 434 435 /* A more extensive set of ACLs. */ 436 set_acls(ae, acls2, sizeof(acls2)/sizeof(acls2[0])); 437 assertA(0 == archive_write_header(a, ae)); 438 439 /* 440 * Check that clearing ACLs gets rid of them all by repeating 441 * the first test. 442 */ 443 set_acls(ae, acls0, sizeof(acls0)/sizeof(acls0[0])); 444 assertA(0 == archive_write_header(a, ae)); 445 archive_entry_free(ae); 446 447 /* Close out the archive. */ 448 assertA(0 == archive_write_close(a)); 449#if ARCHIVE_VERSION_NUMBER < 2000000 450 archive_write_finish(a); 451#else 452 assertA(0 == archive_write_finish(a)); 453#endif 454 455 /* Write out the data we generated to a file for manual inspection. */ 456 assert(NULL != (f = fopen("testout", "wb"))); 457 assertEqualInt(used, (size_t)fwrite(buff, 1, (unsigned int)used, f)); 458 fclose(f); 459 460 /* Write out the reference data to a file for manual inspection. */ 461 assert(NULL != (f = fopen("reference", "wb"))); 462 assert(sizeof(reference) == fwrite(reference, 1, sizeof(reference), f)); 463 fclose(f); 464 465 /* Assert that the generated data matches the built-in reference data.*/ 466 failure("Generated pax archive does not match reference; check 'testout' and 'reference' files."); 467 assertEqualMem(buff, reference, sizeof(reference)); 468 failure("Generated pax archive does not match reference; check 'testout' and 'reference' files."); 469 assertEqualInt((int)used, sizeof(reference)); 470 471 /* Read back each entry and check that the ACL data is right. */ 472 assert(NULL != (a = archive_read_new())); 473 assertA(0 == archive_read_support_format_all(a)); 474 assertA(0 == archive_read_support_compression_all(a)); 475 assertA(0 == archive_read_open_memory(a, buff, used)); 476 477 /* First item has no ACLs */ 478 assertA(0 == archive_read_next_header(a, &ae)); 479 failure("Basic ACLs shouldn't be stored as extended ACLs"); 480 assert(0 == archive_entry_acl_reset(ae, ARCHIVE_ENTRY_ACL_TYPE_ACCESS)); 481 failure("Basic ACLs should set mode to 0142, not %04o", 482 archive_entry_mode(ae)&0777); 483 assert((archive_entry_mode(ae) & 0777) == 0142); 484 485 /* Second item has a few ACLs */ 486 assertA(0 == archive_read_next_header(a, &ae)); 487 failure("One extended ACL should flag all ACLs to be returned."); 488 assert(4 == archive_entry_acl_reset(ae, ARCHIVE_ENTRY_ACL_TYPE_ACCESS)); 489 compare_acls(ae, acls1, sizeof(acls1)/sizeof(acls1[0]), 0142); 490 failure("Basic ACLs should set mode to 0142, not %04o", 491 archive_entry_mode(ae)&0777); 492 assert((archive_entry_mode(ae) & 0777) == 0142); 493 494 /* Third item has pretty extensive ACLs */ 495 assertA(0 == archive_read_next_header(a, &ae)); 496 assertEqualInt(6, archive_entry_acl_reset(ae, ARCHIVE_ENTRY_ACL_TYPE_ACCESS)); 497 compare_acls(ae, acls2, sizeof(acls2)/sizeof(acls2[0]), 0543); 498 failure("Basic ACLs should set mode to 0543, not %04o", 499 archive_entry_mode(ae)&0777); 500 assert((archive_entry_mode(ae) & 0777) == 0543); 501 502 /* Fourth item has no ACLs */ 503 assertA(0 == archive_read_next_header(a, &ae)); 504 failure("Basic ACLs shouldn't be stored as extended ACLs"); 505 assert(0 == archive_entry_acl_reset(ae, ARCHIVE_ENTRY_ACL_TYPE_ACCESS)); 506 failure("Basic ACLs should set mode to 0142, not %04o", 507 archive_entry_mode(ae)&0777); 508 assert((archive_entry_mode(ae) & 0777) == 0142); 509 510 /* Close the archive. */ 511 assertA(0 == archive_read_close(a)); 512#if ARCHIVE_VERSION_NUMBER < 2000000 513 archive_read_finish(a); 514#else 515 assertA(0 == archive_read_finish(a)); 516#endif 517} 518