gp: Test with binary content for certificate data
[Samba.git] / testprogs / blackbox / test_offline_logon.sh
blob84da8a40a018e2cdba0de499c922a78cdc3a1685
1 #!/bin/sh
2 # Blackbox tests for winbind offline logon support
3 # Copyright (c) 2021 Andreas Schneider <asn@samba.org>
5 if [ $# -lt 9 ]; then
6 cat <<EOF
7 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
8 EOF
9 exit 1
12 DOMAIN=$1
13 CACHED_USER_NAME_1=$2
14 CACHED_USER_PASS_1=$3
15 CACHED_USER_NAME_2=$4
16 CACHED_USER_PASS_2=$5
17 ONLINE_USER_NAME_1=$6
18 ONLINE_USER_PASS_1=$7
19 ONLINE_USER_NAME_2=$8
20 ONLINE_USER_PASS_2=$9
21 shift 9
23 . $(dirname $0)/subunit.sh
25 samba_bindir="$BINDIR"
26 wbinfo="$samba_bindir/wbinfo"
28 # Check that the DC is offline
29 testit_expect_failure "wbinfo.ping-dc" $VALGRIND $wbinfo --ping-dc || failed=$(expr $failed + 1)
31 # We should have cached credentials for alice and bob
32 # --pam-logon sets always the WBFLAG_PAM_CACHED_LOGIN flag
33 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)
34 testit "wbinfo.kerberos_logon_$CACHED_USER_NAME_1" $VALGRIND $wbinfo --krb5auth=$DOMAIN/$CACHED_USER_NAME_2%$CACHED_USER_PASS_2 || failed=$(expr $failed + 1)
36 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)
37 testit "wbinfo.kerberos_logon_$CACHED_USER_NAME_2" $VALGRIND $wbinfo --krb5auth=$DOMAIN/$CACHED_USER_NAME_2%$CACHED_USER_PASS_2 || failed=$(expr $failed + 1)
39 # We should not be able to auth with jane or joe
40 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)
41 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)
43 exit $failed