summaryrefslogtreecommitdiff
path: root/source4/scripting/devel
diff options
context:
space:
mode:
authorKamen Mazdrashki <kamenim@samba.org>2010-09-22 03:24:01 +0300
committerKamen Mazdrashki <kamenim@samba.org>2010-09-22 15:07:24 +0300
commite3b81c6062c9b82d246ac8103c07c246e2a72250 (patch)
tree417de57cd14fc3cef9ef1d2a3e2c2023d925610e /source4/scripting/devel
parente12e661f35983dfab3e7d869df7770f519b49e48 (diff)
downloadsamba-e3b81c6062c9b82d246ac8103c07c246e2a72250.tar.gz
samba-e3b81c6062c9b82d246ac8103c07c246e2a72250.tar.bz2
samba-e3b81c6062c9b82d246ac8103c07c246e2a72250.zip
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
Diffstat (limited to 'source4/scripting/devel')
-rwxr-xr-xsource4/scripting/devel/ldapcmp15
1 files 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