diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 17:47:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 17:47:29 +0000 |
commit | 4f5791ebd03eaec1c7da0865a383175b05102712 (patch) | |
tree | 8ce7b00f7a76baa386372422adebbe64510812d4 /nsswitch/tests/test_wbinfo_user_info_cached.sh | |
parent | Initial commit. (diff) | |
download | samba-upstream.tar.xz samba-upstream.zip |
Adding upstream version 2:4.17.12+dfsg.upstream/2%4.17.12+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'nsswitch/tests/test_wbinfo_user_info_cached.sh')
-rwxr-xr-x | nsswitch/tests/test_wbinfo_user_info_cached.sh | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/nsswitch/tests/test_wbinfo_user_info_cached.sh b/nsswitch/tests/test_wbinfo_user_info_cached.sh new file mode 100755 index 0000000..a7ed471 --- /dev/null +++ b/nsswitch/tests/test_wbinfo_user_info_cached.sh @@ -0,0 +1,50 @@ +#!/bin/sh +# Blackbox test for wbinfo primary groups and samlogon caching +# Copyright (c) 2020 Andreas Schneider <asn@samba.org> + +if [ $# -lt 5 ]; then + cat <<EOF +Usage: $(basename $0) DOMAIN REALM USERNAME PASSWORD PRIMARY_GROUP +EOF + exit 1 +fi + +DOMAIN=$1 +REALM=$2 +USERNAME=$3 +PASSWORD=$4 +PRIMARY_GROUP=$5 +shift 5 + +DEFAULT_GROUP="Domain Users" + +failed=0 + +samba_bindir="$BINDIR" +wbinfo_tool="$VALGRIND $samba_bindir/wbinfo" +net_tool="$VALGRIND $samba_bindir/net --configfile=$SERVERCONFFILE" + +. $(dirname $0)/../../testprogs/blackbox/subunit.sh + +KRB5CCNAME_PATH="$PREFIX/test_wbinfo_user_info_cached_krb5ccache" +rm -f $KRB5CCNAME_PATH + +KRB5CCNAME="FILE:$KRB5CCNAME_PATH" +export KRB5CCNAME + +USER="$DOMAIN/$USERNAME" +USER_SID=$($wbinfo_tool --name-to-sid="$USER" | sed -e 's/ .*//') + +testit_grep "user_info.no_cache" "$DEFAULT_GROUP" $wbinfo_tool --user-info=$USER || failed=$(expr $failed + 1) + +# Fill the samlogon cache +testit "kerberos_login" $wbinfo_tool --krb5ccname=$KRB5CCNAME --krb5auth=$USER%$PASSWORD || failed=$(expr $failed + 1) + +testit_grep "user_info.samlogon_cache" "$PRIMARY_GROUP" $wbinfo_tool --user-info=$USER || failed=$(expr $failed + 1) + +# Cleanup +$net_tool cache samlogon delete $USER_SID + +rm -f $KRB5CCNAME_PATH + +exit $failed |