connect_sasl no longer causes entire program to die on error condition.
However, accessing LDAP beyond this point is probably a really bad idea as we certainly do not do anything sane to handle the error.
This commit is contained in:
parent
868b4b681b
commit
e334437d6d
17
ceo/ldapi.py
17
ceo/ldapi.py
|
@ -10,12 +10,19 @@ from subprocess import Popen, PIPE
|
|||
|
||||
def connect_sasl(uri, mech, realm, password):
|
||||
|
||||
# open the connection
|
||||
ld = ldap.initialize(uri)
|
||||
try:
|
||||
# open the connection
|
||||
ld = ldap.initialize(uri)
|
||||
|
||||
# authenticate
|
||||
sasl = Sasl(mech, realm, password)
|
||||
ld.sasl_interactive_bind_s('', sasl)
|
||||
|
||||
# authenticate
|
||||
sasl = Sasl(mech, realm, password)
|
||||
ld.sasl_interactive_bind_s('', sasl)
|
||||
except ldap.LOCAL_ERROR, e:
|
||||
raise e
|
||||
|
||||
except:
|
||||
print "Shit, something went wrong!"
|
||||
|
||||
return ld
|
||||
|
||||
|
|
Loading…
Reference in New Issue