summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorKamen Mazdrashki <kamenim@samba.org>2010-09-18 00:44:17 +0300
committerKamen Mazdrashki <kamenim@samba.org>2010-09-18 15:09:46 +0300
commitc3489a7918758848953f00cee6a36519cd059daf (patch)
tree56b54f2916ccd3bbed9d5646fec879cb347c6321 /source4
parent78b6265ac2a79cdf0051b895ecebeb77ac3a372c (diff)
downloadsamba-c3489a7918758848953f00cee6a36519cd059daf.tar.gz
samba-c3489a7918758848953f00cee6a36519cd059daf.tar.bz2
samba-c3489a7918758848953f00cee6a36519cd059daf.zip
s4-ldapcmp: Fix options parsing for common Samba options
And also set 'creds2' to be equal to 'creds' in case username2 paramater is not supplied on cmd line
Diffstat (limited to 'source4')
-rwxr-xr-xsource4/scripting/devel/ldapcmp14
1 files changed, 10 insertions, 4 deletions
diff --git a/source4/scripting/devel/ldapcmp b/source4/scripting/devel/ldapcmp
index 76b4e8eec6..edf37d36d0 100755
--- a/source4/scripting/devel/ldapcmp
+++ b/source4/scripting/devel/ldapcmp
@@ -518,13 +518,10 @@ class LDAPBundel(object):
if __name__ == "__main__":
parser = OptionParser("ldapcmp [options] domain|configuration|schema")
sambaopts = options.SambaOptions(parser)
+ parser.add_option_group(sambaopts)
credopts = options.CredentialsOptionsDouble(parser)
parser.add_option_group(credopts)
- lp = sambaopts.get_loadparm()
- creds = credopts.get_credentials(lp)
- creds2 = credopts.get_credentials2(lp)
-
parser.add_option("", "--host", dest="host",
help="IP of the first LDAP server",)
parser.add_option("", "--host2", dest="host2",
@@ -537,6 +534,15 @@ if __name__ == "__main__":
help="Print all DN pairs that have been compared",)
(opts, args) = parser.parse_args()
+ lp = sambaopts.get_loadparm()
+ creds = credopts.get_credentials(lp)
+ creds2 = credopts.get_credentials2(lp)
+ if creds2.is_anonymous():
+ creds2 = creds
+
+ if creds.is_anonymous():
+ parser.error("You must supply at least one username/password pair")
+
if not (len(args) == 1 and args[0].upper() in ["DOMAIN", "CONFIGURATION", "SCHEMA"]):
parser.error("Incorrect arguments")