How to find groups(CN) which contains specific words?
Michael Ströder
michael at stroeder.com
Wed Dec 15 19:30:57 CET 2010
Zhang Huangbin wrote:
> On Nov 15, 2010, at 1:16 PM, Jahidul Hasan wrote:
>> I need to find those groups name which contains the word "ABC", is it
>> possible ?
>>
>> base_dn = 'CN=ABC,OU=Common,DC=test,DC=com'
>> ldapConn.search_s(base_dn, ldap.SCOPE_SUBTREE)
>>
>> Can I use %ABC% ?
Not in base_dn.
> LDAP search filter can be wild-card, use '*ABC*' instead.
>
> Reference: http://www.zytrax.com/books/ldap/apa/search.html
The code snippet of the original poster above does not contain a search filter
at all. So additionally he should read:
http://www.python-ldap.org/doc/html/ldap.html#ldap.LDAPObject.search
ldapConn.search_s(base_dn, ldap.SCOPE_SUBTREE,filterstr='cn=*abc*')
Ciao, Michael.
More information about the python-ldap
mailing list