|
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 |
|
|---|
| 3 | import sys,os,subprocess
|
|---|
| 4 |
|
|---|
| 5 | if len(sys.argv) != 2:
|
|---|
| 6 | print "Usage: test_wbinfo_sids2xids_int.py wbinfo"
|
|---|
| 7 | sys.exit(1)
|
|---|
| 8 |
|
|---|
| 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]
|
|---|
| 15 |
|
|---|
| 16 | #print domain
|
|---|
| 17 | #print domsid
|
|---|
| 18 |
|
|---|
| 19 | sids=[ domsid + '-512', 'S-1-5-32-545', domsid + '-513' ]
|
|---|
| 20 |
|
|---|
| 21 | sids2xids = subprocess.Popen([wbinfo, '--sids-to-unix-ids=' + ','.join(sids)],
|
|---|
| 22 | stdout=subprocess.PIPE).communicate()[0].strip()
|
|---|
| 23 |
|
|---|
| 24 | gids=[]
|
|---|
| 25 |
|
|---|
| 26 | for 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 |
|
|---|
| 37 | i=0
|
|---|
| 38 |
|
|---|
| 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
|
|---|
| 46 |
|
|---|
| 47 | sys.exit(0)
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.