[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: ldapsearch query.
Sridhar Bandi wrote:
Thank you so much for the reply.
:)
The task can be achieved in a two step process by searching for the
entries that has the ou=local in the first step and then search those
resultant entries as base(-b) for the next search with filter as
"objectclass=*", but I want to make it in a single search. so please let
me know if is this possible.
Please go through the attached file that contains the example(may be clear
this time). I have to retrieve the entries :
"ou=local, ou=payroll, o=org.co"
"cn=John, ou=local, ou=payroll, o=org.co"
"ou=local, ou=finance, o=org.co"
" cn=Tom, ou=local, ou=finance, o=org.co"
in a single search.
If you have "cn=John,ou=local,ou=payroll,o=org.co", you can't include
"finance" in a search base, only "ou=local,ou=payroll,o=org.co". The
following *won't* work (would be nice if it did :)
ldapsearch -x -b "o=org.co" "(&(ou=local)(cn=Tom))"
But if you want both Tom in finance and John in payroll, simply begin
the search higher and use a finer filter:
ldapsearch -x -b "o=org.co" "(|(cn=Tom)(cn=John))"
This presumes that both John and Tom are unique in the organization.
What you can also do, is to wrap ldapsearch in a simple custom shell (or
other other programming language) script that repeatedly calls
ldapsearch with different parameters. By using 'echo -n' and 'read' and
using variables in a shell script, you can even make your search
interactive.
--Tonni
--
Tony Earnshaw
Do not CC me or your mail will probably be rejected.
I don't like this, either. Blame it on Swen and a slow
Internet connection.
http://www.billy.demon.nl
Mail: billy-at-billy.demon.nl