diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2008-04-16 00:05:36 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2008-04-16 00:05:36 +0200 |
commit | f5c0be9208b7b59b1452caedd47204030c43a02d (patch) | |
tree | 65770a30ecb87a9b1260b49e1616624ddfd15da4 | |
parent | edc9b35f1e50f73684dcb5c971ad38453239e5a2 (diff) | |
parent | 3413cfefb836c6a24fa740c13817a65fe264f2da (diff) | |
download | samba-f5c0be9208b7b59b1452caedd47204030c43a02d.tar.gz samba-f5c0be9208b7b59b1452caedd47204030c43a02d.tar.bz2 samba-f5c0be9208b7b59b1452caedd47204030c43a02d.zip |
Merge branch 'wbinfo-test' of git://git.samba.org/kai/samba/kai-work-in-progress into v4-0-selftest
(This used to be commit 56340a5fa1b075001bba829686861a59406e1f5d)
-rwxr-xr-x | source4/selftest/samba4_tests.sh | 3 | ||||
-rwxr-xr-x | testprogs/blackbox/test_wbinfo.sh | 199 |
2 files changed, 201 insertions, 1 deletions
diff --git a/source4/selftest/samba4_tests.sh b/source4/selftest/samba4_tests.sh index 3a3e1f91b1..a021fff892 100755 --- a/source4/selftest/samba4_tests.sh +++ b/source4/selftest/samba4_tests.sh @@ -274,6 +274,8 @@ plantest "blackbox.nmblookup" member $samba4srcdir/utils/tests/test_nmblookup.sh plantest "blackbox.locktest" dc $bbdir/test_locktest.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" "$PREFIX" plantest "blackbox.masktest" dc $bbdir/test_masktest.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" "$PREFIX" plantest "blackbox.gentest" dc $bbdir/test_gentest.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" "$PREFIX" +plantest "blackbox.wbinfo" dc $bbdir/test_wbinfo.sh "\$DOMAIN" "\$USERNAME" "\$PASSWORD" "dc" +plantest "blackbox.wbinfo" member $bbdir/test_wbinfo.sh "\$DOMAIN" "\$DC_USERNAME" "\$DC_PASSWORD" "member" # Tests using the "Simple" NTVFS backend @@ -292,7 +294,6 @@ plantest "rpc.echo against member server with domain creds" member $VALGRIND $sm plantest "rpc.samr against member server with local creds" member $VALGRIND $smb4torture ncacn_np:"\$NETBIOSNAME" -U"\$NETBIOSNAME/\$USERNAME"%"\$PASSWORD" "RPC-SAMR" "$*" plantest "rpc.samr.users against member server with local creds" member $VALGRIND $smb4torture ncacn_np:"\$NETBIOSNAME" -U"\$NETBIOSNAME/\$USERNAME"%"\$PASSWORD" "RPC-SAMR-USERS" "$*" plantest "rpc.samr.passwords against member server with local creds" member $VALGRIND $smb4torture ncacn_np:"\$NETBIOSNAME" -U"\$NETBIOSNAME/\$USERNAME"%"\$PASSWORD" "RPC-SAMR-PASSWORDS" "$*" -plantest "wbinfo -a against member server with domain creds" member $VALGRIND $samba4bindir/wbinfo -a "\$DOMAIN/\$DC_USERNAME"%"\$DC_PASSWORD" NBT_TESTS=`$smb4torture --list | grep "^NBT-" | xargs` diff --git a/testprogs/blackbox/test_wbinfo.sh b/testprogs/blackbox/test_wbinfo.sh new file mode 100755 index 0000000000..2ca4f23a2a --- /dev/null +++ b/testprogs/blackbox/test_wbinfo.sh @@ -0,0 +1,199 @@ +#!/bin/sh +# Blackbox test for wbinfo +if [ $# -lt 4 ]; then +cat <<EOF +Usage: test_wbinfo.sh DOMAIN USERNAME PASSWORD TARGET +EOF +exit 1; +fi + +DOMAIN=$1 +USERNAME=$2 +PASSWORD=$3 +TARGET=$4 +shift 4 + +failed=0 +samba4bindir=`dirname $0`/../../source/bin +wbinfo=$samba4bindir/wbinfo + +testit() { + name="$1" + shift + cmdline="$*" + echo "test: $name" + $cmdline + status=$? + if [ x$status = x0 ]; then + echo "success: $name" + else + echo "failure: $name" + fi + return $status +} + +testfail() { + name="$1" + shift + cmdline="$*" + echo "test: $name" + $cmdline + status=$? + if [ x$status = x0 ]; then + echo "failure: $name" + else + echo "success: $name" + fi + return $status +} + +knownfail() { + name="$1" + shift + cmdline="$*" + echo "test: $name" + $cmdline + status=$? + if [ x$status = x0 ]; then + echo "failure: $name [unexpected success]" + else + echo "knownfail: $name" + fi + return $status +} + + +testit "wbinfo -u against $TARGET" $wbinfo -u || failed=`expr $failed + 1` +# Does not work yet +knownfail "wbinfo -g against $TARGET" $wbinfo -g || failed=`expr $failed + 1` +knownfail "wbinfo -N against $TARGET" $wbinfo -N || failed=`expr $failed + 1` +knownfail "wbinfo -I against $TARGET" $wbinfo -I || failed=`expr $failed + 1` +testit "wbinfo -n against $TARGET" $wbinfo -n "$DOMAIN/$USERNAME" || failed=`expr $failed + 1` +admin_sid=`$wbinfo -n "$DOMAIN/$USERNAME" | cut -d " " -f1` +echo "$DOMAIN/$USERNAME resolved to $admin_sid" + +testit "wbinfo -s $admin_sid against $TARGET" $wbinfo -s $admin_sid || failed=`expr $failed + 1` +admin_name=`wbinfo -s $admin_sid | cut -d " " -f1| tr a-z A-Z` +echo "$admin_sid resolved to $admin_name" + +tested_name=`echo $DOMAIN/$USERNAME | tr a-z A-Z` + +echo "test: wbinfo -s check for sane mapping" +if test x$admin_name != x$tested_name; then + echo "$admin_name does not match $tested_name" + echo "failure: wbinfo -s check for sane mapping" + failed=`expr $failed + 1` +else + echo "success: wbinfo -s check for sane mapping" +fi + +testit "wbinfo -n on the returned name against $TARGET" $wbinfo -n $admin_name || failed=`expr $failed + 1` +test_sid=`$wbinfo -n $tested_name | cut -d " " -f1` + +echo "test: wbinfo -n check for sane mapping" +if test x$admin_sid != x$test_sid; then + echo "$admin_sid does not match $test_sid" + echo "failure: wbinfo -n check for sane mapping" + failed=`expr $failed + 1` +else + echo "success: wbinfo -n check for sane mapping" +fi + +testit "wbinfo -U against $TARGET" $wbinfo -U 30000 || failed=`expr $failed + 1` + +echo "test: wbinfo -U check for sane mapping" +sid_for_30000=`$wbinfo -U 30000` +if test x$sid_for_30000 != "xS-1-22-1-30000"; then + echo "uid 30000 mapped to $sid_for_30000, not S-1-22-1-30000" + echo "failure: wbinfo -U check for sane mapping" + failed=`expr $failed + 1` +else + echo "success: wbinfo -U check for sane mapping" +fi + +admin_uid=`wbinfo -U $admin_sid` + +testit "wbinfo -G against $TARGET" $wbinfo -G 30000 || failed=`expr $failed + 1` + +echo "test: wbinfo -G check for sane mapping" +sid_for_30000=`$wbinfo -G 30000` +if test x$sid_for_30000 != "xS-1-22-2-30000"; then + echo "gid 30000 mapped to $sid_for_30000, not S-1-22-2-30000" + echo "failure: wbinfo -G check for sane mapping" + failed=`expr $failed + 1` +else + echo "success: wbinfo -G check for sane mapping" +fi + +testit "wbinfo -S against $TARGET" $wbinfo -S "S-1-22-1-30000" || failed=`expr $failed + 1` + +echo "test: wbinfo -S check for sane mapping" +uid_for_sid=`$wbinfo -S S-1-22-1-30000` +if test 0$uid_for_sid -ne 30000; then + echo "S-1-22-1-30000 mapped to $uid_for_sid, not 30000" + echo "failure: wbinfo -S check for sane mapping" + failed=`expr $failed + 1` +else + echo "success: wbinfo -S check for sane mapping" +fi + +testfail "wbinfo -S against $TARGET using invalid SID" $wbinfo -S "S-1-22-2-30000" && failed=`expr $failed + 1` + +testit "wbinfo -Y against $TARGET" $wbinfo -Y "S-1-22-2-30000" || failed=`expr $failed + 1` + +echo "test: wbinfo -Y check for sane mapping" +gid_for_sid=`$wbinfo -Y S-1-22-2-30000` +if test 0$gid_for_sid -ne 30000; then + echo "S-1-22-2-30000 mapped to $gid_for_sid, not 30000" + echo "failure: wbinfo -Y check for sane mapping" + failed=`expr $failed + 1` +else + echo "success: wbinfo -Y check for sane mapping" +fi + +testfail "wbinfo -Y against $TARGET using invalid SID" $wbinfo -Y "S-1-22-1-30000" && failed=`expr $failed + 1` + +testit "wbinfo -t against $TARGET" $wbinfo -t || failed=`expr $failed + 1` + +# this does not work +knownfail "wbinfo -m against $TARGET" $wbinfo -m || failed=`expr $failed + 1` +knownfail "wbinfo --all-domains against $TARGET" $wbinfo --all-domains || failed=`expr $failed + 1` +testit "wbinfo --own-domain against $TARGET" $wbinfo --own-domain || failed=`expr $failed + 1` + +echo "test: wbinfo --own-domain against $TARGET check output" +own_domain=`wbinfo --own-domain` +if test x$own_domain = x$DOMAIN; then + echo "success: wbinfo --own-domain against $TARGET check output" +else + echo "Own domain reported as $own_domain instead of $DOMAIN" + echo "failure: wbinfo --own-domain against $TARGET check output" +fi + +# this does not work +knownfail "wbinfo --sequence against $TARGET" $wbinfo --sequence +knownfail "wbinfo -D against $TARGET" $wbinfo -D $DOMAIN || failed=`expr $failed + 1` + +testit "wbinfo -i against $TARGET" $wbinfo -i "$DOMAIN/$USERNAME" || failed=`expr $failed + 1` + +# this does not work +knownfail "wbinfo --uid-info against $TARGET" $wbinfo --uid-info $admin_sid +knownfail "wbinfo --group-info against $TARGET" $wbinfo --group-info "S-1-22-2-0" +knownfail "wbinfo -r against $TARGET" $wbinfo "$DOMAIN/$USERNAME" + +testit "wbinfo --user-domgroups against $TARGET" $wbinfo --user-domgroups $admin_sid || failed=`expr $failed + 1` + +testit "wbinfo --user-sids against $TARGET" $wbinfo --user-sids $admin_sid || failed=`expr $failed + 1` + +testit "wbinfo -a against $TARGET with domain creds" $wbinfo -a "$DOMAIN/$USERNAME"%"$PASSWORD" || failed=`expr $failed + 1` + +# this does not work +knwonfail "wbinfo --getdcname against $TARGET" $wbinfo --getdcname=$DOMAIN + +testit "wbinfo -p against $TARGET" $wbinfo -p || failed=`expr $failed + 1` + +testit "wbinfo -K against $TARGET with domain creds" $wbinfo -K "$DOMAIN/$USERNAME"%"$PASSWORD" || failed=`expr $failed + 1` + +testit "wbinfo --separator against $TARGET" $wbinfo --separator || failed=`expr $failed + 1` + +exit $failed + |