mirror of
https://github.com/samba-team/samba.git
synced 2025-03-11 16:58:40 +03:00
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
This commit is contained in:
parent
78b6265ac2
commit
c3489a7918
@ -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")
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user