summaryrefslogtreecommitdiff
path: root/python/samba/tests/samba_tool
diff options
context:
space:
mode:
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>2018-03-07 13:55:08 +1300
committerAndrew Bartlett <abartlet@samba.org>2018-05-31 01:57:15 +0200
commitbdc0681eaebab7bc930206c2d2db68d7ca132ad3 (patch)
tree38596848e68061345cf49e4ac0439b876f33a8ee /python/samba/tests/samba_tool
parent07302fe03724b98e39f0beca5710b534bcb1582c (diff)
downloadsamba-bdc0681eaebab7bc930206c2d2db68d7ca132ad3.tar.gz
samba-bdc0681eaebab7bc930206c2d2db68d7ca132ad3.tar.bz2
samba-bdc0681eaebab7bc930206c2d2db68d7ca132ad3.zip
samba-tool visualize ntdsconn: add --importldif option
This visualizes the NTDSConnections in an LDIF file exported via `samba_kcc --exportldif`. This functionality is already available in a roundabout way -- you can use `samba_kcc --import_ldif`, and use the DB that generates. This just shortens the process. The ldif import/export feature is useful for analysing AD networks offsite without exposing too much sensitive data. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'python/samba/tests/samba_tool')
-rw-r--r--python/samba/tests/samba_tool/visualize.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/python/samba/tests/samba_tool/visualize.py b/python/samba/tests/samba_tool/visualize.py
index c015abf3b2d..1afb210b7bd 100644
--- a/python/samba/tests/samba_tool/visualize.py
+++ b/python/samba/tests/samba_tool/visualize.py
@@ -122,6 +122,22 @@ class SambaToolVisualizeLdif(SambaToolCmdTest):
self.assertStringsEqual(monochrome, uncoloured, strip=True)
+ def test_import_ldif(self):
+ """Make sure the samba-tool visualize --importldif option gives the
+ same output as using the externally generated db from the same
+ LDIF."""
+ result, s1, err = self.runsubcmd("visualize", "ntdsconn",
+ '-H', self.dburl,
+ '--color=no', '-S')
+ self.assertCmdSuccess(result, s1, err)
+
+ result, s2, err = self.runsubcmd("visualize", "ntdsconn",
+ '--importldif', MULTISITE_LDIF,
+ '--color=no', '-S')
+ self.assertCmdSuccess(result, s2, err)
+
+ self.assertStringsEqual(s1, s2)
+
def test_output_file(self):
"""Check that writing to a file works, with and without
--color=auto."""