[prev in list] [next in list] [prev in thread] [next in thread]
List: perl-ldap-dev
Subject: Re: Search Method returns 0 results
From: Christoph Neumann <enigma () apu ! edu>
Date: 2001-05-07 17:18:55
[Download RAW message or body]
I noticed that your base is different in the code and in the "ldapsearch".
In the code you have "dc=mydomain,dc=com" and in the ldapsearch command
line you have "dc=mydomain, dc=com". Now theoretically the space should
not matter, but I have had problems with this in OpenLDAP 1.2.11. Try
adding the space in the Perl code and give it another shot. Anyone had a
problem with this in OpenLDAP 2.0.7?
- Christoph
On Fri, 4 May 2001, Colin Blackett wrote:
> Hi there
>
> As per the subject I am attempting to perform searches using the 'search'
> method as per the code below:
>
> #!/usr/bin/perl
> use strict;
> use Net::LDAP;
> my $ldap;
> my $mesg;
> my $mbname = 'bill';
> my $domain = 'projectshps.com';
> my $ldapSearch;
> my $ldapEntry;
> $ldap = Net::LDAP->new('localhost');
> $mesg = $ldap->bind( 'cn=Manager, dc=mydomain, dc=com', password =>
> 'mypassword');
> $ldapSearch = $ldap->search([
> base => 'dc=mydomain,dc=com',
> filter => 'cn=*',
> attrs => [],
> scope => 'sub',
> ]);
> print $ldapSearch->count . "\n";
> foreach $ldapEntry ($ldapSearch->entries){
> print $ldapEntry->get('cn');
> }
> $mesg = $ldap->unbind();
>
> This is producing one line of output, namely a 0 to indicate no results.
>
> However when I type in the shell command:
>
> ldapsearch -D 'cn=Manager, dc=mydomain, dc=com' -w 'mypassword' -b
> 'dc=mydomain, dc=com' cn=*
>
> this produces the pages of results I would expect.
>
> I'm not sure what version of the package I have - it was there when I found
> it. I have had success with the other methods though, ie add, delete,
> modify
>
> Please help
>
> Colin
>
>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic