3 import sys
,os
,subprocess
7 print "Usage: test_wbinfo_sids2xids_int.py wbinfo net"
14 os
.system(netcmd
+ "cache flush")
16 domain
= subprocess
.Popen([wbinfo
, "--own-domain"],
17 stdout
=subprocess
.PIPE
).communicate()[0].strip()
18 domsid
= subprocess
.Popen([wbinfo
, "-n", domain
+ "\\"],
19 stdout
=subprocess
.PIPE
).communicate()[0]
20 domsid
= domsid
.split(' ')[0]
25 sids
=[ domsid
+ '-512', 'S-1-5-32-545', domsid
+ '-513' ]
29 sids2xids
= subprocess
.Popen([wbinfo
, '--sids-to-unix-ids=' + ','.join(sids
)],
30 stdout
=subprocess
.PIPE
).communicate()[0].strip()
34 for line
in sids2xids
.split('\n'):
35 result
= line
.split(' ')[2:]
37 if result
[0] == 'gid':
45 # Check the list produced by the sids-to-xids call with the
46 # singular variant (sid-to-gid) for each sid in turn.
47 def check_singular(sids
, gids
):
50 gid
= subprocess
.Popen([wbinfo
, '--sid-to-gid', sid
],
51 stdout
=subprocess
.PIPE
).communicate()[0].strip()
53 print "Expected %s, got %s\n", gid
, gids
[i
]
57 # first round: with filled cache
58 check_singular(sids
, gids
)
60 # second round: with empty cache
62 check_singular(sids
, gids
)