libads: Make ads_cldap_netlogon() static
[samba4-gss.git] / nsswitch / tests / test_wbinfo_user_info_cached.sh
bloba7ed4718ed60309288355761e1e89eae03cd7ee8
1 #!/bin/sh
2 # Blackbox test for wbinfo primary groups and samlogon caching
3 # Copyright (c) 2020 Andreas Schneider <asn@samba.org>
5 if [ $# -lt 5 ]; then
6 cat <<EOF
7 Usage: $(basename $0) DOMAIN REALM USERNAME PASSWORD PRIMARY_GROUP
8 EOF
9 exit 1
12 DOMAIN=$1
13 REALM=$2
14 USERNAME=$3
15 PASSWORD=$4
16 PRIMARY_GROUP=$5
17 shift 5
19 DEFAULT_GROUP="Domain Users"
21 failed=0
23 samba_bindir="$BINDIR"
24 wbinfo_tool="$VALGRIND $samba_bindir/wbinfo"
25 net_tool="$VALGRIND $samba_bindir/net --configfile=$SERVERCONFFILE"
27 . $(dirname $0)/../../testprogs/blackbox/subunit.sh
29 KRB5CCNAME_PATH="$PREFIX/test_wbinfo_user_info_cached_krb5ccache"
30 rm -f $KRB5CCNAME_PATH
32 KRB5CCNAME="FILE:$KRB5CCNAME_PATH"
33 export KRB5CCNAME
35 USER="$DOMAIN/$USERNAME"
36 USER_SID=$($wbinfo_tool --name-to-sid="$USER" | sed -e 's/ .*//')
38 testit_grep "user_info.no_cache" "$DEFAULT_GROUP" $wbinfo_tool --user-info=$USER || failed=$(expr $failed + 1)
40 # Fill the samlogon cache
41 testit "kerberos_login" $wbinfo_tool --krb5ccname=$KRB5CCNAME --krb5auth=$USER%$PASSWORD || failed=$(expr $failed + 1)
43 testit_grep "user_info.samlogon_cache" "$PRIMARY_GROUP" $wbinfo_tool --user-info=$USER || failed=$(expr $failed + 1)
45 # Cleanup
46 $net_tool cache samlogon delete $USER_SID
48 rm -f $KRB5CCNAME_PATH
50 exit $failed