summaryrefslogtreecommitdiffstats
path: root/ipa-admintools
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2008-02-20 09:26:34 -0500
committerRob Crittenden <rcritten@redhat.com>2008-02-20 09:26:34 -0500
commit38175775250c65ca2427802521080b80a7d0b295 (patch)
tree626e3aadb39a90cda176d12a7aed93ded3225103 /ipa-admintools
parent346f73057f2b050a9aa5b5a53cb7a981a6339ac7 (diff)
downloadfreeipa-38175775250c65ca2427802521080b80a7d0b295.tar.gz
freeipa-38175775250c65ca2427802521080b80a7d0b295.tar.xz
freeipa-38175775250c65ca2427802521080b80a7d0b295.zip
Handle a ctrl-C gracefully while getting the new password
Resolves 433053
Diffstat (limited to 'ipa-admintools')
-rw-r--r--ipa-admintools/ipa-passwd31
1 files changed, 18 insertions, 13 deletions
diff --git a/ipa-admintools/ipa-passwd b/ipa-admintools/ipa-passwd
index 1e658a85b..44f3ed2a6 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()