I would like to recall issue #2, I'm an idiot and it DOES work. But I'm =
still stumped on getting all my results.
=20
-Ryan Parrish=20
-----Original Message-----
From: pyt...@li... =
[mailto:pyt...@li...] On Behalf Of Ryan =
Parrish
Sent: Thursday, January 13, 2005 9:39 AM
To: pyt...@li...
Subject: Totally stumped on how to use async.
Let me preface by saying that I am kind of a newbie with LDAP. =20
Here is my problem, I would like to use python-ldap to query the =
proxyAddresses on my AD domain controller, and eventually write it out =
to a file. But since this is AD I have to limit my queries to under =
1000 results. =20
I am trying to mimic the functionality of this Perl script =
http://www-personal.umich.edu/~malth/gaptuning/postfix/getadsmtp.pl
1.) When I use the example on the site for asynchronies queries, I don't =
get all the results - I get 2000 (which I don't understand why, but =
there is actually =
3106)http://homepage.mac.com/mengelhart/python-ldap-samples.html#search
2.) The way I understand 'retrieveAttribuites' to work would be that I =
only retrieve one particular attribute for each 'cn', and that is how it =
appears to work in the 'directoyassist' 3rd party script off the site. =
So I figured that I could put ['proxyAddresses'] in there and only =
receive the proxyAddresses, but when I use anything except None I get no =
results back.
Here is what I have, it is almost a verbatim copy of the example, if you =
could just give me some pointers on how to use the async queries I will =
be on my way. Thanks.=20
PS I have tried on both my Linux and win box and get the exact same =
results.
#!/usr/bin/env python
import ldap
from string import split
try:
l =3D ldap.open("10.11.2.33")
l.simple_bind_s('A user name','*****') except ldap.LDAPError, e:
print e
baseDN =3D "dc=3Dfoxracing,dc=3Dcom"
searchScope =3D ldap.SCOPE_SUBTREE
retrieveAttributes =3D None
#sizelimit =3D 990
searchFilter =3D "(& (mailnickname=3D*) (| (&(objectCategory=3Dperson) \
(objectClass=3Duser)(!(homeMDB=3D*))(!(msExchHomeServerName=3D*))) \
(&(objectCategory=3Dperson)(objectClass=3Duser)(|(homeMDB=3D*) \
(msExchHomeServerName=3D*)))(&(objectCategory=3Dperson)(objectClass=3Dcon=
tact)) \
(objectCategory=3Dgroup)(objectCategory=3DpublicFolder) ))"
try:
ldap_result_id =3D l.search(baseDN, searchScope, searchFilter, =
retrieveAttributes)
while 1:
result_type, result_data =3D l.result(ldap_result_id, 0)
if (result_data =3D=3D []):
break
else:
if result_type =3D=3D ldap.RES_SEARCH_ENTRY:
for entry in result_data[0][1]['proxyAddresses']:
if 'SMTP' in entry:
email =3D "%s OK" % (split(entry, ':')[1])
print email
except ldap.LDAPError, e:
print e
_-`-_-`-_-`-_-`-_-`-_-`-_-`-_-`-_-`-_
Ryan Parrish
ry...@fo...
IT Dept.
408-776-8633 extension 1229
Please direct all support questions to - (=AF`=B7.=B8=B8.-> =
its...@fo...
_-`-_-`-_-`-_-`-_-`-_-`-_-`-_-`-_-`-_=20
-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE =
limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Python-LDAP-dev mailing list
Pyt...@li...
https://lists.sourceforge.net/lists/listinfo/python-ldap-dev
|