summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rwxr-xr-xsource3/script/tests/test_wbinfo_sids2xids.sh11
-rwxr-xr-xsource3/script/tests/test_wbinfo_sids2xids_int.py47
-rwxr-xr-xsource3/selftest/tests.py4
3 files changed, 62 insertions, 0 deletions
diff --git a/source3/script/tests/test_wbinfo_sids2xids.sh b/source3/script/tests/test_wbinfo_sids2xids.sh
new file mode 100755
index 0000000000..5bb33ee065
--- /dev/null
+++ b/source3/script/tests/test_wbinfo_sids2xids.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+WBINFO="$VALGRIND ${NET:-$BINDIR/wbinfo} $CONFIGURATION"
+TEST_INT=`dirname $0`/test_wbinfo_sids2xids_int.py
+
+incdir=`dirname $0`/../../../testprogs/blackbox
+. $incdir/subunit.sh
+
+testit "sids2xids" ${TEST_INT} ${WBINFO} || failed=`expr $failed + 1`
+
+testok $0 $failed
diff --git a/source3/script/tests/test_wbinfo_sids2xids_int.py b/source3/script/tests/test_wbinfo_sids2xids_int.py
new file mode 100755
index 0000000000..064a300026
--- /dev/null
+++ b/source3/script/tests/test_wbinfo_sids2xids_int.py
@@ -0,0 +1,47 @@
+#!/usr/bin/python
+
+import sys,os,subprocess
+
+if len(sys.argv) != 2:
+ print "Usage: test_wbinfo_sids2xids_int.py wbinfo"
+ sys.exit(1)
+
+wbinfo = sys.argv[1]
+domain = subprocess.Popen([wbinfo, "--own-domain"],
+ stdout=subprocess.PIPE).communicate()[0].strip()
+domsid = subprocess.Popen([wbinfo, "-n", domain + "\\"],
+ stdout=subprocess.PIPE).communicate()[0]
+domsid = domsid.split(' ')[0]
+
+#print domain
+#print domsid
+
+sids=[ domsid + '-512', 'S-1-5-32-545', domsid + '-513' ]
+
+sids2xids = subprocess.Popen([wbinfo, '--sids-to-unix-ids=' + ','.join(sids)],
+ stdout=subprocess.PIPE).communicate()[0].strip()
+
+gids=[]
+
+for line in sids2xids.split('\n'):
+ result = line.split(' ')[2:]
+
+ if result[0] == 'gid':
+ gid = result[1]
+ else:
+ gid = ''
+ if gid == '-1':
+ gid = ''
+ gids.append(gid)
+
+i=0
+
+for sid in sids:
+ gid = subprocess.Popen([wbinfo, '--sid-to-gid', sid],
+ stdout=subprocess.PIPE).communicate()[0].strip()
+ if gid != gids[i]:
+ print "Expected %s, got %s\n", gid, gids[i]
+ sys.exit(1)
+ i+=1
+
+sys.exit(0)
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index 0a1df9ad10..a21e151ec7 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -92,6 +92,10 @@ for t in tests:
plantestsuite("samba3.wbinfo_s3.(dc:local).%s" % t, "dc:local", [os.path.join(samba3srcdir, "script/tests/test_wbinfo_s3.sh"), t])
plantestsuite("samba3.wbinfo_s3.(member:local).%s" % t, "member:local", [os.path.join(samba3srcdir, "script/tests/test_wbinfo_s3.sh"), t])
+plantestsuite(
+ "samba3.wbinfo_sids2xids.(member:local)", "member:local",
+ [os.path.join(samba3srcdir, "script/tests/test_wbinfo_sids2xids.sh")])
+
plantestsuite("samba3.ntlm_auth.(dc:local)", "dc:local", [os.path.join(samba3srcdir, "script/tests/test_ntlm_auth_s3.sh"), valgrindify(python), samba3srcdir, configuration])
for env in ["dc", "member"]: