summaryrefslogtreecommitdiff
path: root/source4/scripting/devel/ldapcmp
diff options
context:
space:
mode:
Diffstat (limited to 'source4/scripting/devel/ldapcmp')
-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