3 # Run a backup of the Bacula build directory with some acls
6 # Your filesystem must be mounted with the acl option (mount -o remount,acl,user_xattr /tmp)
7 # on ubuntu, the attr package must be installed
9 # For this script to work, you will also need a number of acl packages loaded
10 # not default on Debian derivatives:
11 # apt-get install acl libacl1 libacl1-dev attr
13 TestName="acl-xattr-test"
19 # Require getfacl to be installed
20 getfacl Makefile 2>&1 >/dev/null
21 if test $? -ne 0; then
22 echo "$TestName skipped: getfacl not installed"
26 # Require attr to be installed
27 attr -l Makefile 2>&1 >/dev/null
28 if test $? -ne 0; then
29 echo "$TestName skipped: attr not installed"
37 # Zap out any schedule in default conf file so that
38 # it doesn't start during our test
41 echo "s% Schedule =%# Schedule =%g" > $outf
42 echo "s/Options {/Options { aclsupport=yes; xattrsupport = yes/" >> $outf
43 cp ${cwd}/bin/bacula-dir.conf $cwd/tmp/1
44 sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bacula-dir.conf
52 cp ${cwd}/bin/bconsole $d
56 setfacl -m d:user:$uid:r-x $d/testdir
57 setfacl -m d:user:root:-wx $d/testdir
58 setfacl -m user:nobody:--- $d/testdir
59 setfacl -m user:nobody:--- $d/bconsole
60 setfacl -m group:nogroup:--x $d/bconsole
61 cp ${cwd}/bin/bconsole $d/testdir
62 cp ${cwd}/bin/bconsole $d/other
63 attr -s bacula.test -V rulez $d/other 2>/dev/null 1>/dev/null
66 getfacl -R acl > $cwd/tmp/org
67 attr -g bacula.test $d/other > $cwd/tmp/attr.org
71 chmod +a "user:$uid allow read execute" $d/testdir
72 chmod +a "user:root allow write execute" $d/testdir
73 chmod +a "user:nobody deny read write execute" $d/testdir
74 chmod +a "user:nobody deny read write execute" $d/bconsole
75 chmod +a "group:nogroup allow execute" $d/bconsole
76 cp ${cwd}/bin/bconsole $d/testdir
77 cp ${cwd}/bin/bconsole $d/other
78 xattr -w bacula.test "rulez" $d/other 2>/dev/null 1>/dev/null
81 ls -lde -R acl > $cwd/tmp/org
82 xattr -p bacula.test $d/other > $cwd/tmp/attr.org
88 change_jobname BackupClient1 $JobName
91 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
94 @$out ${cwd}/tmp/log1.out
95 label volume=TestVolume001 storage=File pool=Default
96 setdebug level=400 trace=1 client
97 setdebug level=300 trace=1 director
98 setdebug level=300 trace=1 storage
105 @$out ${cwd}/tmp/log2.out
106 restore where=${cwd}/tmp/bacula-restores select all done
114 check_for_zombie_jobs storage=File
117 ( cd $cwd/tmp/bacula-restores/$cwd/build
118 getfacl -R acl > $cwd/tmp/new
119 attr -g bacula.test $d/other > $cwd/tmp/attr.new
122 diff -u $cwd/tmp/org $cwd/tmp/new
123 if [ $? -ne 0 ]; then
127 diff $cwd/tmp/attr.org $cwd/tmp/attr.new
128 if [ $? -ne 0 ]; then
135 if [ x$REGRESS_DEBUG != x ]; then