whitlockjc / sync-ldap-groups-to-svn-authz

Simple Python script that can take your LDAP group definitions and create a Subversion authz file equivalent.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bind() returns before binding operation is done

whitlockjc opened this issue · comments

In function main, I had to insert sleep(3) between bind on line 533 and search_for_groups on line 541. Without this delay, the Active Directory server thinks the bind operation is still in progress, and search_for_groups throws an exception. This is arguably not the right way to handle it. Ideally, bind should poll for the completion of the operation and block until the operation finishes or times out.

Script is running under Windows XP.

Patch below to switch from bind to bind_s:

diff -r e3396390e99b sync_ldap_groups_to_svn_authz/sync_ldap_groups_to_svn_authz.py
--- a/sync_ldap_groups_to_svn_authz/sync_ldap_groups_to_svn_authz.py    Tue Jul 20 15:58:45 2010 -0600
+++ b/sync_ldap_groups_to_svn_authz/sync_ldap_groups_to_svn_authz.py    Wed Aug 29 02:01:39 2012 -0300
@@ -103,7 +103,7 @@

   ldapobject = ldap.initialize(url)

-  ldapobject.bind(bind_dn, bind_password)
+  ldapobject.bind_s(bind_dn, bind_password)

   if verbose:
     print("Successfully bound to %s..." % url)