diff options
author | Andrew Bartlett <abartlet@samba.org> | 2011-02-18 18:52:00 +1100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2011-02-22 14:50:14 +1100 |
commit | 1650da8a9964ba2ca3d389bdb39f65f7fa579ffc (patch) | |
tree | 19ac6a374eb2c79238d643edbeb3a86388d3050f | |
parent | c43eb39098d1bc507f550971fab4bce61f0e5d1a (diff) | |
download | samba-1650da8a9964ba2ca3d389bdb39f65f7fa579ffc.tar.gz samba-1650da8a9964ba2ca3d389bdb39f65f7fa579ffc.tar.bz2 samba-1650da8a9964ba2ca3d389bdb39f65f7fa579ffc.zip |
Add tests for various s3 auth modes
-rw-r--r-- | selftest/target/Samba3.pm | 45 | ||||
-rwxr-xr-x | source3/script/tests/test_posix_s3.sh | 12 | ||||
-rwxr-xr-x | source3/script/tests/test_smbclient_auth.sh | 38 | ||||
-rwxr-xr-x | source3/script/tests/test_smbclient_s3.sh | 2 | ||||
-rwxr-xr-x | source3/selftest/tests.sh | 4 |
5 files changed, 96 insertions, 5 deletions
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm index a0a13f9c72..06f070d65d 100644 --- a/selftest/target/Samba3.pm +++ b/selftest/target/Samba3.pm @@ -98,6 +98,8 @@ sub setup_env($$$) if ($envname eq "dc") { return $self->setup_dc("$path/dc"); + } elsif ($envname eq "secshare") { + return $self->setup_secshare("$path/secshare"); } elsif ($envname eq "member") { if (not defined($self->{vars}->{dc})) { $self->setup_dc("$path/dc"); @@ -178,6 +180,34 @@ sub setup_member($$$) return $ret; } +sub setup_secshare($$) +{ + my ($self, $path) = @_; + + print "PROVISIONING server with security=share..."; + + my $secshare_options = " + security = share + lanman auth = yes +"; + + my $vars = $self->provision($path, + "LOCALSHARE4", + 4, + "local4pass", + $secshare_options); + + $self->check_or_start($vars, + ($ENV{SMBD_MAXTIME} or 2700), + "yes", "no", "yes"); + + $self->wait_for_start($vars); + + $self->{vars}->{secshare} = $vars; + + return $vars; +} + sub stop_sig_term($$) { my ($self, $pid) = @_; kill("USR1", $pid) or kill("ALRM", $pid) or warn("Unable to kill $pid: $!"); @@ -572,6 +602,21 @@ sub provision($$$$$$) print CONF " [tmp] path = $shrdir +[tmpguest] + path = $shrdir + guest ok = yes +[guestonly] + path = $shrdir + guest only = yes + guest ok = yes +[forceuser] + path = $shrdir + force user = $unix_name + guest ok = yes +[forcegroup] + path = $shrdir + force group = nogroup + guest ok = yes [ro-tmp] path = $ro_shrdir guest ok = yes diff --git a/source3/script/tests/test_posix_s3.sh b/source3/script/tests/test_posix_s3.sh index 904f9f1f09..69c71fd2d4 100755 --- a/source3/script/tests/test_posix_s3.sh +++ b/source3/script/tests/test_posix_s3.sh @@ -60,10 +60,7 @@ winbind="winbind.struct winbind.wbclient" rap="rap.basic rap.rpc rap.printing rap.sam" -# note: to enable the unix-whoami test, we need to change the default share -# config to allow guest access. i'm not sure whether this would break other -# tests, so leaving it alone for now -- jpeach -unix="unix.info2" +unix="unix.info2 unix.whoami" tests="$base $raw $smb2 $rpc $unix $local $winbind $rap" @@ -83,6 +80,9 @@ for t in $tests; do name="$t" if [ "$t" = "base.delaywrite" ]; then testit "$name" $VALGRIND $SMBTORTURE4 $TORTURE4_OPTIONS --maximum-runtime=900 $ADDARGS $unc -U"$username"%"$password" $t || failed=`expr $failed + 1` + elif [ "$t" = "unix.whoami" ]; then + #"Testing with guest-enabled share" + testit "$name" $VALGRIND $SMBTORTURE4 $TORTURE4_OPTIONS $ADDARGS "$unc"guest -U"$username"%"$password" $t || failed=`expr $failed + 1` else testit "$name" $VALGRIND $SMBTORTURE4 $TORTURE4_OPTIONS $ADDARGS $unc -U"$username"%"$password" $t || failed=`expr $failed + 1` fi @@ -90,6 +90,10 @@ for t in $tests; do echo "Testing with case sensitive" testit "$name" $VALGRIND $SMBTORTURE4 $TORTURE4_OPTIONS $ADDARGS "$unc"case -U"$username"%"$password" $t || failed=`expr $failed + 1` fi + if [ "$t" = "unix.whoami" ]; then + echo "Testing with guest-enabled share" + testit "$name" $VALGRIND $SMBTORTURE4 $TORTURE4_OPTIONS $ADDARGS "$unc"guest -U"$username"%"$password" $t || failed=`expr $failed + 1` + fi done testok $0 $failed diff --git a/source3/script/tests/test_smbclient_auth.sh b/source3/script/tests/test_smbclient_auth.sh new file mode 100755 index 0000000000..dab914a61c --- /dev/null +++ b/source3/script/tests/test_smbclient_auth.sh @@ -0,0 +1,38 @@ +#!/bin/sh + +# this runs the file serving tests that are expected to pass with samba3 against shares with various options + +if [ $# -lt 5 ]; then +cat <<EOF +Usage: test_smbclient_s3.sh SERVER SERVER_IP USERNAME PASSWORD USERID LOCAL_PATH +EOF +exit 1; +fi + +SERVER="$1" +SERVER_IP="$2" +USERNAME="$3" +PASSWORD="$4" +USERID="$5" +SMBCLIENT="$VALGRIND ${SMBCLIENT:-$BINDIR/smbclient} $CONFIGURATION" +WBINFO="$VALGRIND ${WBINFO:-$BINDIR/wbinfo}" +shift 5 +ADDARGS="$*" + +test x"$TEST_FUNCTIONS_SH" != x"INCLUDED" && { +incdir=`dirname $0`/../../../testprogs/blackbox +. $incdir/subunit.sh +} + +failed=0 + +testit "smbclient //$SERVER/guestonly" $SMBCLIENT //$SERVER/guestonly $CONFIGURATION -U$USERNAME%$PASSWORD -I $SERVER_IP -N -p 139 -c quit|| failed=`expr $failed + 1` +testit "smbclient //$SERVER/guestonly as anon" $SMBCLIENT //$SERVER/guestonly $CONFIGURATION -U% -I $SERVER_IP -N -p 139 -c quit|| failed=`expr $failed + 1` +testit "smbclient //$SERVER/tmpguest" $SMBCLIENT //$SERVER/tmpguest $CONFIGURATION -U$USERNAME%$PASSWORD -I $SERVER_IP -N -p 139 -c quit|| failed=`expr $failed + 1` +testit "smbclient //$SERVER/tmpguest as anon" $SMBCLIENT //$SERVER/tmpguest $CONFIGURATION -U% -I $SERVER_IP -N -p 139 -c quit|| failed=`expr $failed + 1` +testit "smbclient //$SERVER/forceuser" $SMBCLIENT //$SERVER/forceuser $CONFIGURATION -U$USERNAME%$PASSWORD -I $SERVER_IP -N -p 139 -c quit|| failed=`expr $failed + 1` +testit "smbclient //$SERVER/forceuser as anon" $SMBCLIENT //$SERVER/forceuser $CONFIGURATION -U% -I $SERVER_IP -N -p 139 -c quit|| failed=`expr $failed + 1` +testit "smbclient //$SERVER/forcegroup" $SMBCLIENT //$SERVER/forcegroup $CONFIGURATION -U$USERNAME%$PASSWORD -I $SERVER_IP -N -p 139 -c quit|| failed=`expr $failed + 1` +testit "smbclient //$SERVER/forcegroup as anon" $SMBCLIENT //$SERVER/forcegroup $CONFIGURATION -U% -I $SERVER_IP -N -p 139 -c quit|| failed=`expr $failed + 1` + +testok $0 $failed diff --git a/source3/script/tests/test_smbclient_s3.sh b/source3/script/tests/test_smbclient_s3.sh index a7c07753ad..075c6c548d 100755 --- a/source3/script/tests/test_smbclient_s3.sh +++ b/source3/script/tests/test_smbclient_s3.sh @@ -402,7 +402,7 @@ LOGDIR=$(mktemp -d --tmpdir=$PREFIX ${LOGDIR_PREFIX}_XXXX) testit "smbclient -L $SERVER_IP" $SMBCLIENT $CONFIGURATION -L $SERVER_IP -N -p 139 || failed=`expr $failed + 1` -testit "smbclient -L $SERVER -I $SERVER_IP" $SMBCLIENT $CONFIGURATION -L $SERVER -I $SERVER_IP -N -p 139 || failed=`expr $failed + 1` +testit "smbclient -L $SERVER -I $SERVER_IP" $SMBCLIENT $CONFIGURATION -L $SERVER -I $SERVER_IP -N -p 139 -c quit || failed=`expr $failed + 1` testit "noninteractive smbclient does not prompt" \ test_noninteractive_no_prompt || \ diff --git a/source3/selftest/tests.sh b/source3/selftest/tests.sh index 092e75864f..14d5805e32 100755 --- a/source3/selftest/tests.sh +++ b/source3/selftest/tests.sh @@ -137,6 +137,10 @@ plantest "blackbox.failure" dc:local LOCAL_PATH="$LOCAL_PATH" BINDIR="$BINDIR" S ) # plain +plantest "blackbox.smbclient_auth.plain" dc BINDIR="$BINDIR" script/tests/test_smbclient_auth.sh \$SERVER \$SERVER_IP \$USERNAME \$PASSWORD \$USERID +plantest "blackbox.smbclient_auth.plain sec share" secshare BINDIR="$BINDIR" script/tests/test_smbclient_auth.sh \$SERVER \$SERVER_IP \$SERVER\\\\\$USERNAME \$PASSWORD \$USERID +plantest "blackbox.smbclient_auth.plain member creds" member BINDIR="$BINDIR" script/tests/test_smbclient_auth.sh \$SERVER \$SERVER_IP \$SERVER\\\\\$USERNAME \$PASSWORD \$USERID + plantest "blackbox.smbclient_s3.plain" dc BINDIR="$BINDIR" script/tests/test_smbclient_s3.sh \$SERVER \$SERVER_IP \$USERNAME \$PASSWORD \$USERID \$LOCAL_PATH plantest "blackbox.smbclient_s3.plain member creds" member BINDIR="$BINDIR" script/tests/test_smbclient_s3.sh \$SERVER \$SERVER_IP \$SERVER\\\\\$USERNAME \$PASSWORD \$USERID \$LOCAL_PATH #plantest "blackbox.smbclient_s3.plain domain creds" member BINDIR="$BINDIR" script/tests/test_smbclient_s3.sh \$SERVER \$SERVER_IP \$DOMAIN\\\\\$DC_USERNAME \$DC_PASSWORD \$USERID \$LOCAL_PATH |