I have a query that was written in python (2.5) utilizing the python-ldap package (newest stable version for both Windows and Linux) to query an Active Directory server for a user's group membership. The code works fine on my test machine (2-3 seconds for result) which is Windows based but when I move the code over and run it on our production Linux (Ubuntu 8.10) server the query hangs for exactly 5 minutes and then displays the results. Does anyone have any ideas where this delay might be coming from and how I can resolve the issue?
The code is (please note I replaced some real data i.e. login, password, etc with "????" but in my code real names are there): #!/usr/bin/envpython import ldap import ldap.sasl import sys server = 'ldap://10.200.1.10' user_id = ???? pw = ???? def main(): try: con = ldap.initialize(server) con.simple_bind_s(user_id, pw) print 'Connection Made' except ldap.INVALID_CREDENTIALS: print "Your username or password is incorrect." sys.exit() except ldap.LDAPError, e: if type(e.message) == dict and e.message.has_key('desc'): print 'Error - ' + e.message['desc'] else: print 'Error - ' + str(e) sys.exit() finally: print 'Connected' try: #con.timeout = 10 #con.network_timeout = 10 base_dn = 'dc=mariner,dc=local' filter = "(memberOf=CN=????,CN=Users,DC=????,DC=local)" attrs = ['sn','mail','cn','sAMAccountName','displayName','memberOf'] timeout = 3 results = con.search_s(base_dn, ldap.SCOPE_SUBTREE, filter, attrs) for dn,entry in results: if dn != None: print 'Processing',repr(dn) print entry['sAMAccountName'] print entry['displayName'] print entry['memberOf'] con.unbind() print "" print "Connection Closed" except ldap.LDAPError, e: print 'Error - ' + str(e) sys.exit() # End Of Code ## ### #### if __name__=="__main__": main() Thank You Todd J. Hanson todd.han...@mariner-qs.com
------------------------------------------------------------------------------
_______________________________________________ Python-LDAP-dev mailing list Python-LDAP-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/python-ldap-dev