diff options
Diffstat (limited to 'testprogs/blackbox')
-rw-r--r-- | testprogs/blackbox/ndrdump/samr-CreateUser-in.dat | bin | 0 -> 60 bytes | |||
-rw-r--r-- | testprogs/blackbox/ndrdump/samr-CreateUser-out.dat | bin | 0 -> 32 bytes | |||
-rwxr-xr-x | testprogs/blackbox/subunit.sh | 67 | ||||
-rwxr-xr-x | testprogs/blackbox/test_gentest.sh | 34 | ||||
-rwxr-xr-x | testprogs/blackbox/test_kinit.sh | 89 | ||||
-rwxr-xr-x | testprogs/blackbox/test_ldb.sh | 121 | ||||
-rwxr-xr-x | testprogs/blackbox/test_locktest.sh | 28 | ||||
-rwxr-xr-x | testprogs/blackbox/test_masktest.sh | 28 | ||||
-rwxr-xr-x | testprogs/blackbox/test_ndrdump.sh | 20 | ||||
-rwxr-xr-x | testprogs/blackbox/test_wintest.sh | 45 | ||||
-rw-r--r-- | testprogs/blackbox/wintest/wintest.conf | 7 |
11 files changed, 439 insertions, 0 deletions
diff --git a/testprogs/blackbox/ndrdump/samr-CreateUser-in.dat b/testprogs/blackbox/ndrdump/samr-CreateUser-in.dat Binary files differnew file mode 100644 index 0000000000..a5840e1f7f --- /dev/null +++ b/testprogs/blackbox/ndrdump/samr-CreateUser-in.dat diff --git a/testprogs/blackbox/ndrdump/samr-CreateUser-out.dat b/testprogs/blackbox/ndrdump/samr-CreateUser-out.dat Binary files differnew file mode 100644 index 0000000000..cf9131dba9 --- /dev/null +++ b/testprogs/blackbox/ndrdump/samr-CreateUser-out.dat diff --git a/testprogs/blackbox/subunit.sh b/testprogs/blackbox/subunit.sh new file mode 100755 index 0000000000..100dfd1a46 --- /dev/null +++ b/testprogs/blackbox/subunit.sh @@ -0,0 +1,67 @@ +# +# subunit.sh: shell functions to report test status via the subunit protocol. +# Copyright (C) 2006 Robert Collins <robertc@robertcollins.net> +# Copyright (C) 2008 Jelmer Vernooij <jelmer@samba.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +subunit_start_test () { + # emit the current protocol start-marker for test $1 + echo "test: $1" +} + + +subunit_pass_test () { + # emit the current protocol test passed marker for test $1 + echo "success: $1" +} + + +subunit_fail_test () { + # emit the current protocol fail-marker for test $1, and emit stdin as + # the error text. + # we use stdin because the failure message can be arbitrarily long, and this + # makes it convenient to write in scripts (using <<END syntax. + echo "failure: $1 [" + cat - + echo "]" +} + + +subunit_error_test () { + # emit the current protocol error-marker for test $1, and emit stdin as + # the error text. + # we use stdin because the failure message can be arbitrarily long, and this + # makes it convenient to write in scripts (using <<END syntax. + echo "error: $1 [" + cat - + echo "]" +} + +testit () { + name="$1" + shift + cmdline="$*" + subunit_start_test "$name" + output=`$cmdline 2>&1` + status=$? + if [ x$status = x0 ]; then + subunit_pass_test "$name" + else + echo $output | subunit_fail_test "$name" + fi + return $status +} diff --git a/testprogs/blackbox/test_gentest.sh b/testprogs/blackbox/test_gentest.sh new file mode 100755 index 0000000000..ec6f0e422b --- /dev/null +++ b/testprogs/blackbox/test_gentest.sh @@ -0,0 +1,34 @@ +#!/bin/sh +# Blackbox tests for gentest +# Copyright (C) 2008 Andrew Tridgell +# based on test_smbclient.sh + +if [ $# -lt 4 ]; then +cat <<EOF +Usage: test_gentest.sh SERVER USERNAME PASSWORD DOMAIN +EOF +exit 1; +fi + +SERVER=$1 +USERNAME=$2 +PASSWORD=$3 +DOMAIN=$4 +shift 4 +failed=0 + +samba4bindir=`dirname $0`/../../source/bin +gentest=$samba4bindir/gentest + +. `dirname $0`/subunit.sh + +cat <<EOF > st/gentest.ignore +all_info.out.fname +internal_information.out.file_id +EOF + +testit "gentest" $VALGRIND $gentest //$SERVER/test1 //$SERVER/test2 --num-ops=100 --ignore=st/gentest.ignore -W "$DOMAIN" -U"$USERNAME%$PASSWORD" -U"$USERNAME%$PASSWORD" $@ || failed=`expr $failed + 1` + +/bin/rm -f st/gentest.ignore + +exit $failed diff --git a/testprogs/blackbox/test_kinit.sh b/testprogs/blackbox/test_kinit.sh new file mode 100755 index 0000000000..d3cece0af7 --- /dev/null +++ b/testprogs/blackbox/test_kinit.sh @@ -0,0 +1,89 @@ +#!/bin/sh +# Blackbox tests for kinit and kerberos integration with smbclient etc +# Copyright (C) 2006-2007 Jelmer Vernooij <jelmer@samba.org> +# Copyright (C) 2006-2007 Andrew Bartlett <abartlet@samba.org> + +if [ $# -lt 5 ]; then +cat <<EOF +Usage: test_kinit.sh SERVER USERNAME PASSWORD REALM DOMAIN PREFIX +EOF +exit 1; +fi + +SERVER=$1 +USERNAME=$2 +PASSWORD=$3 +REALM=$4 +DOMAIN=$5 +PREFIX=$6 +shift 6 +failed=0 + +samba4bindir=`dirname $0`/../../source/bin +smbclient=$samba4bindir/smbclient +samba4kinit=$samba4bindir/samba4kinit +net=$samba4bindir/net +enableaccount="$PYTHON `dirname $0`/../../source/setup/enableaccount" + +. `dirname $0`/subunit.sh + +test_smbclient() { + name="$1" + cmd="$2" + shift + shift + echo "test: $name" + $VALGRIND $smbclient $CONFIGURATION //$SERVER/tmp -c "$cmd" -W "$DOMAIN" -U"$USERNAME%$PASSWORD" $@ + status=$? + if [ x$status = x0 ]; then + echo "success: $name" + else + echo "failure: $name" + fi + return $status +} + +KRB5CCNAME="$PREFIX/tmpccache" +export KRB5CCNAME + +echo $PASSWORD > ./tmppassfile +#testit "kinit with keytab" $samba4kinit --keytab=$PREFIX/dc/private/secrets.keytab $SERVER\$@$REALM || failed=`expr $failed + 1` +testit "kinit with password" $samba4kinit --password-file=./tmppassfile --request-pac $USERNAME@$REALM || failed=`expr $failed + 1` +testit "kinit with pkinit" $samba4kinit --request-pac --renewable --pk-user=FILE:$PREFIX/dc/private/tls/admincert.pem,$PREFIX/dc/private/tls/adminkey.pem $USERNAME@$REALM || failed=`expr $failed + 1` +testit "kinit renew ticket" $samba4kinit --request-pac -R + +test_smbclient "Test login with kerberos ccache" 'ls' -k yes || failed=`expr $failed + 1` + +testit "domain join with kerberos ccache" $VALGRIND $net join $DOMAIN $CONFIGURATION -W "$DOMAIN" -k yes $@ || failed=`expr $failed + 1` +testit "check time with kerberos ccache" $VALGRIND $net time $SERVER $CONFIGURATION -W "$DOMAIN" -k yes $@ || failed=`expr $failed + 1` + +testit "add user with kerberos ccache" $VALGRIND $net user add nettestuser $CONFIGURATION -k yes $@ || failed=`expr $failed + 1` +USERPASS=testPass@12% +echo $USERPASS > ./tmpuserpassfile + +testit "set user password with kerberos ccache" $VALGRIND $net password set $DOMAIN\\nettestuser $USERPASS $CONFIGURATION -k yes $@ || failed=`expr $failed + 1` + +testit "enable user with kerberos cache" $VALGRIND $enableaccount nettestuser -H ldap://$SERVER -k yes $@ || failed=`expr $failed + 1` + +KRB5CCNAME="$PREFIX/tmpuserccache" +export KRB5CCNAME + +testit "kinit with user password" $samba4bindir/samba4kinit --password-file=./tmpuserpassfile --request-pac nettestuser@$REALM || failed=`expr $failed + 1` + +test_smbclient "Test login with user kerberos ccache" 'ls' -k yes || failed=`expr $failed + 1` + +NEWUSERPASS=testPaSS@34% +testit "change user password" $VALGRIND $net password change -W$DOMAIN -U$DOMAIN\\nettestuser%$USERPASS $CONFIGURATION -k no $NEWUSERPASS $@ || failed=`expr $failed + 1` + +echo $NEWUSERPASS > ./tmpuserpassfile +testit "kinit with user password" $samba4bindir/samba4kinit --password-file=./tmpuserpassfile --request-pac nettestuser@$REALM || failed=`expr $failed + 1` + +test_smbclient "Test login with user kerberos ccache" 'ls' -k yes || failed=`expr $failed + 1` + +KRB5CCNAME="$PREFIX/tmpccache" +export KRB5CCNAME + +testit "del user with kerberos ccache" $VALGRIND $net user delete nettestuser $CONFIGURATION -k yes $@ || failed=`expr $failed + 1` + +rm -f tmpccfile tmppassfile tmpuserpassfile tmpuserccache +exit $failed diff --git a/testprogs/blackbox/test_ldb.sh b/testprogs/blackbox/test_ldb.sh new file mode 100755 index 0000000000..8e1af99719 --- /dev/null +++ b/testprogs/blackbox/test_ldb.sh @@ -0,0 +1,121 @@ +#!/bin/sh + +if [ $# -lt 2 ]; then +cat <<EOF +Usage: test_ldb.sh PROTOCOL SERVER [OPTIONS] +EOF +exit 1; +fi + + +p=$1 +SERVER=$2 +PREFIX=$3 +shift 2 +options="$*" + +. `dirname $0`/subunit.sh + +check() { + name="$1" + shift + cmdline="$*" + echo "test: $name" + $cmdline + status=$? + if [ x$status = x0 ]; then + echo "success: $name" + else + echo "failure: $name" + failed=`expr $failed + 1` + fi + return $status +} + +check "RootDSE" bin/ldbsearch $CONFIGURATION $options --basedn='' -H $p://$SERVER -s base DUMMY=x dnsHostName highestCommittedUSN || failed=`expr $failed + 1` + +echo "Getting defaultNamingContext" +BASEDN=`bin/ldbsearch $CONFIGURATION $options --basedn='' -H $p://$SERVER -s base DUMMY=x defaultNamingContext | grep defaultNamingContext | awk '{print $2}'` +echo "BASEDN is $BASEDN" + +check "Listing Users" bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER '(objectclass=user)' sAMAccountName || failed=`expr $failed + 1` + +check "Listing Users (sorted)" bin/ldbsearch -S $options $CONFIGURATION -H $p://$SERVER '(objectclass=user)' sAMAccountName || failed=`expr $failed + 1` + +check "Listing Groups" bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER '(objectclass=group)' sAMAccountName || failed=`expr $failed + 1` + +nentries=`bin/ldbsearch $options -H $p://$SERVER $CONFIGURATION '(|(|(&(!(groupType:1.2.840.113556.1.4.803:=1))(groupType:1.2.840.113556.1.4.803:=2147483648)(groupType:1.2.840.113556.1.4.804:=10))(samAccountType=805306368))(samAccountType=805306369))' sAMAccountName | grep sAMAccountName | wc -l` +echo "Found $nentries entries" +if [ $nentries -lt 10 ]; then +echo "Should have found at least 10 entries" +failed=`expr $failed + 1` +fi + +echo "Check rootDSE for Controls" +nentries=`bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER -s base -b "" '(objectclass=*)' | grep -i supportedControl | wc -l` +if [ $nentries -lt 4 ]; then +echo "Should have found at least 4 entries" +failed=`expr $failed + 1` +fi + +echo "Test Paged Results Control" +nentries=`bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER --controls=paged_results:1:5 '(objectclass=user)' | grep sAMAccountName | wc -l` +if [ $nentries -lt 1 ]; then +echo "Paged Results Control test returned 0 items" +failed=`expr $failed + 1` +fi + +echo "Test Server Sort Control" +nentries=`bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER --controls=server_sort:1:0:sAMAccountName '(objectclass=user)' | grep sAMAccountName | wc -l` +if [ $nentries -lt 1 ]; then +echo "Server Sort Control test returned 0 items" +failed=`expr $failed + 1` +fi + +echo "Test Extended DN Control" +nentries=`bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER --controls=extended_dn:1 '(objectclass=user)' | grep sAMAccountName | wc -l` +if [ $nentries -lt 1 ]; then +echo "Extended DN Control test returned 0 items" +failed=`expr $failed + 1` +fi +nentries=`bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER --controls=extended_dn:1:0 '(objectclass=user)' | grep sAMAccountName | wc -l` +if [ $nentries -lt 1 ]; then +echo "Extended DN Control test returned 0 items" +failed=`expr $failed + 1` +fi +nentries=`bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER --controls=extended_dn:1:1 '(objectclass=user)' | grep sAMAccountName | wc -l` +if [ $nentries -lt 1 ]; then +echo "Extended DN Control test returned 0 items" +failed=`expr $failed + 1` +fi + +echo "Test Domain scope Control" +nentries=`bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER --controls=domain_scope:1 '(objectclass=user)' | grep sAMAccountName | wc -l` +if [ $nentries -lt 1 ]; then +echo "Extended Domain scope Control test returned 0 items" +failed=`expr $failed + 1` +fi + +echo "Test Attribute Scope Query Control" +nentries=`bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER --controls=asq:1:member -s base -b "CN=Administrators,CN=Builtin,$BASEDN" | grep sAMAccountName | wc -l` +if [ $nentries -lt 1 ]; then +echo "Attribute Scope Query test returned 0 items" +failed=`expr $failed + 1` +fi + +echo "Test Search Options Control" +nentries=`bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER --controls=search_options:1:2 '(objectclass=crossRef)' | grep crossRef | wc -l` +if [ $nentries -lt 1 ]; then +echo "Search Options Control Query test returned 0 items" +failed=`expr $failed + 1` +fi + +echo "Test Search Options Control with Domain Scope Control" +nentries=`bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER --controls=search_options:1:2,domain_scope:1 '(objectclass=crossRef)' | grep crossRef | wc -l` +if [ $nentries -lt 1 ]; then +echo "Search Options Control Query test returned 0 items" +failed=`expr $failed + 1` +fi + + +exit $failed diff --git a/testprogs/blackbox/test_locktest.sh b/testprogs/blackbox/test_locktest.sh new file mode 100755 index 0000000000..88fa0ef892 --- /dev/null +++ b/testprogs/blackbox/test_locktest.sh @@ -0,0 +1,28 @@ +#!/bin/sh +# Blackbox tests for locktest +# Copyright (C) 2008 Andrew Tridgell +# based on test_smbclient.sh + +if [ $# -lt 5 ]; then +cat <<EOF +Usage: test_locktest.sh SERVER USERNAME PASSWORD DOMAIN PREFIX +EOF +exit 1; +fi + +SERVER=$1 +USERNAME=$2 +PASSWORD=$3 +DOMAIN=$4 +PREFIX=$5 +shift 5 +failed=0 + +samba4bindir=`dirname $0`/../../source/bin +locktest=$samba4bindir/locktest + +. `dirname $0`/subunit.sh + +testit "locktest" $VALGRIND $locktest //$SERVER/test1 //$SERVER/test2 --num-ops=100 -W "$DOMAIN" -U"$USERNAME%$PASSWORD" $@ || failed=`expr $failed + 1` + +exit $failed diff --git a/testprogs/blackbox/test_masktest.sh b/testprogs/blackbox/test_masktest.sh new file mode 100755 index 0000000000..c1f765c1dd --- /dev/null +++ b/testprogs/blackbox/test_masktest.sh @@ -0,0 +1,28 @@ +#!/bin/sh +# Blackbox tests for masktest +# Copyright (C) 2008 Andrew Tridgell +# based on test_smbclient.sh + +if [ $# -lt 5 ]; then +cat <<EOF +Usage: test_masktest.sh SERVER USERNAME PASSWORD DOMAIN PREFIX +EOF +exit 1; +fi + +SERVER=$1 +USERNAME=$2 +PASSWORD=$3 +DOMAIN=$4 +PREFIX=$5 +shift 5 +failed=0 + +samba4bindir=`dirname $0`/../../source/bin +masktest=$samba4bindir/masktest + +. `dirname $0`/subunit.sh + +testit "masktest" $VALGRIND $masktest //$SERVER/tmp --num-ops=200 --dieonerror -W "$DOMAIN" -U"$USERNAME%$PASSWORD" $@ || failed=`expr $failed + 1` + +exit $failed diff --git a/testprogs/blackbox/test_ndrdump.sh b/testprogs/blackbox/test_ndrdump.sh new file mode 100755 index 0000000000..089a7c3a2b --- /dev/null +++ b/testprogs/blackbox/test_ndrdump.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# Blackbox tests for masktest +# Copyright (C) 2008 Andrew Tridgell +# Copyright (C) 2008 Andrew Bartlett +# based on test_smbclient.sh + +. `dirname $0`/subunit.sh + +failed=0 + +samba4bindir=`dirname $0`/../../source/bin +ndrdump=$samba4bindir/ndrdump +files=`dirname $0`/ndrdump + +testit "ndrdump with in" $VALGRIND $ndrdump samr samr_CreateUser in $files/samr-CreateUser-in.dat $@ || failed=`expr $failed + 1` +testit "ndrdump with out" $VALGRIND $ndrdump samr samr_CreateUser out $files/samr-CreateUser-out.dat $@ || failed=`expr $failed + 1` +testit "ndrdump with --context-file" $VALGRIND $ndrdump --context-file $files/samr-CreateUser-in.dat samr samr_CreateUser out $files/samr-CreateUser-out.dat $@ || failed=`expr $failed + 1` +testit "ndrdump with validate" $VALGRIND $ndrdump --validate samr samr_CreateUser in $files/samr-CreateUser-in.dat $@ || failed=`expr $failed + 1` + +exit $failed diff --git a/testprogs/blackbox/test_wintest.sh b/testprogs/blackbox/test_wintest.sh new file mode 100755 index 0000000000..8bbe4f2984 --- /dev/null +++ b/testprogs/blackbox/test_wintest.sh @@ -0,0 +1,45 @@ +#!/bin/sh +# Blackbox tests for testing against windows machines +# Copyright (C) 2008 Jim McDonough + + +testwithconf() { +# define test variables, startup/shutdown scripts +. $1 +shift 1 + +if [ -n "$WINTEST_STARTUP" ]; then +. $WINTEST_STARTUP; +fi + +testit "smbtorture" $smbtorture //$SERVER/$SHARE RAW-OPEN -W "$DOMAIN" -U"$USERNAME%$PASSWORD" $@ || failed=`expr $failed + 1` + +if [ -n "$WINTEST_SHUTDOWN" ]; then +. $WINTEST_SHUTDOWN; +fi +} + + +# main +# skip without WINTEST_CONF_DIR +if [ -z "$WINTEST_CONF_DIR" ]; then +exit 0; +fi + +SOCKET_WRAPPER_DIR= +export -n SOCKET_WRAPPER_DIR + +failed=0 + +$basedir=`pwd` + +samba4bindir=`dirname $0`/../../source/bin +smbtorture=$samba4bindir/smbtorture + +. `dirname $0`/subunit.sh + +for wintest_conf in $WINTEST_CONF_DIR/*.conf; do +testwithconf "$wintest_conf" $@; +done + +exit $failed diff --git a/testprogs/blackbox/wintest/wintest.conf b/testprogs/blackbox/wintest/wintest.conf new file mode 100644 index 0000000000..d1403662f9 --- /dev/null +++ b/testprogs/blackbox/wintest/wintest.conf @@ -0,0 +1,7 @@ +#export WINTEST_STARTUP="/tmp/startup client" +#export WINTEST_SHUTDOWN=/tmp/shutdown client" +export DOMAIN="client" +export USERNAME="administrator" +export PASSWORD="samba" +export SERVER="192.168.213.161" +export SHARE="c\$"
\ No newline at end of file |