source: trunk/server/source3/script/tests/test_wbinfo_sids2xids_int.py

Last change on this file was 745, checked in by Silvan Scherrer, 13 years ago

Samba Server: updated trunk to 3.6.0

File size: 1.2 KB
Line 
1#!/usr/bin/env python
2
3import sys,os,subprocess
4
5if len(sys.argv) != 2:
6 print "Usage: test_wbinfo_sids2xids_int.py wbinfo"
7 sys.exit(1)
8
9wbinfo = sys.argv[1]
10domain = subprocess.Popen([wbinfo, "--own-domain"],
11 stdout=subprocess.PIPE).communicate()[0].strip()
12domsid = subprocess.Popen([wbinfo, "-n", domain + "\\"],
13 stdout=subprocess.PIPE).communicate()[0]
14domsid = domsid.split(' ')[0]
15
16#print domain
17#print domsid
18
19sids=[ domsid + '-512', 'S-1-5-32-545', domsid + '-513' ]
20
21sids2xids = subprocess.Popen([wbinfo, '--sids-to-unix-ids=' + ','.join(sids)],
22 stdout=subprocess.PIPE).communicate()[0].strip()
23
24gids=[]
25
26for line in sids2xids.split('\n'):
27 result = line.split(' ')[2:]
28
29 if result[0] == 'gid':
30 gid = result[1]
31 else:
32 gid = ''
33 if gid == '-1':
34 gid = ''
35 gids.append(gid)
36
37i=0
38
39for sid in sids:
40 gid = subprocess.Popen([wbinfo, '--sid-to-gid', sid],
41 stdout=subprocess.PIPE).communicate()[0].strip()
42 if gid != gids[i]:
43 print "Expected %s, got %s\n", gid, gids[i]
44 sys.exit(1)
45 i+=1
46
47sys.exit(0)
Note: See TracBrowser for help on using the repository browser.