From: Michael S. <mi...@st...> - 2010-12-15 18:48:49
|
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. |