Changeset 988 for vendor/current/source3/script
- Timestamp:
- Nov 24, 2016, 1:14:11 PM (9 years ago)
- Location:
- vendor/current/source3/script
- Files:
-
- 44 added
- 32 deleted
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source3/script/tests/test_failure.sh
r740 r988 5 5 # Copyright (C) 2011 Michael Adam <obnox@samba.org> 6 6 7 # include the blackbox subunit infrastructure 8 # if not run from classical s3 test script: 9 test x"$TEST_FUNCTIONS_SH" != x"INCLUDED" && { 10 incdir=`dirname $0`/../../../testprogs/blackbox 11 . $incdir/subunit.sh 12 } 7 incdir=`dirname $0`/../../../testprogs/blackbox 8 . $incdir/subunit.sh 13 9 14 10 failed=0 -
vendor/current/source3/script/tests/test_local_s3.sh
r740 r988 10 10 fi 11 11 12 test x"$TEST_FUNCTIONS_SH" != x"INCLUDED" && {13 12 incdir=`dirname $0`/../../../testprogs/blackbox 14 13 . $incdir/subunit.sh 15 }16 14 17 15 failed=0 -
vendor/current/source3/script/tests/test_net_misc.sh
r740 r988 5 5 if [ $# -lt 3 ]; then 6 6 cat <<EOF 7 Usage: test_net_misc.sh SCRIPTDIR SERVERCONFFILE CONFIGURATION7 Usage: test_net_misc.sh SCRIPTDIR SERVERCONFFILE NET CONFIGURATION 8 8 EOF 9 9 exit 1; … … 12 12 SCRIPTDIR="$1" 13 13 SERVERCONFFILE="$2" 14 CONFIGURATION="$3" 14 NET="$3" 15 CONFIGURATION="$4" 15 16 16 17 NET="$VALGRIND ${NET:-$BINDIR/net} $CONFIGURATION" … … 19 20 NETLOOKUP="${NET} lookup" 20 21 21 test x"$TEST_FUNCTIONS_SH" != x"INCLUDED" && {22 22 incdir=`dirname $0`/../../../testprogs/blackbox 23 23 . $incdir/subunit.sh 24 }25 24 26 25 failed=0 -
vendor/current/source3/script/tests/test_net_registry.sh
r740 r988 10 10 if [ $# -lt 3 ]; then 11 11 cat <<EOF 12 Usage: test_net_registry.sh SCRIPTDIR SERVERCONFFILE CONFIGURATION RPC12 Usage: test_net_registry.sh SCRIPTDIR SERVERCONFFILE NET CONFIGURATION RPC 13 13 EOF 14 14 exit 1; … … 17 17 SCRIPTDIR="$1" 18 18 SERVERCONFFILE="$2" 19 CONFIGURATION="$3" 20 RPC="$4" 19 NET="$3" 20 CONFIGURATION="$4" 21 RPC="$5" 21 22 22 23 NET="$VALGRIND ${NET:-$BINDIR/net} $CONFIGURATION" … … 28 29 fi 29 30 30 test x"$TEST_FUNCTIONS_SH" != x"INCLUDED" && {31 31 incdir=`dirname $0`/../../../testprogs/blackbox 32 32 . $incdir/subunit.sh 33 }34 33 35 34 failed=0 -
vendor/current/source3/script/tests/test_net_registry_roundtrip.sh
r740 r988 8 8 if [ $# -lt 3 ]; then 9 9 cat <<EOF 10 Usage: test_net_registry_roundtrip.sh SCRIPTDIR SERVERCONFFILE CONFIGURATION10 Usage: test_net_registry_roundtrip.sh SCRIPTDIR SERVERCONFFILE NET CONFIGURATION RPC 11 11 EOF 12 12 exit 1; … … 15 15 SCRIPTDIR="$1" 16 16 SERVERCONFFILE="$2" 17 CONFIGURATION="$3" 17 NET="$3" 18 CONFIGURATION="$4" 19 RPC="$5" 18 20 19 NET="$VALGRIND ${NET:-$BINDIR/net} $CONFIGURATION" 21 NET="$VALGRIND ${NET} $CONFIGURATION" 22 23 if test "x${RPC}" = "xrpc" ; then 24 NETCMD="${NET} -U${USERNAME}%${PASSWORD} -I ${SERVER_IP} rpc" 25 else 26 NETCMD="${NET}" 27 fi 20 28 21 29 22 if test "x${RPC}" = "xrpc" ; then23 NETREG="${NET} -U${USERNAME}%${PASSWORD} -I ${SERVER_IP} rpc registry"24 else25 NETREG="${NET} registry"26 fi27 28 test x"$TEST_FUNCTIONS_SH" != x"INCLUDED" && {29 30 incdir=`dirname $0`/../../../testprogs/blackbox 30 31 . $incdir/subunit.sh 31 }32 32 33 33 failed=0 34 34 35 # 36 # List of parameters to skip when importing configuration files: 37 # They are forbidden in the registry and would lead import to fail. 38 # 35 39 SED_INVALID_PARAMS="{ 40 s/state directory/;&/g 36 41 s/lock directory/;&/g 37 42 s/lock dir/;&/g 38 s/modules dir/;&/g 39 s/logging/;&/g 40 s/status/;&/g 41 s/logdir/;&/g 42 s/read prediction/;&/g 43 s/mkprofile/;&/g 44 s/valid chars/;&/g 45 s/timesync/;&/g 46 s/sambaconf/;&/g 47 s/logtype/;&/g 48 s/servername/;&/g 49 s/postscript/;&/g 43 s/config backend/;&/g 44 s/include/;&/g 50 45 }" 51 46 … … 67 62 68 63 conf_roundtrip() 69 { 70 localDIR=$(mktemp -d ${PREFIX}/${LOGDIR_PREFIX}_XXXXXX)71 localLOG=$DIR/log64 ( 65 DIR=$(mktemp -d ${PREFIX}/${LOGDIR_PREFIX}_XXXXXX) 66 LOG=$DIR/log 72 67 73 68 echo conf_roundtrip $1 > $LOG … … 75 70 sed -e "$SED_INVALID_PARAMS" $1 >$DIR/conf_in 76 71 77 conf_roundtrip_step $NET conf drop72 conf_roundtrip_step $NETCMD conf drop 78 73 test "x$?" = "x0" || { 79 74 return 1 80 75 } 81 76 82 test -z "$($NET conf list)" 2>>$LOG77 test -z "$($NETCMD conf list)" 2>>$LOG 83 78 if [ "$?" = "1" ]; then 84 79 echo "ERROR: conf drop failed" | tee -a $LOG … … 86 81 fi 87 82 88 conf_roundtrip_step $NET conf import $DIR/conf_in83 conf_roundtrip_step $NETCMD conf import $DIR/conf_in 89 84 test "x$?" = "x0" || { 90 85 return 1 91 86 } 92 87 93 conf_roundtrip_step $NET conf list > $DIR/conf_exp88 conf_roundtrip_step $NETCMD conf list > $DIR/conf_exp 94 89 test "x$?" = "x0" || { 95 90 return 1 … … 102 97 fi 103 98 104 conf_roundtrip_step $NET -d10 registry export $REGPATH $DIR/conf_exp.reg99 conf_roundtrip_step $NETCMD -d10 registry export $REGPATH $DIR/conf_exp.reg 105 100 test "x$?" = "x0" || { 106 101 return 1 107 102 } 108 103 109 conf_roundtrip_step $NET conf drop104 conf_roundtrip_step $NETCMD conf drop 110 105 test "x$?" = "x0" || { 111 106 return 1 112 107 } 113 108 114 test -z "$($NET conf list)" 2>>$LOG109 test -z "$($NETCMD conf list)" 2>>$LOG 115 110 if [ "$?" = "1" ]; then 116 111 echo "ERROR: conf drop failed" | tee -a $LOG … … 118 113 fi 119 114 120 conf_roundtrip_step $NET registry import $DIR/conf_exp.reg115 conf_roundtrip_step $NETCMD registry import $DIR/conf_exp.reg 121 116 test "x$?" = "x0" || { 122 117 return 1 123 118 } 124 119 125 conf_roundtrip_step $NET conf list >$DIR/conf_out120 conf_roundtrip_step $NETCMD conf list >$DIR/conf_out 126 121 test "x$?" = "x0" || { 127 122 return 1 … … 134 129 fi 135 130 136 conf_roundtrip_step $NET registry export $REGPATH $DIR/conf_out.reg131 conf_roundtrip_step $NETCMD registry export $REGPATH $DIR/conf_out.reg 137 132 test "x$?" = "x0" || { 138 133 return 1 … … 145 140 fi 146 141 rm -r $DIR 147 } 142 ) 148 143 149 CONF_FILES=$ {CONF_FILES:-$(find $SRCDIR/ -name '*.conf' | grep -v examples/logon | xargs grep -l "\[global\]")}144 CONF_FILES=$SERVERCONFFILE 150 145 151 146 # remove old logs: -
vendor/current/source3/script/tests/test_ntlm_auth_s3.sh
r740 r988 3 3 if [ $# -lt 2 ]; then 4 4 cat <<EOF 5 Usage: test_ntlm_auth_s3.sh PYTHON SRC3DIR 5 Usage: test_ntlm_auth_s3.sh PYTHON SRC3DIR NTLM_AUTH 6 6 EOF 7 7 exit 1; … … 10 10 PYTHON=$1 11 11 SRC3DIR=$2 12 shift 2 12 NTLM_AUTH=$3 13 DOMAIN=$4 14 USERNAME=$5 15 PASSWORD=$6 16 shift 6 13 17 ADDARGS="$*" 14 18 15 test x"$TEST_FUNCTIONS_SH" != x"INCLUDED" && {16 19 incdir=`dirname $0`/../../../testprogs/blackbox 17 20 . $incdir/subunit.sh 18 } 21 22 SID=`eval $BINDIR/wbinfo -n $USERNAME | cut -d ' ' -f1` 23 BADSID=`eval $BINDIR/wbinfo -n $USERNAME | cut -d ' ' -f1 | sed 's/..$//'` 19 24 20 25 failed=0 21 26 22 testit "ntlm_auth" $PYTHON $SRC3DIR/torture/test_ntlm_auth.py $BINDIR/ntlm_auth $ADDARGS || failed=`expr $failed + 1` 27 test_plaintext_check_output_stdout() 28 { 29 tmpfile=$PREFIX/ntlm_commands 30 31 cat > $tmpfile <<EOF 32 $DOMAIN/$USERNAME $PASSWORD 33 EOF 34 cmd='$NTLM_AUTH "$@" --require-membership-of=$SID --helper-protocol=squid-2.5-basic < $tmpfile 2>&1' 35 eval echo "$cmd" 36 out=`eval $cmd` 37 ret=$? 38 rm -f $tmpfile 39 40 if [ $ret != 0 ] ; then 41 echo "$out" 42 echo "command failed" 43 false 44 return 45 fi 46 47 echo "$out" | grep "OK" >/dev/null 2>&1 48 49 if [ $? = 0 ] ; then 50 # authenticated .. succeed 51 true 52 else 53 echo failed to get successful authentication 54 false 55 fi 56 } 57 58 test_plaintext_check_output_fail() 59 { 60 tmpfile=$PREFIX/ntlm_commands 61 62 cat > $tmpfile <<EOF 63 $DOMAIN\\$USERNAME $PASSWORD 64 EOF 65 cmd='$NTLM_AUTH "$@" --require-membership-of=$BADSID --helper-protocol=squid-2.5-basic < $tmpfile 2>&1' 66 eval echo "$cmd" 67 out=`eval $cmd` 68 ret=$? 69 rm -f $tmpfile 70 71 if [ $ret != 0 ] ; then 72 echo "$out" 73 echo "command failed" 74 false 75 return 76 fi 77 78 echo "$out" | grep "ERR" >/dev/null 2>&1 79 80 if [ $? = 0 ] ; then 81 # failed to authenticate .. success 82 true 83 else 84 echo "incorrectly gave a successful authentication" 85 false 86 fi 87 } 88 89 test_ntlm_server_1_check_output() 90 { 91 tmpfile=$PREFIX/ntlm_commands 92 93 cat > $tmpfile <<EOF 94 LANMAN-Challenge: 0123456789abcdef 95 NT-Response: 25a98c1c31e81847466b29b2df4680f39958fb8c213a9cc6 96 NT-Domain: TEST 97 Username: testuser 98 Request-User-Session-Key: Yes 99 . 100 EOF 101 cmd='$NTLM_AUTH "$@" --helper-protocol=ntlm-server-1 --password=SecREt01< $tmpfile 2>&1' 102 eval echo "$cmd" 103 out=`eval $cmd` 104 ret=$? 105 rm -f $tmpfile 106 107 if [ $ret != 0 ] ; then 108 echo "$out" 109 echo "command failed" 110 false 111 return 112 fi 113 114 echo "$out" | grep "User-Session-Key: 3F373EA8E4AF954F14FAA506F8EEBDC4" >/dev/null 2>&1 115 116 if [ $? = 0 ] ; then 117 # authenticated .. succeed 118 true 119 else 120 echo failed to get successful authentication 121 false 122 fi 123 } 124 125 test_ntlm_server_1_check_output_fail() 126 { 127 tmpfile=$PREFIX/ntlm_commands 128 129 # Break the password with a leading A on the challenge 130 cat > $tmpfile <<EOF 131 LANMAN-Challenge: A123456789abcdef 132 NT-Response: 25a98c1c31e81847466b29b2df4680f39958fb8c213a9cc6 133 NT-Domain: TEST 134 Username: testuser 135 Request-User-Session-Key: Yes 136 . 137 EOF 138 cmd='$NTLM_AUTH "$@" --helper-protocol=ntlm-server-1 --password=SecREt01 < $tmpfile 2>&1' 139 eval echo "$cmd" 140 out=`eval $cmd` 141 ret=$? 142 rm -f $tmpfile 143 144 if [ $ret != 0 ] ; then 145 echo "$out" 146 echo "command failed" 147 false 148 return 149 fi 150 151 echo "$out" | grep "Authenticated: No" >/dev/null 2>&1 152 153 if [ $? = 0 ] ; then 154 # failed to authenticate .. success 155 true 156 else 157 echo "incorrectly gave a successful authentication" 158 false 159 fi 160 } 161 162 test_ntlm_server_1_check_winbind_output() 163 { 164 tmpfile=$PREFIX/ntlm_commands 165 166 # This isn't the correct password 167 cat > $tmpfile <<EOF 168 Password: $PASSWORD 169 NT-Domain: $DOMAIN 170 Username: $USERNAME 171 Request-User-Session-Key: Yes 172 . 173 EOF 174 cmd='$NTLM_AUTH "$@" --helper-protocol=ntlm-server-1 --require-membership-of=$SID < $tmpfile 2>&1' 175 eval echo "$cmd" 176 out=`eval $cmd` 177 ret=$? 178 rm -f $tmpfile 179 180 if [ $ret != 0 ] ; then 181 echo "$out" 182 echo "command failed" 183 false 184 return 185 fi 186 187 echo "$out" | grep "Authenticated: Yes" >/dev/null 2>&1 188 189 if [ $? = 0 ] ; then 190 # authenticated .. success 191 true 192 else 193 echo "Failed to authenticate the user or match with SID $SID" 194 false 195 fi 196 } 197 198 test_ntlm_server_1_check_winbind_output_wrong_sid() 199 { 200 tmpfile=$PREFIX/ntlm_commands 201 202 # This isn't the correct password 203 cat > $tmpfile <<EOF 204 Password: $PASSWORD 205 NT-Domain: $DOMAIN 206 Username: $USERNAME 207 Request-User-Session-Key: Yes 208 . 209 EOF 210 cmd='$NTLM_AUTH "$@" --helper-protocol=ntlm-server-1 --require-membership-of=$BADSID < $tmpfile 2>&1' 211 eval echo "$cmd" 212 out=`eval $cmd` 213 ret=$? 214 rm -f $tmpfile 215 216 if [ $ret != 0 ] ; then 217 echo "$out" 218 echo "command failed" 219 false 220 return 221 fi 222 223 echo "$out" | grep "Authenticated: No" >/dev/null 2>&1 224 225 if [ $? = 0 ] ; then 226 # failed to authenticate .. success 227 true 228 else 229 echo "incorrectly gave a successful authentication" 230 false 231 fi 232 } 233 234 test_ntlm_server_1_check_winbind_output_fail() 235 { 236 tmpfile=$PREFIX/ntlm_commands 237 238 # This isn't the correct password 239 cat > $tmpfile <<EOF 240 LANMAN-Challenge: 0123456789abcdef 241 NT-Response: 25a98c1c31e81847466b29b2df4680f39958fb8c213a9cc6 242 NT-Domain: $DOMAIN 243 Username: $USERNAME 244 Request-User-Session-Key: Yes 245 . 246 EOF 247 cmd='$NTLM_AUTH "$@" --helper-protocol=ntlm-server-1 < $tmpfile 2>&1' 248 eval echo "$cmd" 249 out=`eval $cmd` 250 ret=$? 251 rm -f $tmpfile 252 253 if [ $ret != 0 ] ; then 254 echo "$out" 255 echo "command failed" 256 false 257 return 258 fi 259 260 echo "$out" | grep "Authenticated: No" >/dev/null 2>&1 261 262 if [ $? = 0 ] ; then 263 # failed to authenticate .. success 264 true 265 else 266 echo "incorrectly gave a successful authentication" 267 false 268 fi 269 } 270 271 testit "ntlm_auth" $PYTHON $SRC3DIR/torture/test_ntlm_auth.py $NTLM_AUTH $ADDARGS || failed=`expr $failed + 1` 23 272 # This should work even with NTLMv2 24 testit "ntlm_auth" $PYTHON $SRC3DIR/torture/test_ntlm_auth.py $BINDIR/ntlm_auth $ADDARGS --client-domain=fOo --server-domain=fOo || failed=`expr $failed + 1` 25 273 testit "ntlm_auth with specified domain" $PYTHON $SRC3DIR/torture/test_ntlm_auth.py $NTLM_AUTH $ADDARGS --client-domain=fOo --server-domain=fOo || failed=`expr $failed + 1` 274 testit "ntlm_auth against winbindd" $PYTHON $SRC3DIR/torture/test_ntlm_auth.py $NTLM_AUTH --client-username=$USERNAME --client-domain=$DOMAIN --client-password=$PASSWORD --server-use-winbindd $ADDARGS || failed=`expr $failed + 1` 275 testit "ntlm_auth with NTLMSSP client and gss-spnego server" $PYTHON $SRC3DIR/torture/test_ntlm_auth.py $NTLM_AUTH $ADDARGS --client-domain=fOo --server-domain=fOo --client-helper=ntlmssp-client-1 --server-helper=gss-spnego || failed=`expr $failed + 1` 276 testit "ntlm_auth with NTLMSSP gss-spnego-client and gss-spnego server" $PYTHON $SRC3DIR/torture/test_ntlm_auth.py $NTLM_AUTH $ADDARGS --client-domain=fOo --server-domain=fOo --client-helper=gss-spnego-client --server-helper=gss-spnego || failed=`expr $failed + 1` 277 testit "ntlm_auth with NTLMSSP gss-spnego-client and gss-spnego server against winbind" $PYTHON $SRC3DIR/torture/test_ntlm_auth.py $NTLM_AUTH --client-username=$USERNAME --client-domain=$DOMAIN --client-password=$PASSWORD --server-use-winbindd --client-helper=gss-spnego-client --server-helper=gss-spnego $ADDARGS || failed=`expr $failed + 1` 278 279 testit "wbinfo store cached credentials" $BINDIR/wbinfo --ccache-save=$DOMAIN/$USERNAME%$PASSWORD || failed=`expr $failed + 1` 280 testit "ntlm_auth ccached credentials with NTLMSSP client and gss-spnego server" $PYTHON $SRC3DIR/torture/test_ntlm_auth.py $NTLM_AUTH $ADDARGS --client-username=$USERNAME --client-domain=$DOMAIN --client-use-cached-creds --client-helper=ntlmssp-client-1 --server-helper=gss-spnego --server-use-winbindd || failed=`expr $failed + 1` 281 282 testit "ntlm_auth against winbindd with require-membership-of" $PYTHON $SRC3DIR/torture/test_ntlm_auth.py $NTLM_AUTH --client-username=$USERNAME --client-domain=$DOMAIN --client-password=$PASSWORD --server-use-winbindd $ADDARGS --require-membership-of=$SID || failed=`expr $failed + 1` 283 testit "ntlm_auth with NTLMSSP gss-spnego-client and gss-spnego server against winbind with require-membership-of" $PYTHON $SRC3DIR/torture/test_ntlm_auth.py $NTLM_AUTH --client-username=$USERNAME --client-domain=$DOMAIN --client-password=$PASSWORD --server-use-winbindd --client-helper=gss-spnego-client --server-helper=gss-spnego $ADDARGS --require-membership-of=$SID || failed=`expr $failed + 1` 284 285 testit_expect_failure "ntlm_auth against winbindd with failed require-membership-of" $PYTHON $SRC3DIR/torture/test_ntlm_auth.py $NTLM_AUTH --client-username=$USERNAME --client-domain=$DOMAIN --client-password=$PASSWORD --server-use-winbindd $ADDARGS --require-membership-of=$BADSID && failed=`expr $failed + 1` 286 testit_expect_failure "ntlm_auth with NTLMSSP gss-spnego-client and gss-spnego server against winbind with failed require-membership-of" $PYTHON $SRC3DIR/torture/test_ntlm_auth.py $NTLM_AUTH --client-username=$USERNAME --client-domain=$DOMAIN --client-password=$PASSWORD --server-use-winbindd --client-helper=gss-spnego-client --server-helper=gss-spnego $ADDARGS --require-membership-of=$BADSID && failed=`expr $failed + 1` 287 288 testit "ntlm_auth plaintext authentication with require-membership-of" test_plaintext_check_output_stdout || failed=`expr $failed + 1` 289 testit "ntlm_auth plaintext authentication with failed require-membership-of" test_plaintext_check_output_fail || failed=`expr $failed + 1` 290 291 testit "ntlm_auth ntlm-server-1 with fixed password" test_ntlm_server_1_check_output || failed=`expr $failed + 1` 292 testit "ntlm_auth ntlm-server-1 with incorrect fixed password" test_ntlm_server_1_check_output_fail || failed=`expr $failed + 1` 293 testit "ntlm_auth ntlm-server-1 with plaintext password against winbind" test_ntlm_server_1_check_winbind_output || failed=`expr $failed + 1` 294 testit "ntlm_auth ntlm-server-1 with plaintext password against winbind but wrong sid" test_ntlm_server_1_check_winbind_output_wrong_sid || failed=`expr $failed + 1` 295 testit "ntlm_auth ntlm-server-1 with incorrect fixed password against winbind" test_ntlm_server_1_check_winbind_output_fail || failed=`expr $failed + 1` 26 296 27 297 testok $0 $failed -
vendor/current/source3/script/tests/test_pthreadpool.sh
r740 r988 4 4 . $incdir/subunit.sh 5 5 6 TESTPROG=$BINDIR/pthreadpooltest7 8 6 if [ ! -x $BINDIR/pthreadpooltest ] ; then 9 TESTPROG=/bin/true 7 # Some machines don't have /bin/true, simulate it 8 cat >$BINDIR/pthreadpooltest <<EOF 9 #!/bin/sh 10 exit 0 11 EOF 12 chmod +x $BINDIR/pthreadpooltest 10 13 fi 11 14 12 15 failed=0 13 16 14 testit "pthreadpool" $VALGRIND $ TESTPROG||17 testit "pthreadpool" $VALGRIND $BINDIR/pthreadpooltest || 15 18 failed=`expr $failed + 1` 16 19 -
vendor/current/source3/script/tests/test_smbclient_auth.sh
r740 r988 3 3 # this runs the file serving tests that are expected to pass with samba3 against shares with various options 4 4 5 if [ $# -lt 4]; then5 if [ $# -lt 5 ]; then 6 6 cat <<EOF 7 Usage: test_smbclient_ s3.sh SERVER SERVER_IP USERNAME PASSWORD<smbclient arguments>7 Usage: test_smbclient_auth.sh SERVER SERVER_IP USERNAME PASSWORD SMBCLIENT <smbclient arguments> 8 8 EOF 9 9 exit 1; … … 14 14 USERNAME="$3" 15 15 PASSWORD="$4" 16 SMBCLIENT="$VALGRIND ${SMBCLIENT:-$BINDIR/smbclient}" 17 shift 4 16 SMBCLIENT="$5" 17 SMBCLIENT="$VALGRIND ${SMBCLIENT}" 18 shift 5 18 19 ADDARGS="$*" 19 20 20 test x"$TEST_FUNCTIONS_SH" != x"INCLUDED" && {21 21 incdir=`dirname $0`/../../../testprogs/blackbox 22 22 . $incdir/subunit.sh 23 24 echo "${SERVER_IP}" | grep -q ':.*:' && { 25 # If we have an ipv6 address e.g. 26 # fd00:0000:0000:0000:0000:0000:5357:5f03 27 # we also try 28 # fd00-0000-0000-0000-0000-0000-5357-5f03.ipv6-literal.net 29 IPV6LITERAL=$(echo "${SERVER_IP}.ipv6-literal.net" | sed -e 's!:!-!g' -e 's!%!s!') 30 testit "smbclient //${IPV6LITERAL}/tmpguest" $SMBCLIENT //${IPV6LITERAL}/tmpguest $CONFIGURATION -U$USERNAME%$PASSWORD -c quit $ADDARGS 31 testit "smbclient //${IPV6LITERAL}./tmpguest" $SMBCLIENT //${IPV6LITERAL}./tmpguest $CONFIGURATION -U$USERNAME%$PASSWORD -c quit $ADDARGS 23 32 } 33 testit "smbclient //${SERVER_IP}/tmpguest" $SMBCLIENT //${SERVER_IP}/tmpguest $CONFIGURATION -U$USERNAME%$PASSWORD -p 139 -c quit $ADDARGS 24 34 25 35 testit "smbclient //$SERVER/guestonly" $SMBCLIENT //$SERVER/guestonly $CONFIGURATION -U$USERNAME%$PASSWORD -I $SERVER_IP -p 139 -c quit $ADDARGS … … 29 39 testit "smbclient //$SERVER/forceuser" $SMBCLIENT //$SERVER/forceuser $CONFIGURATION -U$USERNAME%$PASSWORD -I $SERVER_IP -p 139 -c quit $ADDARGS 30 40 testit "smbclient //$SERVER/forceuser as anon" $SMBCLIENT //$SERVER/forceuser $CONFIGURATION -U% -I $SERVER_IP -p 139 -c quit $ADDARGS 41 testit "smbclient //$SERVER/forceuser_unixonly" $SMBCLIENT //$SERVER/forceuser_unixonly $CONFIGURATION -U$USERNAME%$PASSWORD -I $SERVER_IP -p 139 -c quit $ADDARGS 42 testit "smbclient //$SERVER/forceuser_wkngroup" $SMBCLIENT //$SERVER/forceuser_wkngroup $CONFIGURATION -U$USERNAME%$PASSWORD -I $SERVER_IP -p 139 -c quit $ADDARGS 31 43 testit "smbclient //$SERVER/forcegroup" $SMBCLIENT //$SERVER/forcegroup $CONFIGURATION -U$USERNAME%$PASSWORD -I $SERVER_IP -p 139 -c quit $ADDARGS 32 44 testit "smbclient //$SERVER/forcegroup as anon" $SMBCLIENT //$SERVER/forcegroup $CONFIGURATION -U% -I $SERVER_IP -p 139 -c quit $ADDARGS -
vendor/current/source3/script/tests/test_smbclient_s3.sh
r740 r988 3 3 # this runs the file serving tests that are expected to pass with samba3 4 4 5 if [ $# -lt 7]; then5 if [ $# -lt 11 ]; then 6 6 cat <<EOF 7 Usage: test_smbclient_s3.sh SERVER SERVER_IP USERNAME PASSWORD USERID LOCAL_PATH PREFIX7 Usage: test_smbclient_s3.sh SERVER SERVER_IP DOMAIN USERNAME PASSWORD USERID LOCAL_PATH PREFIX SMBCLIENT WBINFO NET 8 8 EOF 9 9 exit 1; 10 10 fi 11 11 12 SERVER="$1" 13 SERVER_IP="$2" 14 USERNAME="$3" 15 PASSWORD="$4" 16 USERID="$5" 17 LOCAL_PATH="$6" 18 PREFIX="$7" 19 SMBCLIENT="$VALGRIND ${SMBCLIENT:-$BINDIR/smbclient}" 20 WBINFO="$VALGRIND ${WBINFO:-$BINDIR/wbinfo}" 21 shift 7 12 SERVER="${1}" 13 SERVER_IP="${2}" 14 DOMAIN="${3}" 15 USERNAME="${4}" 16 PASSWORD="${5}" 17 USERID="${6}" 18 LOCAL_PATH="${7}" 19 PREFIX="${8}" 20 SMBCLIENT="${9}" 21 WBINFO="${10}" 22 NET="${11}" 23 SMBCLIENT="$VALGRIND ${SMBCLIENT}" 24 WBINFO="$VALGRIND ${WBINFO}" 25 shift 11 22 26 ADDARGS="$*" 23 27 24 test x"$TEST_FUNCTIONS_SH" != x"INCLUDED" && {25 28 incdir=`dirname $0`/../../../testprogs/blackbox 26 29 . $incdir/subunit.sh 27 }28 30 29 31 failed=0 … … 134 136 test_good_symlink() 135 137 { 136 tmpfile= /tmp/smbclient.in.$$138 tmpfile=$PREFIX/smbclient.in.$$ 137 139 slink_name="$LOCAL_PATH/slink" 138 140 slink_target="$LOCAL_PATH/slink_target" … … 184 186 { 185 187 prompt="NT_STATUS_ACCESS_DENIED making remote directory" 186 tmpfile= /tmp/smbclient.in.$$188 tmpfile=$PREFIX/smbclient.in.$$ 187 189 188 190 ## … … 211 213 EOF 212 214 213 cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U% //$SERVER/ro-tmp-I $SERVER_IP $ADDARGS < $tmpfile 2>&1'215 cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT -U% "//$SERVER/$1" -I $SERVER_IP $ADDARGS < $tmpfile 2>&1' 214 216 eval echo "$cmd" 215 217 out=`eval $cmd` … … 220 222 echo "$out" 221 223 echo "failed writing into read-only directory with error $ret" 224 222 225 false 223 226 return … … 237 240 } 238 241 242 243 # Test sending a message 244 test_message() 245 { 246 tmpfile=$PREFIX/message_in.$$ 247 248 cat > $tmpfile <<EOF 249 Test message from pid $$ 250 EOF 251 252 cmd='$SMBCLIENT "$@" -U$USERNAME%$PASSWORD -M $SERVER -p 139 $ADDARGS -n msgtest < $tmpfile 2>&1' 253 eval echo "$cmd" 254 out=`eval $cmd` 255 ret=$? 256 257 if [ $ret != 0 ] ; then 258 echo "$out" 259 echo "failed sending message to $SERVER with error $ret" 260 false 261 rm -f $tmpfile 262 return 263 fi 264 265 # The server writes this into a file message.msgtest, via message.%m to test the % sub code 266 cmd='$SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/tmpguest -p 139 $ADDARGS -c "get message.msgtest $PREFIX/message_out.$$" 2>&1' 267 eval echo "$cmd" 268 out=`eval $cmd` 269 ret=$? 270 271 if [ $ret != 0 ] ; then 272 echo "$out" 273 echo "failed getting sent message from $SERVER with error $ret" 274 false 275 return 276 fi 277 278 if [ cmp $PREFIX/message_out.$$ $tmpfile != 0 ] ; then 279 echo "failed comparison of message from $SERVER" 280 false 281 return 282 fi 283 true 284 } 285 239 286 # Test reading an owner-only file (logon as guest) fails. 240 287 test_owner_only_file() 241 288 { 242 289 prompt="NT_STATUS_ACCESS_DENIED opening remote file" 243 tmpfile= /tmp/smbclient.in.$$290 tmpfile=$PREFIX/smbclient.in.$$ 244 291 245 292 ## … … 297 344 test_msdfs_link() 298 345 { 299 tmpfile= /tmp/smbclient.in.$$346 tmpfile=$PREFIX/smbclient.in.$$ 300 347 prompt=" msdfs-target " 301 348 … … 363 410 } 364 411 412 # Archive bits are correctly set on file/dir creation and rename. 413 test_rename_archive_bit() 414 { 415 prompt_file="attributes: A (20)" 416 prompt_dir="attributes: D (10)" 417 tmpfile="$PREFIX/smbclient.in.$$" 418 filename="foo.$$" 419 filename_ren="bar.$$" 420 dirname="foodir.$$" 421 dirname_ren="bardir.$$" 422 filename_path="$PREFIX/$filename" 423 local_name1="$LOCAL_PATH/$filename" 424 local_name2="$LOCAL_PATH/$filename_ren" 425 local_dir_name1="$LOCAL_PATH/$dirname" 426 local_dir_name2="$LOCAL_PATH/$dirname_ren" 427 428 rm -f $filename_path 429 rm -f $local_name1 430 rm -f $local_name2 431 432 # Create a new file, ensure it has 'A' attributes. 433 touch $filename_path 434 435 cat > $tmpfile <<EOF 436 lcd $PREFIX 437 put $filename 438 allinfo $filename 439 quit 440 EOF 441 442 cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp -I $SERVER_IP $ADDARGS < $tmpfile 2>&1' 443 eval echo "$cmd" 444 out=`eval $cmd` 445 ret=$? 446 rm -f $tmpfile 447 448 if [ $ret != 0 ] ; then 449 echo "$out" 450 echo "failed creating file $filename with error $ret" 451 false 452 return 453 fi 454 455 echo "$out" | grep "$prompt_file" >/dev/null 2>&1 456 457 ret=$? 458 459 rm -f $filename_path 460 rm -f $local_name1 461 rm -f $local_name2 462 463 if [ $ret = 0 ] ; then 464 # got the correct prompt .. succeed 465 true 466 else 467 echo "$out" 468 echo "Attributes incorrect on new file $ret" 469 false 470 fi 471 472 # Now check if we remove 'A' and rename, the A comes back. 473 touch $filename_path 474 475 cat > $tmpfile <<EOF 476 lcd $PREFIX 477 put $filename 478 setmode $filename -a 479 ren $filename $filename_ren 480 allinfo $filename_ren 481 quit 482 EOF 483 484 cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp -I $SERVER_IP $ADDARGS < $tmpfile 2>&1' 485 eval echo "$cmd" 486 out=`eval $cmd` 487 ret=$? 488 rm -f $tmpfile 489 490 if [ $ret != 0 ] ; then 491 echo "$out" 492 echo "failed creating file and renaming $filename with error $ret" 493 false 494 return 495 fi 496 497 echo "$out" | grep "$prompt_file" >/dev/null 2>&1 498 499 ret=$? 500 501 rm -f $filename_path 502 rm -f $local_name1 503 rm -f $local_name2 504 505 if [ $ret = 0 ] ; then 506 # got the correct prompt .. succeed 507 true 508 else 509 echo "$out" 510 echo "Attributes incorrect on renamed file $ret" 511 false 512 fi 513 514 rm -rf $local_dir_name1 515 rm -rf $local_dir_name2 516 517 # Create a new directory, ensure it has 'D' but not 'A' attributes. 518 519 cat > $tmpfile <<EOF 520 mkdir $dirname 521 allinfo $dirname 522 quit 523 EOF 524 525 cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp -I $SERVER_IP $ADDARGS < $tmpfile 2>&1' 526 eval echo "$cmd" 527 out=`eval $cmd` 528 ret=$? 529 rm -f $tmpfile 530 531 if [ $ret != 0 ] ; then 532 echo "$out" 533 echo "failed creating directory $dirname with error $ret" 534 false 535 return 536 fi 537 538 echo "$out" | grep "$prompt_dir" >/dev/null 2>&1 539 540 ret=$? 541 542 rm -rf $local_dir_name1 543 rm -rf $local_dir_name2 544 545 if [ $ret = 0 ] ; then 546 # got the correct prompt .. succeed 547 true 548 else 549 echo "$out" 550 echo "Attributes incorrect on new directory $ret" 551 false 552 fi 553 554 # Now check if we rename, we still only have 'D' attributes 555 556 cat > $tmpfile <<EOF 557 mkdir $dirname 558 ren $dirname $dirname_ren 559 allinfo $dirname_ren 560 quit 561 EOF 562 563 cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp -I $SERVER_IP $ADDARGS < $tmpfile 2>&1' 564 eval echo "$cmd" 565 out=`eval $cmd` 566 ret=$? 567 rm -f $tmpfile 568 569 if [ $ret != 0 ] ; then 570 echo "$out" 571 echo "failed creating directory $dirname and renaming with error $ret" 572 false 573 return 574 fi 575 576 echo "$out" | grep "$prompt_dir" >/dev/null 2>&1 577 578 ret=$? 579 580 rm -f $local_name1 581 rm -f $local_name2 582 583 if [ $ret = 0 ] ; then 584 # got the correct prompt .. succeed 585 true 586 else 587 echo "$out" 588 echo "Attributes incorrect on renamed directory $ret" 589 false 590 fi 591 } 592 365 593 # Test authenticating using the winbind ccache 366 594 test_ccache_access() 367 595 { 368 596 $WBINFO --ccache-save="${USERNAME}%${PASSWORD}" 369 $SMBCLIENT //$SERVER_IP/tmp -C -U "${USERNAME}%" \ 597 ret=$? 598 599 if [ $ret != 0 ] ; then 600 echo "wbinfo failed to store creds in cache (user='${USERNAME}', pass='${PASSWORD}')" 601 false 602 return 603 fi 604 605 $SMBCLIENT //$SERVER_IP/tmp -C -U "${USERNAME}" \ 370 606 -c quit 2>&1 371 607 ret=$? … … 378 614 379 615 $WBINFO --ccache-save="${USERNAME}%GarBage" 380 $SMBCLIENT //$SERVER_IP/tmp -C -U "${USERNAME}%" \ 616 ret=$? 617 618 if [ $ret != 0 ] ; then 619 echo "wbinfo failed to store creds in cache (user='${USERNAME}', pass='GarBage')" 620 false 621 return 622 fi 623 624 $SMBCLIENT //$SERVER_IP/tmp -C -U "${USERNAME}" \ 381 625 -c quit 2>&1 382 626 ret=$? … … 389 633 390 634 $WBINFO --logoff 635 } 636 637 # Test authenticating using the winbind ccache 638 test_auth_file() 639 { 640 tmpfile=$PREFIX/smbclient.in.$$ 641 cat > $tmpfile <<EOF 642 username=${USERNAME} 643 password=${PASSWORD} 644 domain=${DOMAIN} 645 EOF 646 $SMBCLIENT //$SERVER_IP/tmp --authentication-file=$tmpfile \ 647 -c quit 2>&1 648 ret=$? 649 rm $tmpfile 650 651 if [ $ret != 0 ] ; then 652 echo "smbclient failed to use auth file" 653 false 654 return 655 fi 656 657 cat > $tmpfile <<EOF 658 username=${USERNAME} 659 password=xxxx 660 domain=${DOMAIN} 661 EOF 662 $SMBCLIENT //$SERVER_IP/tmp --authentication-file=$tmpfile\ 663 -c quit 2>&1 664 ret=$? 665 rm $tmpfile 666 667 if [ $ret -eq 0 ] ; then 668 echo "smbclient succeeded with wrong auth file credentials" 669 false 670 return 671 fi 672 } 673 674 # Test doing a directory listing with backup privilege. 675 test_backup_privilege_list() 676 { 677 tmpfile=$PREFIX/smbclient_backup_privilege_list 678 679 # If we don't have a DOMAIN component to the username, add it. 680 echo "$USERNAME" | grep '\\' 2>&1 681 ret=$? 682 if [ $ret != 0 ] ; then 683 priv_username="$DOMAIN\\$USERNAME" 684 else 685 priv_username=$USERNAME 686 fi 687 688 $NET sam rights grant $priv_username SeBackupPrivilege 2>&1 689 ret=$? 690 if [ $ret != 0 ] ; then 691 echo "Failed to add SeBackupPrivilege to user $priv_username - $ret" 692 false 693 return 694 fi 695 696 cat > $tmpfile <<EOF 697 backup 698 ls 699 quit 700 EOF 701 702 cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp -I $SERVER_IP $ADDARGS < $tmpfile 2>&1' 703 eval echo "$cmd" 704 out=`eval $cmd` 705 ret=$? 706 rm -f $tmpfile 707 708 if [ $ret != 0 ] ; then 709 echo "$out" 710 echo "failed backup privilege list $ret" 711 false 712 return 713 fi 714 715 # Now remove all privileges from this SID. 716 $NET sam rights revoke $priv_username SeBackupPrivilege 2>&1 717 ret=$? 718 if [ $ret != 0 ] ; then 719 echo "failed to remove SeBackupPrivilege from user $priv_username - $ret" 720 false 721 return 722 fi 723 } 724 725 # Test accessing an share with bad names (won't convert). 726 test_bad_names() 727 { 728 cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/badname-tmp -I $SERVER_IP $ADDARGS -c ls 2>&1' 729 eval echo "$cmd" 730 out=`eval $cmd` 731 ret=$? 732 733 if [ $ret != 0 ] ; then 734 echo "$out" 735 echo "failed accessing badname-tmp (SMB1) with error $ret" 736 false 737 return 738 fi 739 740 echo "$out" | wc -l 2>&1 | grep 6 741 ret=$? 742 if [ $ret != 0 ] ; then 743 echo "$out" 744 echo "failed listing \\badname-tmp - grep of number of lines (1) failed with $ret" 745 false 746 fi 747 748 echo "$out" | grep 'Domain=.*OS=.*Server=' 749 ret=$? 750 if [ $ret != 0 ] ; then 751 echo "$out" 752 echo "failed listing \\badname-tmp - grep (1) failed with $ret" 753 false 754 fi 755 756 echo "$out" | grep '^ \. *D' 757 ret=$? 758 if [ $ret != 0 ] ; then 759 echo "$out" 760 echo "failed listing \\badname-tmp - grep (2) failed with $ret" 761 false 762 fi 763 764 echo "$out" | grep '^ \.\. *D' 765 ret=$? 766 if [ $ret != 0 ] ; then 767 echo "$out" 768 echo "failed listing \\badname-tmp - grep (3) failed with $ret" 769 false 770 fi 771 772 echo "$out" | grep '^ blank.txt *N' 773 ret=$? 774 if [ $ret != 0 ] ; then 775 echo "$out" 776 echo "failed listing \\badname-tmp - grep (4) failed with $ret" 777 false 778 fi 779 780 echo "$out" | grep '^ *$' 781 ret=$? 782 if [ $ret != 0 ] ; then 783 echo "$out" 784 echo "failed listing \\badname-tmp - grep (5) failed with $ret" 785 false 786 fi 787 788 echo "$out" | grep 'blocks of size.*blocks available' 789 ret=$? 790 if [ $ret != 0 ] ; then 791 echo "$out" 792 echo "failed listing \\badname-tmp - grep (6) failed with $ret" 793 false 794 fi 795 796 # Now check again with -mSMB3 797 cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/badname-tmp -I $SERVER_IP -mSMB3 $ADDARGS -c ls 2>&1' 798 eval echo "$cmd" 799 out=`eval $cmd` 800 ret=$? 801 802 if [ $ret != 0 ] ; then 803 echo "$out" 804 echo "failed accessing badname-tmp (SMB3) with error $ret" 805 false 806 return 807 fi 808 809 echo "$out" | wc -l 2>&1 | grep 6 810 ret=$? 811 if [ $ret != 0 ] ; then 812 echo "$out" 813 echo "failed listing \\badname-tmp - SMB3 grep of number of lines (1) failed with $ret" 814 false 815 fi 816 817 echo "$out" | grep 'Domain=.*OS=.*Server=' 818 ret=$? 819 if [ $ret != 0 ] ; then 820 echo "$out" 821 echo "failed listing \\badname-tmp - SMB3 grep (1) failed with $ret" 822 false 823 fi 824 825 echo "$out" | grep '^ \. *D' 826 ret=$? 827 if [ $ret != 0 ] ; then 828 echo "$out" 829 echo "failed listing \\badname-tmp - SMB3 grep (2) failed with $ret" 830 false 831 fi 832 833 echo "$out" | grep '^ \.\. *D' 834 ret=$? 835 if [ $ret != 0 ] ; then 836 echo "$out" 837 echo "failed listing \\badname-tmp - SMB3 grep (3) failed with $ret" 838 false 839 fi 840 841 echo "$out" | grep '^ blank.txt *N' 842 ret=$? 843 if [ $ret != 0 ] ; then 844 echo "$out" 845 echo "failed listing \\badname-tmp - SMB3 grep (4) failed with $ret" 846 false 847 fi 848 849 echo "$out" | grep '^ *$' 850 ret=$? 851 if [ $ret != 0 ] ; then 852 echo "$out" 853 echo "failed listing \\badname-tmp - SMB3 grep (5) failed with $ret" 854 false 855 fi 856 857 echo "$out" | grep 'blocks of size.*blocks available' 858 ret=$? 859 if [ $ret != 0 ] ; then 860 echo "$out" 861 echo "failed listing \\badname-tmp - SMB3 grep (6) failed with $ret" 862 false 863 fi 864 } 865 866 # Test accessing an share with a name that must be mangled - with acl_xattrs. 867 # We know foo:bar gets mangled to FF4GBY~Q with the default name-mangling algorithm (hash2). 868 test_mangled_names() 869 { 870 tmpfile=$PREFIX/smbclient_interactive_prompt_commands 871 cat > $tmpfile <<EOF 872 ls 873 cd FF4GBY~Q 874 ls 875 quit 876 EOF 877 cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/manglenames_share -I $SERVER_IP $ADDARGS < $tmpfile 2>&1' 878 eval echo "$cmd" 879 out=`eval $cmd` 880 ret=$? 881 rm -f $tmpfile 882 883 if [ $ret != 0 ] ; then 884 echo "$out" 885 echo "failed accessing manglenames_share with error $ret" 886 false 887 return 888 fi 889 890 echo "$out" | grep 'NT_STATUS' 891 ret=$? 892 if [ $ret == 0 ] ; then 893 echo "$out" 894 echo "failed - NT_STATUS_XXXX listing \\manglenames_share\\FF4GBY~Q" 895 false 896 fi 897 } 898 899 # Test using scopy to copy a file on the server. 900 test_scopy() 901 { 902 tmpfile=$PREFIX/smbclient_interactive_prompt_commands 903 scopy_file=$PREFIX/scopy_file 904 905 rm -f $scopy_file 906 cat > $tmpfile <<EOF 907 put ${SMBCLIENT} 908 scopy smbclient scopy_file 909 lcd ${PREFIX} 910 get scopy_file 911 del smbclient 912 del scopy_file 913 quit 914 EOF 915 cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -mSMB3 -U$USERNAME%$PASSWORD //$SERVER/tmp -I $SERVER_IP $ADDARGS < $tmpfile 2>&1' 916 eval echo "$cmd" 917 out=`eval $cmd` 918 ret=$? 919 out1=`md5sum ${SMBCLIENT} | sed -e 's/ .*//'` 920 out2=`md5sum ${scopy_file} | sed -e 's/ .*//'` 921 rm -f $tmpfile 922 rm -f $scopy_file 923 924 if [ $ret != 0 ] ; then 925 echo "$out" 926 echo "failed scopy test (1) with output $ret" 927 false 928 return 929 fi 930 931 if [ $out1 != $out2 ] ; then 932 echo "$out1 $out2" 933 echo "failed md5sum (1)" 934 false 935 fi 936 937 # 938 # Now do again using SMB1 939 # to force client-side fallback. 940 # 941 942 cat > $tmpfile <<EOF 943 put ${SMBCLIENT} 944 scopy smbclient scopy_file 945 lcd ${PREFIX} 946 get scopy_file 947 del smbclient 948 del scopy_file 949 quit 950 EOF 951 cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -mNT1 -U$USERNAME%$PASSWORD //$SERVER/tmp -I $SERVER_IP $ADDARGS < $tmpfile 2>&1' 952 eval echo "$cmd" 953 out=`eval $cmd` 954 ret=$? 955 out1=`md5sum ${SMBCLIENT} | sed -e 's/ .*//'` 956 out2=`md5sum ${scopy_file} | sed -e 's/ .*//'` 957 rm -f $tmpfile 958 rm -f $scopy_file 959 960 if [ $ret != 0 ] ; then 961 echo "$out" 962 echo "failed scopy test (2) with output $ret" 963 false 964 return 965 fi 966 967 if [ $out1 != $out2 ] ; then 968 echo "$out1 $out2" 969 echo "failed md5sum (2)" 970 false 971 fi 972 } 973 974 # Test creating a stream on the root of the share directory filname - :foobar 975 test_toplevel_stream() 976 { 977 tmpfile=$PREFIX/smbclient_interactive_prompt_commands 978 cat > $tmpfile <<EOF 979 put ${PREFIX}/smbclient_interactive_prompt_commands :foobar 980 allinfo \\ 981 setmode \\ -a 982 quit 983 EOF 984 cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp -I $SERVER_IP -mSMB3 $ADDARGS < $tmpfile 2>&1' 985 eval echo "$cmd" 986 out=`eval $cmd` 987 ret=$? 988 rm -f $tmpfile 989 990 if [ $ret != 0 ] ; then 991 echo "$out" 992 echo "failed creating toplevel stream :foobar with error $ret" 993 false 994 return 995 fi 996 997 echo "$out" | grep '^stream:.*:foobar' 998 ret=$? 999 if [ $ret != 0 ] ; then 1000 echo "$out" 1001 echo "failed creating toplevel stream :foobar" 1002 false 1003 fi 1004 } 1005 1006 # Test wide links are restricted. 1007 test_widelinks() 1008 { 1009 tmpfile=$PREFIX/smbclient_interactive_prompt_commands 1010 cat > $tmpfile <<EOF 1011 cd dot 1012 ls 1013 quit 1014 EOF 1015 cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/widelinks_share -I $SERVER_IP $ADDARGS < $tmpfile 2>&1' 1016 eval echo "$cmd" 1017 out=`eval $cmd` 1018 ret=$? 1019 rm -f $tmpfile 1020 1021 if [ $ret != 0 ] ; then 1022 echo "$out" 1023 echo "failed accessing widelinks_share with error $ret" 1024 false 1025 return 1026 fi 1027 1028 echo "$out" | grep 'NT_STATUS' 1029 ret=$? 1030 if [ $ret == 0 ] ; then 1031 echo "$out" 1032 echo "failed - NT_STATUS_XXXX listing \\widelinks_share\\dot" 1033 false 1034 fi 1035 1036 cat > $tmpfile <<EOF 1037 allinfo source 1038 quit 1039 EOF 1040 cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/widelinks_share -I $SERVER_IP $ADDARGS < $tmpfile 2>&1' 1041 eval echo "$cmd" 1042 out=`eval $cmd` 1043 ret=$? 1044 rm -f $tmpfile 1045 1046 if [ $ret != 0 ] ; then 1047 echo "$out" 1048 echo "failed accessing widelinks_share with error $ret" 1049 false 1050 return 1051 fi 1052 1053 # This should fail with NT_STATUS_ACCESS_DENIED 1054 echo "$out" | grep 'NT_STATUS_ACCESS_DENIED' 1055 ret=$? 1056 if [ $ret != 0 ] ; then 1057 echo "$out" 1058 echo "failed - should get NT_STATUS_ACCESS_DENIED listing \\widelinks_share\\source" 1059 false 1060 fi 391 1061 } 392 1062 … … 431 1101 432 1102 testit "writing into a read-only directory fails" \ 433 test_read_only_dir || \ 1103 test_read_only_dir ro-tmp || \ 1104 failed=`expr $failed + 1` 1105 1106 testit "writing into a read-only share fails" \ 1107 test_read_only_dir valid-users-tmp || \ 434 1108 failed=`expr $failed + 1` 435 1109 … … 442 1116 failed=`expr $failed + 1` 443 1117 1118 testit "Ensure archive bit is set correctly on file/dir rename" \ 1119 test_rename_archive_bit || \ 1120 failed=`expr $failed + 1` 1121 444 1122 testit "ccache access works for smbclient" \ 445 1123 test_ccache_access || \ 446 1124 failed=`expr $failed + 1` 447 1125 1126 testit "sending a message to the remote server" \ 1127 test_message || \ 1128 failed=`expr $failed + 1` 1129 1130 testit "using an authentication file" \ 1131 test_auth_file || \ 1132 failed=`expr $failed + 1` 1133 1134 testit "list with backup privilege" \ 1135 test_backup_privilege_list || \ 1136 failed=`expr $failed + 1` 1137 1138 testit "list a share with bad names (won't convert)" \ 1139 test_bad_names || \ 1140 failed=`expr $failed + 1` 1141 1142 testit "list a share with a mangled name + acl_xattr object" \ 1143 test_mangled_names || \ 1144 failed=`expr $failed + 1` 1145 1146 testit "server-side file copy" \ 1147 test_scopy || \ 1148 failed=`expr $failed + 1` 1149 1150 testit "creating a :stream at root of share" \ 1151 test_toplevel_stream || \ 1152 failed=`expr $failed + 1` 1153 1154 testit "Ensure widelinks are restricted" \ 1155 test_widelinks || \ 1156 failed=`expr $failed + 1` 1157 448 1158 testit "rm -rf $LOGDIR" \ 449 1159 rm -rf $LOGDIR || \ -
vendor/current/source3/script/tests/test_smbtorture_s3.sh
r740 r988 5 5 if [ $# -lt 4 ]; then 6 6 cat <<EOF 7 Usage: test_smbtorture_s3.sh TEST UNC USERNAME PASSWORD <smbtorture args>7 Usage: test_smbtorture_s3.sh TEST UNC USERNAME PASSWORD SMBTORTURE <smbtorture args> 8 8 EOF 9 9 exit 1; … … 14 14 username="$3" 15 15 password="$4" 16 shift 4 16 SMBTORTURE="$5" 17 shift 5 17 18 ADDARGS="$*" 18 19 19 test x"$TEST_FUNCTIONS_SH" != x"INCLUDED" && {20 20 incdir=`dirname $0`/../../../testprogs/blackbox 21 21 . $incdir/subunit.sh 22 }23 22 24 23 25 24 26 25 failed=0 27 testit "smbtorture" $VALGRIND $ BINDIR/smbtorture$unc -U"$username"%"$password" $ADDARGS $t || failed=`expr $failed + 1`26 testit "smbtorture" $VALGRIND $SMBTORTURE $unc -U"$username"%"$password" $ADDARGS $t || failed=`expr $failed + 1` 28 27 29 28 testok $0 $failed -
vendor/current/source3/script/tests/test_success.sh
r740 r988 5 5 # Copyright (C) 2011 Michael Adam <obnox@samba.org> 6 6 7 # include the blackbox subunit infrastructure 8 # if not run from classical s3 test script: 9 test x"$TEST_FUNCTIONS_SH" != x"INCLUDED" && { 10 incdir=`dirname $0`/../../../testprogs/blackbox 11 . $incdir/subunit.sh 12 } 7 incdir=`dirname $0`/../../../testprogs/blackbox 8 . $incdir/subunit.sh 13 9 14 10 failed=0 -
vendor/current/source3/script/tests/test_testparm_s3.sh
r740 r988 18 18 TESTPARM="$VALGRIND ${TESTPARM:-$BINDIR/testparm} --suppress-prompt --skip-logic-checks" 19 19 20 test x"$TEST_FUNCTIONS_SH" != x"INCLUDED" && {21 20 incdir=`dirname $0`/../../../testprogs/blackbox 22 21 . $incdir/subunit.sh 23 }24 22 25 23 failed=0 -
vendor/current/source3/script/tests/test_wbinfo_sids2xids.sh
r740 r988 1 1 #!/bin/sh 2 2 3 WBINFO="$VALGRIND ${NET:-$BINDIR/wbinfo} $CONFIGURATION" 3 WBINFO="$VALGRIND ${WBINFO:-$BINDIR/wbinfo} $CONFIGURATION" 4 NET="$VALGRIND ${NET:-$BINDIR/net} $CONFIGURATION" 4 5 TEST_INT=`dirname $0`/test_wbinfo_sids2xids_int.py 5 6 … … 7 8 . $incdir/subunit.sh 8 9 9 testit "sids2xids" ${TEST_INT} ${WBINFO} || failed=`expr $failed + 1`10 testit "sids2xids" ${TEST_INT} ${WBINFO} ${NET} || failed=`expr $failed + 1` 10 11 11 12 testok $0 $failed -
vendor/current/source3/script/tests/test_wbinfo_sids2xids_int.py
r740 r988 3 3 import sys,os,subprocess 4 4 5 if len(sys.argv) != 2: 6 print "Usage: test_wbinfo_sids2xids_int.py wbinfo" 5 6 if len(sys.argv) != 3: 7 print "Usage: test_wbinfo_sids2xids_int.py wbinfo net" 7 8 sys.exit(1) 8 9 9 10 wbinfo = sys.argv[1] 11 netcmd = sys.argv[2] 12 13 def flush_cache(): 14 os.system(netcmd + " cache flush") 15 16 def fill_cache(inids, idtype='gid'): 17 for inid in inids: 18 if inid is None: 19 continue 20 subprocess.Popen([wbinfo, '--%s-to-sid=%s' % (idtype, inid)], 21 stdout=subprocess.PIPE).communicate() 22 10 23 domain = subprocess.Popen([wbinfo, "--own-domain"], 11 24 stdout=subprocess.PIPE).communicate()[0].strip() 12 domsid = subprocess.Popen([wbinfo, "-n", domain + " \\"],25 domsid = subprocess.Popen([wbinfo, "-n", domain + "/"], 13 26 stdout=subprocess.PIPE).communicate()[0] 14 27 domsid = domsid.split(' ')[0] … … 19 32 sids=[ domsid + '-512', 'S-1-5-32-545', domsid + '-513' ] 20 33 34 flush_cache() 35 21 36 sids2xids = subprocess.Popen([wbinfo, '--sids-to-unix-ids=' + ','.join(sids)], 22 37 stdout=subprocess.PIPE).communicate()[0].strip() 23 38 24 39 gids=[] 40 uids=[] 41 idtypes = [] 25 42 26 43 for line in sids2xids.split('\n'): 27 44 result = line.split(' ')[2:] 45 idtypes.append(result[0]) 28 46 47 gid = None 48 uid = None 29 49 if result[0] == 'gid': 30 50 gid = result[1] 31 else: 32 gid = '' 51 elif result[0] == 'uid': 52 uid = result[1] 53 elif result[0] == 'uid/gid': 54 gid = result[1] 55 uid = result[1] 56 33 57 if gid == '-1': 34 58 gid = '' 35 59 gids.append(gid) 36 60 37 i=0 61 if uid == '-1': 62 uid = '' 63 uids.append(uid) 38 64 39 for sid in sids: 40 gid = subprocess.Popen([wbinfo, '--sid-to-gid', sid], 41 stdout=subprocess.PIPE).communicate()[0].strip() 42 if gid != gids[i]: 43 print "Expected %s, got %s\n", gid, gids[i] 44 sys.exit(1) 45 i+=1 65 # Check the list produced by the sids-to-xids call with the 66 # singular variant (sid-to-xid) for each sid in turn. 67 def check_singular(sids, ids, idtype='gid'): 68 i = 0 69 for sid in sids: 70 if ids[i] is None: 71 continue 72 73 outid = subprocess.Popen([wbinfo, '--sid-to-%s' % idtype, sid], 74 stdout=subprocess.PIPE).communicate()[0].strip() 75 if outid != ids[i]: 76 print "Expected %s, got %s\n" % (outid, ids[i]) 77 flush_cache() 78 sys.exit(1) 79 i += 1 80 81 # Check the list produced by the sids-to-xids call with the 82 # multiple variant (sid-to-xid) for each sid in turn. 83 def check_multiple(sids, idtypes): 84 sids2xids = subprocess.Popen([wbinfo, '--sids-to-unix-ids=' + ','.join(sids)], 85 stdout=subprocess.PIPE).communicate()[0].strip() 86 # print sids2xids 87 i = 0 88 for line in sids2xids.split('\n'): 89 result = line.split(' ')[2:] 90 91 if result[0] != idtypes[i]: 92 print "Expected %s, got %s\n" % (idtypes[i], result[0]) 93 flush_cache() 94 sys.exit(1) 95 i += 1 96 97 # first round: with filled cache via sid-to-id 98 check_singular(sids, gids, 'gid') 99 check_singular(sids, uids, 'uid') 100 101 # second round: with empty cache 102 flush_cache() 103 check_singular(sids, gids, 'gid') 104 flush_cache() 105 check_singular(sids, uids, 'uid') 106 107 # third round: with filled cache via uid-to-sid 108 flush_cache() 109 fill_cache(uids, 'uid') 110 check_multiple(sids, idtypes) 111 112 # fourth round: with filled cache via gid-to-sid 113 flush_cache() 114 fill_cache(gids, 'gid') 115 check_multiple(sids, idtypes) 116 117 # flush the cache so any incorrect mappings don't break other tests 118 flush_cache() 46 119 47 120 sys.exit(0)
Note:
See TracChangeset
for help on using the changeset viewer.