py_net: make use of pytalloc_GenericObject_steal()
[Samba.git] / nsswitch / tests / test_idmap_nss.sh
blob999bccb68ef00773f1af4a3de8c8f4fb87eaa238
1 #!/bin/sh
2 # Test id mapping with unknown SID and non-allocating idmap backend
3 if [ $# -lt 1 ]; then
4 echo Usage: $0 DOMAIN
5 exit 1
6 fi
8 DOMAIN="$1"
10 wbinfo="$VALGRIND $BINDIR/wbinfo"
12 failed=0
14 . `dirname $0`/../../testprogs/blackbox/subunit.sh
16 testit "wbinfo returns domain SID" $wbinfo -n "@$DOMAIN" || exit 1
17 DOMAIN_SID=$($wbinfo -n "@$DOMAIN" | cut -f 1 -d " ")
18 echo "Domain $DOMAIN has SID $DOMAIN_SID"
20 # Find an unused uid and SID
21 RID=66666
22 while true ; do
23 id $RID
24 if [ $? -ne 0 ] ; then
25 $wbinfo -s $DOMAIN_SID\\$RID
26 if [ $? -ne 0 ] ; then
27 break
30 RID=$(expr $RID + 1)
31 done
33 echo "Using non-existing SID $DOMAIN_SID-$RID to check no id allocation is done by the backend"
35 out="$($wbinfo --sids-to-unix-ids=$DOMAIN_SID-$RID)"
36 echo "wbinfo returned: $out"
37 test "$out" = "$DOMAIN_SID-$RID -> unmapped"
38 ret=$?
39 testit "wbinfo SID to xid returns unmapped for unknown SID" test $ret -eq 0 || failed=$(expr $failed + 1)
41 exit $failed