hi, here i have been facing one issue, i want to search the usernames from specified domain without username and password [ anonymous ]. here i hv put my code please review it and suggest me. if i hv used my domain username and password, then the following code return specified user names properly , but i want to search particular usernames without authentication. i am not intrested to put my username and password.
import ldap def test(): server = "my server name" who = "prabhakar" cred = "my password" keyword = "searching keyword" port = 3268 try: l = ldap.open(server, port) l.simple_bind_s(who, cred) print "Successfully bound to server.\n" except ldap.LDAPError, error_message: print "Couldn't Connect. %s " % error_message base = "" scope = 2 filter = "cn=" + keyword retrieve_attributes = None count = 0 result_set = [] timeout = 0 try: result_id = l.search(base, scope, filter, retrieve_attributes) print result_id while 1: result_type, result_data = l.result(result_id, timeout) if (result_data == []): break else: if result_type == ldap.RES_SEARCH_ENTRY: result_set.append(result_data) if len(result_set) == 0: print "No Results." for i in range(len(result_set)): for entry in result_set[i]: try: name = entry[1]['cn'][0] count = count + 1 print "%d.\nName: %s\n" %(count, name) except: pass except ldap.LDAPError, error_message: print error_message test() ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ OUTPUT +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ successfully bound to server 1. username1 2. username2 # usernames would be depends searching keyword ------------------------------------------------------------------------------------------------------------------------------ i want to fire anonymous query and to search the contents. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Trac Users" group. To post to this group, send email to trac-users@googlegroups.com To unsubscribe from this group, send email to trac-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/trac-users?hl=en -~----------~----~----~----~------~----~------~--~---