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"
18 # See if the right software is installed.
22 # Require getfacl to be installed
23 getfacl Makefile 2>&1 >/dev/null
24 if test $? -ne 0; then
25 echo "$TestName skipped: getfacl not installed"
29 # Require attr to be installed
30 attr -l Makefile 2>&1 >/dev/null
31 if test $? -ne 0; then
32 echo "$TestName skipped: attr not installed"
50 # Zap out any schedule in default conf file so that
51 # it doesn't start during our test
54 echo "s% Schedule =%# Schedule =%g" > $outf
55 echo "s/Options {/Options { aclsupport=yes; xattrsupport = yes/" >> $outf
56 cp ${cwd}/bin/bacula-dir.conf $cwd/tmp/1
57 sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bacula-dir.conf
65 cp ${cwd}/bin/bconsole $d
69 setfacl -m d:user:$uid:r-x $d/acl-dir
70 setfacl -m d:user:root:-wx $d/acl-dir
71 setfacl -m user:nobody:--- $d/acl-dir
72 setfacl -m user:nobody:--- $d/bconsole
73 setfacl -m group:nogroup:--x $d/bconsole
74 cp ${cwd}/bin/bconsole $d/acl-dir
75 cp ${cwd}/bin/bconsole $d/other
76 attr -s bacula.test -V rulez $d/other 2>/dev/null 1>/dev/null
79 getfacl -R acl > $cwd/tmp/org
80 attr -g bacula.test $d/other > $cwd/tmp/attr.org
84 chmod +a "user:$uid allow read execute" $d/acl-dir
85 chmod +a "user:root allow write execute" $d/acl-dir
86 chmod +a "user:nobody deny read write execute" $d/acl-dir
87 chmod +a "user:nobody deny read write execute" $d/bconsole
88 chmod +a "group:nogroup allow execute" $d/bconsole
89 cp ${cwd}/bin/bconsole $d/acl-dir
90 cp ${cwd}/bin/bconsole $d/other
91 xattr -w bacula.test "rulez" $d/other 2>/dev/null 1>/dev/null
94 ls -lde -R acl > $cwd/tmp/org
95 xattr -p bacula.test $d/other > $cwd/tmp/attr.org
100 # See if we need to set ZFS or POSIX acls
102 df -F zfs $d > /dev/null 2>&1
104 /bin/chmod A+user:$uid:rx:allow $d/acl-dir
105 /bin/chmod A+user:root:wx:allow $d/acl-dir
106 /bin/chmod A+user:nobody:rwx:deny $d/acl-dir
107 /bin/chmod A+user:nobody:rwx:deny $d/bconsole
108 /bin/chmod A+group:nogroup:x:allow $d/bconsole
110 /bin/chmod A+user:$uid:r-x $d/acl-dir
111 /bin/chmod A+user:root:-wx $d/acl-dir
112 /bin/chmod A+user:nobody:--- $d/acl-dir
113 /bin/chmod A+user:nobody:--- $d/bconsole
114 /bin/chmod A+group:nogroup:--x $d/bconsole
116 cp ${cwd}/bin/bconsole $d/other
117 /bin/runat $d/other 'cat > bacula.test' << EOF
121 /bin/ls -ldv -R acl > $cwd/tmp/org
122 /bin/runat $d/other 'cat bacula.test' > $cwd/tmp/attr.org
127 change_jobname BackupClient1 $JobName
130 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
133 @$out ${cwd}/tmp/log1.out
134 label volume=TestVolume001 storage=File pool=File
135 setdebug level=400 trace=1 client
136 setdebug level=300 trace=1 director
137 setdebug level=300 trace=1 storage
144 @$out ${cwd}/tmp/log2.out
145 restore where=${cwd}/tmp/bacula-restores select all done
153 check_for_zombie_jobs storage=File
158 ( cd $cwd/tmp/bacula-restores/$cwd/build
159 getfacl -R acl > $cwd/tmp/new
160 attr -g bacula.test $d/other > $cwd/tmp/attr.new
164 ( cd $cwd/tmp/bacula-restores/$cwd/build
165 ls -lde -R acl > $cwd/tmp/new
166 xattr -p bacula.test $d/other > $cwd/tmp/attr.new
170 ( cd $cwd/tmp/bacula-restores/$cwd/build
171 /bin/ls -ldv -R acl > $cwd/tmp/new
172 /bin/runat $d/other 'cat bacula.test' > $cwd/tmp/attr.new
177 diff -u $cwd/tmp/org $cwd/tmp/new
178 if [ $? -ne 0 ]; then
182 diff $cwd/tmp/attr.org $cwd/tmp/attr.new
183 if [ $? -ne 0 ]; then
190 if [ x$REGRESS_DEBUG != x ]; then