Add some const to can_delete_file_in_directory().
[Samba.git] / source3 / script / tests / test_wbinfo_sids2xids_int.py
blob87db0efed294966dd2185e034eb0a29662fcde2e
1 #!/usr/bin/env python
3 import sys,os,subprocess
5 if len(sys.argv) != 2:
6 print "Usage: test_wbinfo_sids2xids_int.py wbinfo"
7 sys.exit(1)
9 wbinfo = sys.argv[1]
10 domain = subprocess.Popen([wbinfo, "--own-domain"],
11 stdout=subprocess.PIPE).communicate()[0].strip()
12 domsid = subprocess.Popen([wbinfo, "-n", domain + "\\"],
13 stdout=subprocess.PIPE).communicate()[0]
14 domsid = domsid.split(' ')[0]
16 #print domain
17 #print domsid
19 sids=[ domsid + '-512', 'S-1-5-32-545', domsid + '-513' ]
21 sids2xids = subprocess.Popen([wbinfo, '--sids-to-unix-ids=' + ','.join(sids)],
22 stdout=subprocess.PIPE).communicate()[0].strip()
24 gids=[]
26 for line in sids2xids.split('\n'):
27 result = line.split(' ')[2:]
29 if result[0] == 'gid':
30 gid = result[1]
31 else:
32 gid = ''
33 if gid == '-1':
34 gid = ''
35 gids.append(gid)
37 i=0
39 for 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
47 sys.exit(0)