Chris,

I am using OpenLDAP's ldapsearch command. The person who created this
LDAP created a custom schema.
This command:

ldapsearch -h 10.19.15.50 -x -b
ou=addresslist,ou=test,ou=cfmrs,ou=sftaccess,o=sft -s one

Returns an entry like:

# 0001-00000003, addresslist, test, cfmrs, sftaccess, sft
dn:
SFTal=0001-00000003,ou=addresslist,ou=test,ou=cfmrs,ou=sftaccess,o=sft
SFTalentry: 0001-0000003 cn="Gaber, Brian",ou=PWGSC,o=GC,c=CA
SFTdescription: Address List for 0001-00000003
SFTal: 0001-00000003
objectClass: SFTaddresslist

This command:

ldapsearch -h 10.19.15.50 -x -b
ou=addresslist,ou=test,ou=cfmrs,ou=sftaccess,o=sft -s one SFT*

Returns an entry like:

# 0001-00000003, addresslist, test, cfmrs, sftaccess, sft
dn:
SFTal=0001-00000003,ou=addresslist,ou=test,ou=cfmrs,ou=sftaccess,o=sft


-----Original Message-----
From: Chris Ridd [mailto:[EMAIL PROTECTED] 
Sent: Thursday, December 06, 2007 12:37 PM
To: Brian Gaber
Cc: perl-ldap@perl.org
Subject: Re: Ldap search does not return expected result


On 6 Dec 2007, at 16:43, Brian G wrote:

> I run this command and I get the expected result:
>
> ldapsearch -h 10.19.15.50 -x -b
> ou=addresslist,ou=test,ou=cfmrs,ou=sftaccess,o=sft -s one dn
>
> I then try to emulate this command with Net::LDAP using this code and 
> get
> nothing:
>
> my $scope = "one";
> my $ldap = Net::LDAP->new("10.19.15.50") or die "$@"; my $mesg = 
> $ldap->search(
>                    base   =>
> "ou=addresslist,ou=test,ou=cfmrs,ou=sftaccess,o=sft",
>                    scope  => $scope,
>                    attrs  => ['*', 'dn'],
>                   );

Neither search is specifying a filter. Maybe the ldapsearch program
you're using is using a default one? Try explicitly specifying a filter.

I don't think it'll make a difference, but you're requesting different
attributes back in both cases. Also are you certain your entries have
got attributes called "dn"? Entries in standard LDAP schemas do not have
such an attribute.

Cheers,

Chris

Reply via email to