diff options
author | Stephen Gallagher <sgallagh@redhat.com> | 2011-03-24 10:54:34 -0400 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2011-03-24 14:13:44 -0400 |
commit | 675f529e1a0ada1b1a400a59465560ab88a6e24c (patch) | |
tree | 6c4595817e24a859ef9690d45c393cd47473bae6 | |
parent | 3612c73e7957721bcbf31d0118e2ac210eb46b88 (diff) | |
download | sssd-675f529e1a0ada1b1a400a59465560ab88a6e24c.tar.gz sssd-675f529e1a0ada1b1a400a59465560ab88a6e24c.tar.xz sssd-675f529e1a0ada1b1a400a59465560ab88a6e24c.zip |
sss_obfuscate: Avoid traceback on ctrl+d
-rw-r--r-- | src/tools/sss_obfuscate | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/tools/sss_obfuscate b/src/tools/sss_obfuscate index 506e2c41..5a5742b9 100644 --- a/src/tools/sss_obfuscate +++ b/src/tools/sss_obfuscate @@ -41,12 +41,16 @@ def main(): return 1 if not options.stdin: - pprompt = lambda: (getpass.getpass("Enter password: "), getpass.getpass("Re-enter password: ")) - p1, p2 = pprompt() - while p1 != p2: - print('Passwords do not match. Try again') + try: + pprompt = lambda: (getpass.getpass("Enter password: "), getpass.getpass("Re-enter password: ")) p1, p2 = pprompt() - password = p1 + while p1 != p2: + print('Passwords do not match. Try again') + p1, p2 = pprompt() + password = p1 + except EOFError: + print >> sys.stderr, '\nUnexpected end-of-file. Password change aborted' + return 1 else: try: |