[Date Prev][Date Next]
Re: ldapsearch query.
Tony Earnshaw wrote:
> 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))"
unfortunately, I will not be knowing the entries under "ou=local" entries, they
might be some random users whose names are not known. I would like to list all
the entries under all "ou=local".
> 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
But I would want to make achieve in a single search to avoid the network delay.
> 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.
> Mail: billy-at-billy.demon.nl
org:Hewlett Packard;SNSL India-ISEC