LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   LDAP search (https://www.linuxquestions.org/questions/linux-server-73/ldap-search-832405/)

frozenQueue 09-15-2010 05:06 PM

LDAP search
 
Hi. According to my boss, I need to become an openLDAP guru in about two hours. So I might be asking a lot of LDAP questions. :)

First question: When using ldapsearch, what is the syntax if you want more than one filter applied? For example, if

Code:

  ldapsearch -h ldap.example.com -b dc=example,dc=com "(sn=Harold)"
give me one set of results and

Code:

  ldapsearch -h ldap.example.com -b dc=example,dc=com "(givenName=Frank)"
gives me another set, how do I combine the two to get only the results that match both? I tried just putting both filters on the command-line one-after-the-other, but that doesn't produce the results I expect.

AlucardZero 09-15-2010 05:17 PM

"and" them.

Code:

"(&(sn=Harold)(givenName=Frank))"
http://www.zytrax.com/books/ldap/apa/search.html

frozenQueue 09-15-2010 05:46 PM

Quote:

Originally Posted by AlucardZero (Post 4098727)
"and" them.

Code:

"(&(sn=Harold)(givenName=Frank))"
http://www.zytrax.com/books/ldap/apa/search.html

Thanks!

Wow, that sure is some very /natural/ syntax they picked there. It's a wonder we're not all LDAP gurus. :)


All times are GMT -5. The time now is 07:03 AM.