Changeset 989 for vendor/current/source3/script
- Timestamp:
- Nov 25, 2016, 8:04:54 PM (9 years ago)
- Location:
- vendor/current/source3/script/tests
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source3/script/tests/test_dfree_quota.sh
r988 r989 6 6 if [ $# -lt 6 ]; then 7 7 cat <<EOF 8 Usage: test_dfree_quota.sh SERVER DOMAIN USERNAME PASSWORD LOCAL_PATH SMBCLIENT SMBCQUOTAS 8 Usage: test_dfree_quota.sh SERVER DOMAIN USERNAME PASSWORD LOCAL_PATH SMBCLIENT SMBCQUOTAS SMBCACLS 9 9 EOF 10 10 exit 1; … … 19 19 smbclient=$6 20 20 smbcquotas=$7 21 shift 7 21 smbcacls=$8 22 shift 8 22 23 failed=0 23 24 … … 36 37 uid=$(id -u $USERNAME) 37 38 gid=$(id -g $USERNAME) 39 uid1=$(id -u user1) 40 uid2=$(id -u user2) 38 41 cat <<ABC 39 42 conf1:df:block size = 512:disk free = 10:disk size = 20 … … 65 68 trygrp2:u$uid:block size = 4096:hard limit = 0:soft limit = 0:cur blocks = 41 66 69 trygrp2:g$gid:block size = 4096:hard limit = 60:soft limit = 60:cur blocks = 56 70 notenforce:df:block size = 4096:disk free = 10:disk size = 80 71 notenforce:u$uid:block size = 4096:hard limit = 40:soft limit = 40:cur blocks = 37 72 notenforce:udflt:block size = 4096:qflags = 0 73 nfs:df:block size = 4096:disk free = 10:disk size = 80 74 nfs:u$uid:block size = 4096:hard limit = 40:soft limit = 40:cur blocks = 37 75 nfs:udflt:nosys = 1 76 confdfqp:df:block size = 4096:disk free = 10:disk size = 80 77 confdfqp:u$uid1:block size = 4096:hard limit = 40:soft limit = 40:cur blocks = 36 78 confdfqp:u$uid2:block size = 4096:hard limit = 41:soft limit = 41:cur blocks = 36 67 79 ABC 68 80 } … … 94 106 test_smbclient_dfree() { 95 107 name="$1" 96 dir="$2" 97 confs="$3" 98 expected="$4" 99 shift 108 share="$2" 109 dir="$3" 110 confs="$4" 111 expected="$5" 112 shift 100 113 shift 101 114 shift … … 103 116 subunit_start_test "$name" 104 117 setup_conf $confs 105 output=$($VALGRIND $smbclient //$SERVER/dfq-c "cd $dir; l" $@ 2>&1)118 output=$($VALGRIND $smbclient //$SERVER/$share -c "cd $dir; l" $@ 2>&1) 106 119 status=$? 107 120 if [ "$status" = "0" ]; then … … 145 158 146 159 #basic disk-free tests 147 test_smbclient_dfree "Test dfree share root SMB3 no quota" "." "conf1 ." "10 1024. 5" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1`148 test_smbclient_dfree "Test dfree subdir SMB3 no quota" "subdir1" "conf1 . conf2 subdir1" "20 1024. 10" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1`149 test_smbclient_dfree "Test dfree subdir NT1 no quota" "subdir1" "conf1 . conf2 subdir1" "10 1024. 5" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=NT1 || failed=`expr $failed + 1`150 test_smbclient_dfree "Test large disk" "." "conf3 ." "1125899906842624 1024. 3000" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1`160 test_smbclient_dfree "Test dfree share root SMB3 no quota" dfq "." "conf1 ." "10 1024. 5" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1` 161 test_smbclient_dfree "Test dfree subdir SMB3 no quota" dfq "subdir1" "conf1 . conf2 subdir1" "20 1024. 10" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1` 162 test_smbclient_dfree "Test dfree subdir NT1 no quota" dfq "subdir1" "conf1 . conf2 subdir1" "10 1024. 5" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=NT1 || failed=`expr $failed + 1` 163 test_smbclient_dfree "Test large disk" dfq "." "conf3 ." "1125899906842624 1024. 3000" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1` 151 164 #basic quota test (SMB1 only) 152 165 test_smbcquotas "Test user quota" confq1 $USERNAME "40960/4096000/3072000" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=NT1 || failed=`expr $failed + 1` 153 166 154 167 #quota limit > disk size, remaining quota > disk free 155 test_smbclient_dfree "Test dfree share root df vs quota case 1" "." "confdfq1 ." "80 1024. 40" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1`168 test_smbclient_dfree "Test dfree share root df vs quota case 1" dfq "." "confdfq1 ." "80 1024. 40" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1` 156 169 #quota limit > disk size, remaining quota < disk free 157 test_smbclient_dfree "Test dfree share root df vs quota case 2" "." "confdfq2 ." "80 1024. 12" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1`170 test_smbclient_dfree "Test dfree share root df vs quota case 2" dfq "." "confdfq2 ." "80 1024. 12" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1` 158 171 #quota limit < disk size, remaining quota > disk free 159 test_smbclient_dfree "Test dfree share root df vs quota case 3" "." "confdfq3 ." "160 1024. 40" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1`172 test_smbclient_dfree "Test dfree share root df vs quota case 3" dfq "." "confdfq3 ." "160 1024. 40" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1` 160 173 #quota limit < disk size, remaining quota < disk free 161 test_smbclient_dfree "Test dfree share root df vs quota case 4" "." "confdfq4 ." "160 1024. 12" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1`162 test_smbclient_dfree "Test dfree subdir df vs quota case 4" "subdir1" "confdfq4 subdir1" "160 1024. 12" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1`174 test_smbclient_dfree "Test dfree share root df vs quota case 4" dfq "." "confdfq4 ." "160 1024. 12" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1` 175 test_smbclient_dfree "Test dfree subdir df vs quota case 4" dfq "subdir1" "confdfq4 subdir1" "160 1024. 12" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1` 163 176 164 177 #quota-->disk free special cases 165 test_smbclient_dfree "Test quota->dfree edquot" "subdir1" "edquot subdir1" "164 1024. 0" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1` 166 test_smbclient_dfree "Test quota->dfree soft limit" "subdir1" "slimit subdir1" "168 1024. 0" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1` 167 test_smbclient_dfree "Test quota->dfree hard limit" "subdir1" "hlimit subdir1" "180 1024. 0" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1` 168 test_smbclient_dfree "Test quota->dfree inode soft limit" "subdir1" "islimit subdir1" "148 1024. 0" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1` 169 test_smbclient_dfree "Test quota->dfree inode hard limit" "subdir1" "ihlimit subdir1" "148 1024. 0" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1` 170 test_smbclient_dfree "Test quota->dfree err try group" "subdir1" "trygrp1 subdir1" "240 1024. 20" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1` 171 test_smbclient_dfree "Test quota->dfree no-quota try group" "subdir1" "trygrp2 subdir1" "240 1024. 16" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1` 178 test_smbclient_dfree "Test quota->dfree edquot" dfq "subdir1" "edquot subdir1" "164 1024. 0" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1` 179 test_smbclient_dfree "Test quota->dfree soft limit" dfq "subdir1" "slimit subdir1" "168 1024. 0" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1` 180 test_smbclient_dfree "Test quota->dfree hard limit" dfq "subdir1" "hlimit subdir1" "180 1024. 0" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1` 181 test_smbclient_dfree "Test quota->dfree inode soft limit" dfq "subdir1" "islimit subdir1" "148 1024. 0" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1` 182 test_smbclient_dfree "Test quota->dfree inode hard limit" dfq "subdir1" "ihlimit subdir1" "148 1024. 0" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1` 183 test_smbclient_dfree "Test quota->dfree err try group" dfq "subdir1" "trygrp1 subdir1" "240 1024. 20" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1` 184 test_smbclient_dfree "Test quota->dfree no-quota try group" dfq "subdir1" "trygrp2 subdir1" "240 1024. 16" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1` 185 186 #quota configured but not enforced 187 test_smbclient_dfree "Test dfree share root quota not enforced" dfq "." "notenforce ." "320 1024. 40" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1` 188 189 #FS quota not implemented (NFS case) 190 test_smbclient_dfree "Test dfree share root FS quota not implemented" dfq "." "nfs ." "160 1024. 12" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1` 191 192 #test for dfree when owner is inherited 193 #setup two folders with different owners 194 rm -rf $WORKDIR/subdir3/* 195 for d in / subdir3 196 do 197 $VALGRIND $smbcacls -U$USERNAME%$PASSWORD -D "ACL:$SERVER\user1:ALLOWED/0x0/FULL" //$SERVER/dfq $d > /dev/null 2>&1 198 $VALGRIND $smbcacls -U$USERNAME%$PASSWORD -a "ACL:$SERVER\user1:ALLOWED/0x0/FULL" //$SERVER/dfq $d || failed=`expr $failed + 1` 199 $VALGRIND $smbcacls -U$USERNAME%$PASSWORD -D "ACL:$SERVER\user2:ALLOWED/0x0/FULL" //$SERVER/dfq $d > /dev/null 2>&1 200 $VALGRIND $smbcacls -U$USERNAME%$PASSWORD -a "ACL:$SERVER\user2:ALLOWED/0x0/FULL" //$SERVER/dfq $d || failed=`expr $failed + 1` 201 done 202 203 $VALGRIND $smbclient //$SERVER/dfq -c "cd subdir3; mkdir user1" -Uuser1%$PASSWORD --option=clientmaxprotocol=SMB3 > /dev/null 2>&1 || failed=`expr $failed + 1` 204 $VALGRIND $smbclient //$SERVER/dfq -c "cd subdir3; mkdir user2" -Uuser2%$PASSWORD --option=clientmaxprotocol=SMB3 > /dev/null 2>&1 || failed=`expr $failed + 1` 205 #test quotas 206 test_smbclient_dfree "Test dfree without inherit owner - user1 at user1" \ 207 dfq "subdir3/user1" "confdfqp subdir3/user1 confdfqp subdir3/user2" "160 1024. 16" \ 208 -Uuser1%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1` 209 test_smbclient_dfree "Test dfree without inherit owner - user1 at user2" \ 210 dfq "subdir3/user2" "confdfqp subdir3/user1 confdfqp subdir3/user2" "160 1024. 16" \ 211 -Uuser1%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1` 212 test_smbclient_dfree "Test dfree with inherit owner - user1 at user1" \ 213 dfq_owner "subdir3/user1" "confdfqp subdir3/user1 confdfqp subdir3/user2" "160 1024. 16" \ 214 -Uuser1%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1` 215 test_smbclient_dfree "Test dfree with inherit owner - user1 at user2" \ 216 dfq_owner "subdir3/user2" "confdfqp subdir3/user1 confdfqp subdir3/user2" "164 1024. 20" \ 217 -Uuser1%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1` 172 218 173 219 setup_conf -
vendor/current/source3/script/tests/test_shadow_copy.sh
r988 r989 43 43 local version 44 44 local destdir 45 local content 45 46 rootdir=$1 46 47 prefix=$2 47 48 version=$3 49 content=$4 48 50 if [ -n "$prefix" ] ; then 49 51 destdir=$rootdir/$prefix … … 57 59 # for non-snapshot version, create legit files 58 60 # so that wide-link checks focus on snapshot files 59 touch$destdir/foo61 echo "$content" > $destdir/foo 60 62 mkdir -p $destdir/bar 61 touch$destdir/bar/baz62 touch$destdir/bar/lfoo63 touch$destdir/bar/letcpasswd64 touch$destdir/bar/loutside63 echo "$content" > $destdir/bar/baz 64 echo "$content" > $destdir/bar/lfoo 65 echo "$content" > $destdir/bar/letcpasswd 66 echo "$content" > $destdir/bar/loutside 65 67 elif [ "$version" = "fullsnap" ] ; then 66 68 #snapshot files 67 touch$destdir/foo69 echo "$content" > $destdir/foo 68 70 mkdir -p $destdir/bar 69 touch$destdir/bar/baz71 echo "$content" > $destdir/bar/baz 70 72 ln -fs ../foo $destdir/bar/lfoo 71 73 ln -fs /etc/passwd $destdir/bar/letcpasswd 72 74 ln -fs ../../outside $destdir/bar/loutside 73 touch`dirname $destdir`/outside75 echo "$content" > `dirname $destdir`/outside 74 76 else #subshare snapshot - at bar 75 touch$destdir/baz77 echo "$content" > $destdir/baz 76 78 ln -fs ../foo $destdir/lfoo 77 79 ln -fs /etc/passwd $destdir/letcpasswd 78 80 ln -fs ../../outside $destdir/loutside 79 touch`dirname $destdir`/../outside81 echo "$content" > `dirname $destdir`/../outside 80 82 fi 81 83 … … 118 120 snapname=${SNAPSHOTS[$i]} 119 121 mkdir $snapdir/$snapname 120 build_files $snapdir/$snapname "$prefix" $version 122 build_files $snapdir/$snapname "$prefix" $version "$snapname" 121 123 done 122 124 } … … 128 130 local path 129 131 local expected_count 132 local skip_content 130 133 local versions 134 local tstamps 135 local tstamp 136 local content 137 local is_dir 131 138 132 139 share=$1 133 140 path=$2 134 141 expected_count=$3 142 skip_content=$4 135 143 versions=`$SMBCLIENT -U$USERNAME%$PASSWORD "//$SERVER/$share" -I $SERVER_IP -c "allinfo $path" | grep "^create_time:" | wc -l` 136 if [ "$versions" = "$expected_count" ] ; then 137 true 138 else 144 if [ "$versions" != "$expected_count" ] ; then 139 145 echo "expected $expected_count versions of $path, got $versions" 140 false 141 fi 146 return 1 147 fi 148 149 is_dir=0 150 $SMBCLIENT -U$USERNAME%$PASSWORD "//$SERVER/$share" -I $SERVER_IP -c "allinfo $path" | grep "^attributes:.*D" && is_dir=1 151 if [ $is_dir = 1 ] ; then 152 skip_content=1 153 fi 154 155 #readable snapshots 156 tstamps=`$SMBCLIENT -U$USERNAME%$PASSWORD "//$SERVER/$share" -I $SERVER_IP -c "allinfo $path" | awk '/^@GMT-/ {snapshot=$1} /^create_time:/ {printf "%s\n", snapshot}'` 157 for tstamp in $tstamps ; do 158 if [ $is_dir = 0 ] ; 159 then 160 if ! $SMBCLIENT -U$USERNAME%$PASSWORD "//$SERVER/$share" -I $SERVER_IP -c "get $tstamp\\$path $WORKDIR/foo" ; then 161 echo "Failed getting \\\\$SERVER\\$share\\$tstamp\\$path" 162 return 1 163 fi 164 else 165 if ! $SMBCLIENT -U$USERNAME%$PASSWORD "//$SERVER/$share" -I $SERVER_IP -c "ls $tstamp\\$path\\*" ; then 166 echo "Failed listing \\\\$SERVER\\$share\\$tstamp\\$path" 167 return 1 168 fi 169 fi 170 171 #also check the content, but not for wide links 172 if [ "x$skip_content" != "x1" ] ; then 173 content=`cat $WORKDIR/foo` 174 if [ "$content" != "$tstamp" ] ; then 175 echo "incorrect content of \\\\$SERVER\\$share\\$tstamp\\$path expected [$tstamp] got [$content]" 176 return 1 177 fi 178 fi 179 done 180 181 #non-readable snapshots 182 tstamps=`$SMBCLIENT -U$USERNAME%$PASSWORD "//$SERVER/$share" -I $SERVER_IP -c "allinfo $path" | \ 183 awk '/^@GMT-/ {if (snapshot!=""){printf "%s\n", snapshot} ; snapshot=$1} /^create_time:/ {snapshot=""} END {if (snapshot!=""){printf "%s\n", snapshot}}'` 184 for tstamp in $tstamps ; do 185 if [ $is_dir = 0 ] ; 186 then 187 if $SMBCLIENT -U$USERNAME%$PASSWORD "//$SERVER/$share" -I $SERVER_IP -c "get $tstamp\\$path $WORKDIR/foo" ; then 188 echo "Unexpected success getting \\\\$SERVER\\$share\\$tstamp\\$path" 189 return 1 190 fi 191 else 192 if $SMBCLIENT -U$USERNAME%$PASSWORD "//$SERVER/$share" -I $SERVER_IP -c "ls $tstamp\\$path\\*" ; then 193 echo "Unexpected success listing \\\\$SERVER\\$share\\$tstamp\\$path" 194 return 1 195 fi 196 fi 197 done 142 198 } 143 199 … … 195 251 196 252 testit "$msg - abs symlink outside" \ 197 test_count_versions $share bar/letcpasswd $ncopies_blocked || \253 test_count_versions $share bar/letcpasswd $ncopies_blocked 1 || \ 198 254 failed=`expr $failed + 1` 199 255 200 256 testit "$msg - rel symlink outside" \ 201 test_count_versions $share bar/loutside $ncopies_blocked || \ 257 test_count_versions $share bar/loutside $ncopies_blocked 1 || \ 258 failed=`expr $failed + 1` 259 260 testit "$msg - list directory" \ 261 test_count_versions $share bar $ncopies_allowed || \ 202 262 failed=`expr $failed + 1` 203 263 } … … 263 323 264 324 #build "latest" files 265 build_files $WORKDIR/mount base/share "latest" 325 build_files $WORKDIR/mount base/share "latest" "latest" 266 326 267 327 failed=0 -
vendor/current/source3/script/tests/test_smbclient_ntlm.sh
r988 r989 38 38 testit "smbclient baduser.badpassword.NT1NEW.guest" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -Ubaduser%badpassword -mNT1 -c quit $ADDARGS 39 39 testit "smbclient baduser.badpassword.SMB3.guest" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -Ubaduser%badpassword -mSMB3 -c quit $ADDARGS 40 41 testit_expect_failure "smbclient baduser.badpassword.NT1OLD.signfail" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -Ubaduser%badpassword -mNT1 --option=clientusespnego=no --option=clientntlmv2auth=no --signing=required -c quit $ADDARGS 42 testit_expect_failure "smbclient baduser.badpassword.NT1NEW.signfail" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -Ubaduser%badpassword -mNT1 --signing=required -c quit $ADDARGS 43 testit_expect_failure "smbclient baduser.badpassword.SMB3.signfail" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -Ubaduser%badpassword -mSMB3 --signing=required -c quit $ADDARGS 40 44 fi
Note:
See TracChangeset
for help on using the changeset viewer.