1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

testprogs: Add test for offline logon support

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Andreas Schneider 2021-05-10 12:52:18 +02:00 committed by Jeremy Allison
parent 763e032354
commit 08434e413f
3 changed files with 57 additions and 0 deletions

View File

@ -0,0 +1,4 @@
samba.blackbox.offline_logon.wbinfo.pam_logon_alice\(ad_member_offline_logon\)
samba.blackbox.offline_logon.wbinfo.pam_logon_bob\(ad_member_offline_logon\)
samba.blackbox.offline_logon.wbinfo.kerberos_logon_alice\(ad_member_offline_logon\)
samba.blackbox.offline_logon.wbinfo.kerberos_logon_bob\(ad_member_offline_logon\)

View File

@ -1348,6 +1348,16 @@ planoldpythontestsuite("chgdcpass:local", "samba.tests.blackbox.samba_dnsupdate"
for env in ["ad_dc_ntvfs", "s4member", "rodc", "promoted_dc", "ad_dc", "ad_member"]: for env in ["ad_dc_ntvfs", "s4member", "rodc", "promoted_dc", "ad_dc", "ad_member"]:
plantestsuite("samba.blackbox.wbinfo(%s:local)" % env, "%s:local" % env, [os.path.join(samba4srcdir, "../nsswitch/tests/test_wbinfo.sh"), '$DOMAIN', '$DC_USERNAME', '$DC_PASSWORD', env]) plantestsuite("samba.blackbox.wbinfo(%s:local)" % env, "%s:local" % env, [os.path.join(samba4srcdir, "../nsswitch/tests/test_wbinfo.sh"), '$DOMAIN', '$DC_USERNAME', '$DC_PASSWORD', env])
# Offline logon (ad_member)
plantestsuite("samba.blackbox.offline_logon",
"ad_member_offline_logon",
[os.path.join(bbdir, "test_offline_logon.sh"),
'$DOMAIN',
'alice', 'Secret007',
'bob', 'Secret007',
'jane', 'Secret007',
'joe', 'Secret007'])
# #
# KDC Tests # KDC Tests
# #

View File

@ -0,0 +1,43 @@
#!/bin/sh
# Blackbox tests for winbind offline logon support
# Copyright (c) 2021 Andreas Schneider <asn@samba.org>
if [ $# -lt 9 ]; then
cat <<EOF
Usage: test_offline_logon.sh DOMAIN CACHED_USER_NAME_1 CACHED_USER_PASS_1 CACHED_USER_NAME_2 CACHED_USER_PASS_2 ONLINE_USER_NAME_1 ONLINE_USER_PASS_1 ONLINE_USER_NAME_2 ONLINE_USER_PASS_2
EOF
exit 1;
fi
DOMAIN=$1
CACHED_USER_NAME_1=$2
CACHED_USER_PASS_1=$3
CACHED_USER_NAME_2=$4
CACHED_USER_PASS_2=$5
ONLINE_USER_NAME_1=$6
ONLINE_USER_PASS_1=$7
ONLINE_USER_NAME_2=$8
ONLINE_USER_PASS_2=$9
shift 9
. `dirname $0`/subunit.sh
samba_bindir="$BINDIR"
wbinfo="$samba_bindir/wbinfo"
# Check that the DC is offline
testit_expect_failure "wbinfo.ping-dc" $VALGRIND $wbinfo --ping-dc || failed=`expr $failed + 1`
# We should have cached credentials for alice and bob
# --pam-logon sets always the WBFLAG_PAM_CACHED_LOGIN flag
testit "wbinfo.pam_logon_$CACHED_USER_NAME_1" $VALGRIND $wbinfo --pam-logon=$DOMAIN/$CACHED_USER_NAME_1%$CACHED_USER_PASS_1 || failed=`expr $failed + 1`
testit "wbinfo.kerberos_logon_$CACHED_USER_NAME_1" $VALGRIND $wbinfo --krb5auth=$DOMAIN/$CACHED_USER_NAME_2%$CACHED_USER_PASS_2 || failed=`expr $failed + 1`
testit "wbinfo.pam_logon_$CACHED_USER_NAME_2" $VALGRIND $wbinfo --pam-logon=$DOMAIN/$CACHED_USER_NAME_2%$CACHED_USER_PASS_2 || failed=`expr $failed + 1`
testit "wbinfo.kerberos_logon_$CACHED_USER_NAME_2" $VALGRIND $wbinfo --krb5auth=$DOMAIN/$CACHED_USER_NAME_2%$CACHED_USER_PASS_2 || failed=`expr $failed + 1`
# We should not be able to auth with jane or joe
testit_expect_failure "wbinfo.pam_logon_$ONLINE_USER_NAME_1" $VALGRIND $wbinfo --pam-logon=$DOMAIN/$ONLINE_USER_NAME_1%$ONLINE_USER_PASS_1 || failed=`expr $failed + 1`
testit_expect_failure "wbinfo.pam_logon_$ONLINE_USER_NAME_2" $VALGRIND $wbinfo --pam-logon=$DOMAIN/$ONLINE_USER_NAME_2%$ONLINE_USER_PASS_2 || failed=`expr $failed + 1`
exit $failed