From e3b81c6062c9b82d246ac8103c07c246e2a72250 Mon Sep 17 00:00:00 2001 From: Kamen Mazdrashki Date: Wed, 22 Sep 2010 03:24:01 +0300 Subject: s4-ldapcmp: Enable comparisons between LDBs too This will enable us to compare two LDBs or and LDB with running AD server. Comparing LDB against running running server may come into handy when one want to see if 'net vampire' command does what it does the right way --- source4/scripting/devel/ldapcmp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/source4/scripting/devel/ldapcmp b/source4/scripting/devel/ldapcmp index edf37d36d0..689c2020c4 100755 --- a/source4/scripting/devel/ldapcmp +++ b/source4/scripting/devel/ldapcmp @@ -43,10 +43,19 @@ summary = {} class LDAPBase(object): def __init__(self, host, cmd_opts, creds, lp): + ldb_options = [] + samdb_url = host if not "://" in host: - self.host = "ldap://" + host + ":389" - self.ldb = Ldb(self.host, credentials=creds, lp=lp, - options=["modules:paged_searches"]) + if os.path.isfile(host): + samdb_url = "tdb://%s" % host + else: + samdb_url = "ldap://%s:389" % host + # user 'paged_search' module when connecting remotely + ldb_options = ["modules:paged_searches"] + self.ldb = Ldb(url=samdb_url, + credentials=creds, + lp=lp, + options=ldb_options) self.two_domains = cmd_opts.two self.quiet = cmd_opts.quiet self.host = host -- cgit