[python3-ldap] Development Question

python3ldap python3ldap at gmail.com
Sat Sep 21 04:21:27 CEST 2013


Hello Paul,
thanks for testing the python3-ldap client library!
There is no specific extra debug information in the library for now, you
can check the ldap result message for each ldap operation inspecting the
c.result attribute.
I've sligthly modified your script and it''s working for me:

from ldap3 import Connection, Server
from ldap3 import AUTH_SIMPLE, STRATEGY_SYNC, SEARCH_DEREFERENCE_ALWAYS,
SEARCH_SCOPE_WHOLE_SUBTREE, GET_NO_INFO
import pprint
LDAP_HOST = 'yourServer'
LDAP_USER = 'yourUser'
LDAP_PASS = 'yourPassword'
s = Server(LDAP_HOST, port = 389, getInfo = GET_NO_INFO)
c = Connection(s, autoBind = False, clientStrategy = STRATEGY_SYNC,
user=LDAP_USER, password=LDAP_PASS, authentication=AUTH_SIMPLE)
c.open()
print('Connection info:')
print(c)
c.bind()
print('Bind result:')
pprint.PrettyPrinter(indent=4).pprint(c.result)
#print(s.info)
result = c.search('o=hcc','(objectClass=*)', SEARCH_SCOPE_WHOLE_SUBTREE,
SEARCH_DEREFERENCE_ALWAYS, attributes = ['cn','ou','uid'])
print('Search result:')
pprint.PrettyPrinter(indent=4).pprint(c.result)
print('Search response:')
pprint.PrettyPrinter(indent=4).pprint(c.response)
c.unbind()

Please, substitute the LDAP_HOST, LDAP_USER and LDAP_PASSWORD with your
current values and send me back the output. You should get details for the
conection info, for the bind result, the search result and the search
response.

I've remove the GET_ALL_INFO for now, because it adds a few search
operations at the bind phase and overrides the result from the bind
operation. You can add it back later wjem it's working.

Can you tell me more on the client and the server platform you're using?

Thanks,
Giovanni

Have fun,
gc


2013/9/20 Paul G. <paul.list at isrcomputing.com>

> **
>  Hi,
>
>  I downloaded 'python3-ldap-0.6.0-beta' and tested it. It failed to work
> for me.
>
>
> from ldap3 import connection, server
> from ldap3 import AUTH_SIMPLE, STRATEGY_SYNC, STRATEGY_ASYNC_THREADED, SEARCH_DEREFERENCE_ALWAYS, SEARCH_SCOPE_WHOLE_SUBTREE, GET_ALL_INFO
> import pprint
> s = server.Server(LDAP_HOST, port = 389, getInfo = GET_ALL_INFO)
> c = connection.Connection(s, autoBind = True, clientStrategy = STRATEGY_SYNC, user=LDAP_USER, password=LDAP_PASS, authentication=AUTH_SIMPLE)
> print(s.info)
> result = c.search('o=hcc','(objectClass=*)', SEARCH_SCOPE_WHOLE_SUBTREE, SEARCH_DEREFERENCE_ALWAYS, attributes = ['cn','ou','uid']);
> pprint.PrettyPrinter(indent=4).pprint(c);
> pprint.PrettyPrinter(indent=4).pprint(result);
> c.unbind();
>
>  It returns with:
>
> Connection(server=Server(host='XXXXX', port=389, ssl=False, getInfo=3), user='XXXXX', password='YYYYYY', autoBind=True, version=3, authentication=1, clientStrategy=0, autoReferrals=True)
> False
>
>
>  Is there a way to turn on extra debugging to see where the script is
> failing?
>
>  Regards,
>  Paul G.
>
> _______________________________________________
> python3-ldap mailing list
> python3-ldap at python.org
> https://mail.python.org/mailman/listinfo/python3-ldap
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python3-ldap/attachments/20130921/ed4f6096/attachment.html>


More information about the python3-ldap mailing list