From c22b6e91a3a5fdbfb413bc451fb6b147cf73284a Mon Sep 17 00:00:00 2001 From: David Bartley Date: Sun, 16 Dec 2007 18:34:42 -0500 Subject: [PATCH] Only allow 3 password attempts --- ceo/members.py | 4 ++++ ceo/urwid/main.py | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ceo/members.py b/ceo/members.py index 71fbf7e..92ae8d0 100644 --- a/ceo/members.py +++ b/ceo/members.py @@ -90,11 +90,15 @@ def connect(auth_callback): global ld password = None + tries = 0 while ld is None: try: ld = ldapi.connect_sasl(cfg['server_url'], cfg['sasl_mech'], cfg['sasl_realm'], password) except ldap.LOCAL_ERROR, e: + tries += 1 + if tries > 3: + raise e password = auth_callback.callback(e) if password == None: raise e diff --git a/ceo/urwid/main.py b/ceo/urwid/main.py index b0c0331..44d244d 100644 --- a/ceo/urwid/main.py +++ b/ceo/urwid/main.py @@ -156,7 +156,6 @@ def start(): ui.run_wrapper( run ) except ldap.LOCAL_ERROR, e: print ldapi.format_ldaperror(e) - print "Hint: You may need to run 'kinit'" except ldap.INSUFFICIENT_ACCESS, e: print ldapi.format_ldaperror(e) print "You probably aren't permitted to do whatever you just tried."