diff options
-rw-r--r-- | source4/scripting/python/samba/getopt.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/source4/scripting/python/samba/getopt.py b/source4/scripting/python/samba/getopt.py index 08fe692ce0..8104faf62e 100644 --- a/source4/scripting/python/samba/getopt.py +++ b/source4/scripting/python/samba/getopt.py @@ -135,10 +135,12 @@ class CredentialsOptions(optparse.OptionGroup): self.ipaddress = arg def _set_kerberos(self, option, opt_str, arg, parser): - if bool(arg) or arg.lower() == "yes": + if arg.lower() in ["yes", 'true', '1']: self.creds.set_kerberos_state(MUST_USE_KERBEROS) - else: + elif arg.lower() in ["no", 'false', '0']: self.creds.set_kerberos_state(DONT_USE_KERBEROS) + else: + raise optparse.BadOptionErr("invalid kerberos option: %s" % arg) def _set_simple_bind_dn(self, option, opt_str, arg, parser): self.creds.set_bind_dn(arg) |