From 38175775250c65ca2427802521080b80a7d0b295 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Wed, 20 Feb 2008 09:26:34 -0500 Subject: Handle a ctrl-C gracefully while getting the new password Resolves 433053 --- ipa-admintools/ipa-passwd | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) (limited to 'ipa-admintools') diff --git a/ipa-admintools/ipa-passwd b/ipa-admintools/ipa-passwd index 1e658a85..44f3ed2a 100644 --- a/ipa-admintools/ipa-passwd +++ b/ipa-admintools/ipa-passwd @@ -86,19 +86,24 @@ def main(): print "Changing password for %s" % principal - while (match != True): - # No syntax checking of the password is required because that is done - # on the server side - password = getpass.getpass(" New Password: ") - confirm = getpass.getpass(" Confirm Password: ") - if (password != confirm): - print "Passwords do not match" - match = False - elif (len(password) < 1): - print "Password cannot be empty" - match = False - else: - match = True + try: + while (match != True): + # No syntax checking of the password is required because that is + # done on the server side + password = getpass.getpass(" New Password: ") + confirm = getpass.getpass(" Confirm Password: ") + if (password != confirm): + print "Passwords do not match" + match = False + elif (len(password) < 1): + print "Password cannot be empty" + match = False + else: + match = True + except KeyboardInterrupt: + print "" + print "Password change cancelled" + return 1 try: client = ipaclient.IPAClient() -- cgit