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
|
@ -10,6 +10,7 @@ from subprocess import Popen, PIPE
|
||||||
|
|
||||||
def connect_sasl(uri, mech, realm, password):
|
def connect_sasl(uri, mech, realm, password):
|
||||||
|
|
||||||
|
try:
|
||||||
# open the connection
|
# open the connection
|
||||||
ld = ldap.initialize(uri)
|
ld = ldap.initialize(uri)
|
||||||
|
|
||||||
|
@ -17,6 +18,12 @@ def connect_sasl(uri, mech, realm, password):
|
||||||
sasl = Sasl(mech, realm, password)
|
sasl = Sasl(mech, realm, password)
|
||||||
ld.sasl_interactive_bind_s('', sasl)
|
ld.sasl_interactive_bind_s('', sasl)
|
||||||
|
|
||||||
|
except ldap.LOCAL_ERROR, e:
|
||||||
|
raise e
|
||||||
|
|
||||||
|
except:
|
||||||
|
print "Shit, something went wrong!"
|
||||||
|
|
||||||
return ld
|
return ld
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue