summaryrefslogtreecommitdiffstats
path: root/ipa-admintools/ipa-change-master-key
diff options
context:
space:
mode:
authorMartin Nagy <mnagy@redhat.com>2008-08-15 18:08:01 +0200
committerMartin Nagy <mnagy@redhat.com>2008-09-11 23:34:01 +0200
commit885103c32127d10250564e25c5895464fb366f9e (patch)
tree5db92cd0d4282b3e1aacbfc04c9d076a0d515bec /ipa-admintools/ipa-change-master-key
parent57669ba43224eee0d90556aeea03d14873b4bd7f (diff)
downloadfreeipa-885103c32127d10250564e25c5895464fb366f9e.tar.gz
freeipa-885103c32127d10250564e25c5895464fb366f9e.tar.xz
freeipa-885103c32127d10250564e25c5895464fb366f9e.zip
Rework config.py and change cli tools. Maintain order of IPA servers from command line, config and DNS. Parse options before detecting IPA configuration. Don't ignore rest of the options if one is missing in ipa.conf. Drop the --usage options, we will rely on --help. Fixes: 458869, 459070, 458980, 459234
Diffstat (limited to 'ipa-admintools/ipa-change-master-key')
-rw-r--r--ipa-admintools/ipa-change-master-key35
1 files changed, 20 insertions, 15 deletions
diff --git a/ipa-admintools/ipa-change-master-key b/ipa-admintools/ipa-change-master-key
index 7738627b4..9ab5a96e8 100644
--- a/ipa-admintools/ipa-change-master-key
+++ b/ipa-admintools/ipa-change-master-key
@@ -63,30 +63,38 @@ error was:
""" % sys.exc_value
sys.exit(1)
-def usage():
- print "ipa-change-master-key [-q|--quiet] [-p DM_PASSWORD]"
- sys.exit(1)
-
def parse_options():
- parser = OptionParser()
+ parser = OptionParser("%prog [-q|--quiet] [-p DM_PASSWORD]")
parser.add_option("-p", "--dm-password", dest="dm_password",
help="The Directory Manager password")
parser.add_option("-q", "--quiet", action="store_true", dest="quiet",
help="Keep quiet")
- parser.add_option("--usage", action="store_true",
- help="Program usage")
- args = ipa.config.init_config(sys.argv)
- options, args = parser.parse_args(args)
+ ipa.config.add_standard_options(parser)
+ options, args = parser.parse_args()
+
+ ipa.config.verify_args(parser, args)
+ ipa.config.init_config(options)
return options, args
# We support only des3 encoded stash files for now
def generate_new_stash_file(file):
- odd_parity_bytes_pool = ['\x01', '\x02', '\x04', '\x07', '\x08', '\x0b', '\r', '\x0e', '\x10', '\x13', '\x15', '\x16', '\x19', '\x1a', '\x1c', '\x1f', ' ', '#', '%', '&', ')', '*', ',', '/', '1', '2', '4', '7', '8', ';', '=', '>', '@', 'C', 'E', 'F', 'I', 'J', 'L', 'O', 'Q', 'R', 'T', 'W', 'X', '[', ']', '^', 'a', 'b', 'd', 'g', 'h', 'k', 'm', 'n', 'p', 's', 'u', 'v', 'y', 'z', '|', '\x7f', '\x80', '\x83', '\x85', '\x86', '\x89', '\x8a', '\x8c', '\x8f', '\x91', '\x92', '\x94', '\x97', '\x98', '\x9b', '\x9d', '\x9e', '\xa1', '\xa2', '\xa4', '\xa7', '\xa8', '\xab', '\xad', '\xae', '\xb0', '\xb3', '\xb5', '\xb6', '\xb9', '\xba', '\xbc', '\xbf', '\xc1', '\xc2', '\xc4', '\xc7', '\xc8', '\xcb', '\xcd', '\xce', '\xd0', '\xd3', '\xd5', '\xd6', '\xd9', '\xda', '\xdc', '\xdf', '\xe0', '\xe3',
-'\xe5', '\xe6', '\xe9', '\xea', '\xec', '\xef', '\xf1', '\xf2', '\xf4', '\xf7',
-'\xf8', '\xfb', '\xfd', '\xfe']
+ odd_parity_bytes_pool = ['\x01', '\x02', '\x04', '\x07', '\x08', '\x0b',
+ '\r', '\x0e', '\x10', '\x13', '\x15', '\x16', '\x19', '\x1a', '\x1c',
+ '\x1f', ' ', '#', '%', '&', ')', '*', ',', '/', '1', '2', '4', '7', '8',
+ ';', '=', '>', '@', 'C', 'E', 'F', 'I', 'J', 'L', 'O', 'Q', 'R', 'T',
+ 'W', 'X', '[', ']', '^', 'a', 'b', 'd', 'g', 'h', 'k', 'm', 'n', 'p',
+ 's', 'u', 'v', 'y', 'z', '|', '\x7f', '\x80', '\x83', '\x85', '\x86',
+ '\x89', '\x8a', '\x8c', '\x8f', '\x91', '\x92', '\x94', '\x97', '\x98',
+ '\x9b', '\x9d', '\x9e', '\xa1', '\xa2', '\xa4', '\xa7', '\xa8', '\xab',
+ '\xad', '\xae', '\xb0', '\xb3', '\xb5', '\xb6', '\xb9', '\xba', '\xbc',
+ '\xbf', '\xc1', '\xc2', '\xc4', '\xc7', '\xc8', '\xcb', '\xcd', '\xce',
+ '\xd0', '\xd3', '\xd5', '\xd6', '\xd9', '\xda', '\xdc', '\xdf', '\xe0',
+ '\xe3', '\xe5', '\xe6', '\xe9', '\xea', '\xec', '\xef', '\xf1', '\xf2',
+ '\xf4', '\xf7', '\xf8', '\xfb', '\xfd', '\xfe']
+
pool_len = len(odd_parity_bytes_pool)
keytype = 16 # des3
keydata = ""
@@ -135,9 +143,6 @@ def main():
options, args = parse_options()
- if options.usage:
- usage()
-
krbctx = krbV.default_context()
realm = krbctx.default_realm