Only allow 3 password attempts

This commit is contained in:
David Bartley 2007-12-16 18:34:42 -05:00
parent 40cf5ec2f3
commit c22b6e91a3
2 changed files with 4 additions and 1 deletions

View File

@ -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

View File

@ -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."