mirror of
https://github.com/samba-team/samba.git
synced 2025-02-23 09:57:40 +03:00
nsswitch:tests: Add test to check correct group lookup with samlogon cache
TEST FOR: https://bugzilla.samba.org/show_bug.cgi?id=14124 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Günther Deschner <gd@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Fri Jan 24 17:18:38 UTC 2020 on sn-devel-184
This commit is contained in:
parent
6a10ab3f10
commit
91b68ac0b6
50
nsswitch/tests/test_wbinfo_user_info_cached.sh
Executable file
50
nsswitch/tests/test_wbinfo_user_info_cached.sh
Executable file
@ -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 -s $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
|
@ -278,6 +278,16 @@ plantestsuite("samba3.wbinfo_name_lookup", env,
|
||||
"nsswitch/tests/test_wbinfo_name_lookup.sh"),
|
||||
'$DOMAIN', '$REALM', '$DC_USERNAME'])
|
||||
|
||||
env = "ad_member"
|
||||
plantestsuite("samba3.wbinfo_user_info_cached", env,
|
||||
[os.path.join(srcdir(),
|
||||
"nsswitch/tests/test_wbinfo_user_info_cached.sh"),
|
||||
'$DOMAIN', '$REALM', 'joe', 'Secret007', '"Samba Users"', env])
|
||||
plantestsuite("samba3.wbinfo_user_info_cached.trustdom", env,
|
||||
[os.path.join(srcdir(),
|
||||
"nsswitch/tests/test_wbinfo_user_info_cached.sh"),
|
||||
'$TRUST_F_BOTH_DOMAIN', '$TRUST_F_BOTH_REALM', 'joe', 'Secret007', '"Samba Users"', env])
|
||||
|
||||
env = "ad_member:local"
|
||||
plantestsuite("samba3.wbinfo_user_info", env,
|
||||
[os.path.join(srcdir(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user