summaryrefslogtreecommitdiffstats
path: root/ipa-client
diff options
context:
space:
mode:
authorMartin Kosek <mkosek@redhat.com>2011-10-06 08:22:08 +0200
committerMartin Kosek <mkosek@redhat.com>2011-10-06 08:28:15 +0200
commit185ca8f6fc5e69e989e473c8b1d066aa2d8e5cb1 (patch)
tree5e74685f51c038463b24e9de7fe231fd84fc5c3e /ipa-client
parent7d5106de976140e8425152a83a300be9dc49372a (diff)
downloadfreeipa-185ca8f6fc5e69e989e473c8b1d066aa2d8e5cb1.tar.gz
freeipa-185ca8f6fc5e69e989e473c8b1d066aa2d8e5cb1.tar.xz
freeipa-185ca8f6fc5e69e989e473c8b1d066aa2d8e5cb1.zip
Install tools crash when password prompt is interrupted
When getpass.getpass() function is interrupted via CTRL+D, EOFError exception is thrown. Most of the install tools are not prepared for this event and crash with this exception. Make sure that it is handled properly and nice error message is printed. https://fedorahosted.org/freeipa/ticket/1916
Diffstat (limited to 'ipa-client')
-rwxr-xr-xipa-client/ipa-install/ipa-client-install13
1 files changed, 11 insertions, 2 deletions
diff --git a/ipa-client/ipa-install/ipa-client-install b/ipa-client/ipa-install/ipa-client-install
index 1c28e87c2..27104fc19 100755
--- a/ipa-client/ipa-install/ipa-client-install
+++ b/ipa-client/ipa-install/ipa-client-install
@@ -942,7 +942,10 @@ def install(options, env, fstore, statestore):
stdin = options.password
else:
if not options.unattended:
- stdin = getpass.getpass("Password for %s: " % principal)
+ try:
+ stdin = getpass.getpass("Password for %s: " % principal)
+ except EOFError:
+ stdin = None
if not stdin:
print "Password must be provided for %s. " % \
principal
@@ -967,7 +970,13 @@ def install(options, env, fstore, statestore):
if options.unattended:
print "Password must be provided in non-interactive mode"
return CLIENT_INSTALL_ERROR
- password = getpass.getpass("Password: ")
+ try:
+ password = getpass.getpass("Password: ")
+ except EOFError:
+ password = None
+ if not password:
+ print "Password must be provided."
+ return CLIENT_INSTALL_ERROR
join_args.append("-w")
join_args.append(password)
nolog = (password,)