summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2017-06-28 14:58:41 +0200
committerKarolin Seeger <kseeger@samba.org>2017-07-06 13:17:19 +0200
commit05782d5cc0ed8bacac9fe8b254bd0da543010b99 (patch)
tree3ad5760287bcc66de546b12308f7b0330606b2a6
parent24a5c45b431b4eeec66b5b4002a58fb09b3dbae2 (diff)
downloadsamba-05782d5cc0ed8bacac9fe8b254bd0da543010b99.tar.gz
s3:tests: Do *NOT* flush the complete gencache!
This removes important entries winbindd created during startup! BUG: https://bugzilla.samba.org/show_bug.cgi?id=12868 Pair-Programmed-With: Ralph Boehme <slow@samba.org> Signed-off-by: Andreas Schneider <asn@samba.org> Signed-off-by: Ralph Boehme <slow@samba.org> (cherry picked from commit 45da755430c6b124335c9dfeb8a252060823ac4c) Autobuild-User(v4-6-test): Karolin Seeger <kseeger@samba.org> Autobuild-Date(v4-6-test): Thu Jul 6 13:17:19 CEST 2017 on sn-devel-144
-rwxr-xr-xsource3/script/tests/test_wbinfo_sids2xids_int.py25
1 files changed, 15 insertions, 10 deletions
diff --git a/source3/script/tests/test_wbinfo_sids2xids_int.py b/source3/script/tests/test_wbinfo_sids2xids_int.py
index 3ad3156ea93..21804452365 100755
--- a/source3/script/tests/test_wbinfo_sids2xids_int.py
+++ b/source3/script/tests/test_wbinfo_sids2xids_int.py
@@ -10,8 +10,13 @@ if len(sys.argv) != 3:
wbinfo = sys.argv[1]
netcmd = sys.argv[2]
-def flush_cache():
- os.system(netcmd + " cache flush")
+def flush_cache(sids=[], uids=[], gids=[]):
+ for sid in sids:
+ os.system(netcmd + (" cache del IDMAP/SID2XID/%s" % (sid)))
+ for uids in uids:
+ os.system(netcmd + (" cache del IDMAP/UID2SID/%s" % (uid)))
+ for gids in gids:
+ os.system(netcmd + (" cache del IDMAP/GID2SID/%s" % (gid)))
def fill_cache(inids, idtype='gid'):
for inid in inids:
@@ -31,7 +36,7 @@ domsid = domsid.split(' ')[0]
sids=[ domsid + '-512', 'S-1-5-32-545', domsid + '-513', 'S-1-1-0', 'S-1-3-1', 'S-1-5-1' ]
-flush_cache()
+flush_cache(sids=sids)
sids2xids = subprocess.Popen([wbinfo, '--sids-to-unix-ids=' + ','.join(sids)],
stdout=subprocess.PIPE).communicate()[0].strip()
@@ -74,7 +79,7 @@ def check_singular(sids, ids, idtype='gid'):
stdout=subprocess.PIPE).communicate()[0].strip()
if outid != ids[i]:
print "Expected %s, got %s\n" % (outid, ids[i])
- flush_cache()
+ flush_cache(sids=sids, uids=uids, gids=gids)
sys.exit(1)
i += 1
@@ -90,7 +95,7 @@ def check_multiple(sids, idtypes):
if result[0] != idtypes[i]:
print "Expected %s, got %s\n" % (idtypes[i], result[0])
- flush_cache()
+ flush_cache(sids=sids, uids=uids, gids=gids)
sys.exit(1)
i += 1
@@ -99,22 +104,22 @@ check_singular(sids, gids, 'gid')
check_singular(sids, uids, 'uid')
# second round: with empty cache
-flush_cache()
+flush_cache(sids=sids, gids=gids)
check_singular(sids, gids, 'gid')
-flush_cache()
+flush_cache(sids=sids, uids=uids)
check_singular(sids, uids, 'uid')
# third round: with filled cache via uid-to-sid
-flush_cache()
+flush_cache(sids=uids, uids=uids)
fill_cache(uids, 'uid')
check_multiple(sids, idtypes)
# fourth round: with filled cache via gid-to-sid
-flush_cache()
+flush_cache(sids=sids, gids=gids)
fill_cache(gids, 'gid')
check_multiple(sids, idtypes)
# flush the cache so any incorrect mappings don't break other tests
-flush_cache()
+flush_cache(sids=sids, uids=uids, gids=gids)
sys.exit(0)