selftest: Test sids-to-xids with one failing sid
authorVolker Lendecke <vl@samba.org>
Fri, 21 Dec 2018 10:49:33 +0000 (11:49 +0100)
committerVolker Lendecke <vl@samba.org>
Tue, 8 Jan 2019 08:32:10 +0000 (09:32 +0100)
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Volker Lendecke <vl@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
nsswitch/tests/test_wbinfo_sids_to_xids.sh [new file with mode: 0755]
selftest/knownfail.d/samba3.wbinfo_sids_to_xids [new file with mode: 0644]
source3/selftest/tests.py

diff --git a/nsswitch/tests/test_wbinfo_sids_to_xids.sh b/nsswitch/tests/test_wbinfo_sids_to_xids.sh
new file mode 100755 (executable)
index 0000000..a3ab404
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+incdir=`dirname $0`/../../testprogs/blackbox
+. $incdir/subunit.sh
+
+#
+# S-1-5-123456789 fails, but S-1-5-11 succeeds. Check that S-1-5-11 is
+# mapped successfully with a GID in the 1000x range
+#
+wbinfo_some_mapped()
+{
+       output=`$VALGRIND $BINDIR/wbinfo --sids-to-unix-ids=S-1-5-123456789,S-1-5-11`
+       test x"$?" = x"0" || {
+               return 1
+       }
+
+       printf '%s' "$output" | grep -q 'S-1-5-123456789 -> unmapped' || {
+               printf '%s' "$output"
+               return 1
+       }
+
+       printf '%s' "$output" | grep -q 'S-1-5-11 -> gid 10000' || {
+               printf '%s' "$output"
+               return 1
+       }
+
+       return 0
+}
+
+testit "wbinfo some mapped" wbinfo_some_mapped || failed=`expr $failed + 1`
+
+testok $0 $failed
diff --git a/selftest/knownfail.d/samba3.wbinfo_sids_to_xids b/selftest/knownfail.d/samba3.wbinfo_sids_to_xids
new file mode 100644 (file)
index 0000000..26c61e3
--- /dev/null
@@ -0,0 +1 @@
+^samba3.wbinfo_sids_to_xids.wbinfo.some.mapped
index a3bb1c4feac8af8815ea851d7bd3b729c1e9c952..c0fde3ad3f0db21b71142a4590f7376bab2a586c 100755 (executable)
@@ -262,6 +262,11 @@ plantestsuite("samba3.wbinfo_user_info", env,
                             "nsswitch/tests/test_wbinfo_user_info.sh"),
                '$TRUST_DOMAIN', '$TRUST_REALM', '$DOMAIN', 'alice', 'alice', 'jane', 'jane.doe', env])
 
+env = "nt4_member:local"
+plantestsuite("samba3.wbinfo_sids_to_xids", env,
+              [os.path.join(srcdir(),
+                            "nsswitch/tests/test_wbinfo_sids_to_xids.sh")])
+
 env = "ad_member"
 t = "WBCLIENT-MULTI-PING"
 plantestsuite("samba3.smbtorture_s3.%s" % t, env, [os.path.join(samba3srcdir, "script/tests/test_smbtorture_s3.sh"), t, '//foo/bar', '""', '""', smbtorture3, ""])