binding not released
whitlockjc opened this issue · comments
I am using your script on CentOS 6. I got the following error when using your script more then once:
Error performing search: {'info': '00002024: LdapErr: DSID-0C060595, comment: No other operations may be performed on the connection while a bind is outstanding., data 0, v1772', 'desc': 'Server is busy'}
It seems the binding is not released by your script. I added an unbind
function. Since I'm unfamiliar with Bitbucket here are the relevant snippets.
# bind()
def unbind(ldapobject):
ldapobject.unbind()
if verbose:
print("Released binding to %s..." % url)
# unbind()
Cheers, Jasper
Unbind alone does not work since the server is busy. Adding a loop to retry when unbinding worked:
for i in range(1, 3):
try:
groups = search_for_groups(ldapobject)
break
except ldap.LDAPError, error_message:
print("Error performing search: %s " % error_message)
if i==3:
unbind(ldapobject)
sys.exit(1)