summaryrefslogtreecommitdiff
path: root/source4/scripting/python
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2011-07-12 10:41:52 +1000
committerAndrew Tridgell <tridge@samba.org>2011-07-13 12:51:05 +0200
commit6bc1957a54ba2e3c73b0cf580c94e8055d451b03 (patch)
treec5f411f47ccade232f93d2aedd537c5420ed1d04 /source4/scripting/python
parentd9e2317f491cbf532c7bc186d91c6d270a2f583e (diff)
downloadsamba-6bc1957a54ba2e3c73b0cf580c94e8055d451b03.tar.gz
samba-6bc1957a54ba2e3c73b0cf580c94e8055d451b03.tar.bz2
samba-6bc1957a54ba2e3c73b0cf580c94e8055d451b03.zip
samba-tool: fixed ldapcmp to run as non-root
this avoids the need for access to the secrets database Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org> Pair-Programmed-With: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'source4/scripting/python')
-rwxr-xr-xsource4/scripting/python/samba/netcmd/ldapcmp.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/source4/scripting/python/samba/netcmd/ldapcmp.py b/source4/scripting/python/samba/netcmd/ldapcmp.py
index 160aa31258..c752d76a7b 100755
--- a/source4/scripting/python/samba/netcmd/ldapcmp.py
+++ b/source4/scripting/python/samba/netcmd/ldapcmp.py
@@ -874,15 +874,22 @@ class cmd_ldapcmp(Command):
context1=None, context2=None, context3=None,
two=False, quiet=False, verbose=False, descriptor=False, sort_aces=False, view="section",
base="", base2="", scope="SUB", credopts=None, sambaopts=None, versionopts=None):
+
lp = sambaopts.get_loadparm()
- creds = credopts.get_credentials(lp, fallback_machine=True)
+
+ using_ldap = URL1.startswith("ldap") or URL2.startswith("ldap")
+
+ if using_ldap:
+ creds = credopts.get_credentials(lp, fallback_machine=True)
+ else:
+ creds = None
creds2 = credopts.get_credentials2(lp, guess=False)
if creds2.is_anonymous():
creds2 = creds
else:
creds2.set_domain("")
creds2.set_workstation("")
- if not creds.authentication_requested():
+ if using_ldap and not creds.authentication_requested():
raise CommandError("You must supply at least one username/password pair")
# make a list of contexts to compare in