$mesg = $ldap->search( base => $dn );
$numEnt = $mesg->count;
$mesg = $ldap->search ( base => $dn, scope => 'base',);
$numEnt = $mesg->count;
A command line ldapsearch like so works fine:
ldapsearch -h my_ldap_server -x -b "fully qualfied dn"
Try using your second attempt but add a filter of "(objectClass=*)".
--
%% Christopher A. Bongaarts %% c...@umn.edu %%
%% OIT - Identity Management %% http://umn.edu/~cab %%
%% University of Minnesota %% +1 (612) 625-1809 %%
> I have tried these two Net::LDAP approaches, but $numEnt is zero in
> both cases:
>
> $mesg = $ldap->search( base => $dn );
> $numEnt = $mesg->count;
you should add a scope, IFAIK default is base, so scope onelevel or
subtree would present the intended results.
> $mesg = $ldap->search ( base => $dn, scope => 'base',);
> $numEnt = $mesg->count;
scope base only returns the baseDN
> A command line ldapsearch like so works fine:
>
> ldapsearch -h my_ldap_server -x -b "fully qualfied dn"
If this is OpenLDAP ldapsearch, the default scope is onelevel
-Dieter
--
Dieter Klünter | Systemberatung
http://dkluenter.de
GPG Key ID:DA147B05
53°37'09,95"N
10°08'02,42"E
Is the search succeeding or failing? Add something like this:
$mesg->code && die $mesg->error;
> Both of these command line searches work:
>
> ldapsearch -h ldap_host -x -s sub -b "dn"
> ldapsearch -h ldap_host -x -b "dn"
I tried this and still do not get expected return
$mesg = $ldap->search(
base => $dn,
scope => 'base',
filter => '(objectClass=*)',
);
Both of these command line searches work: