Hi René,

On Wednesday, 18. January 2006 22:18, René Pfeiffer wrote:
> I have a question about an LDAP query with Net::LDAP. I send queries to
> an OpenLDAP server (version 2.2.24). The queries are very simple and
> intended to detect already existing user entries. The code that prepares
> and sends the query looks like this:
>
> $filter    = "(uid=".$username.")";
> $filterobj = Net::LDAP::Filter->new($filter);
> $lres      = $ldap->search( base => $base,
>                             scope => 'sub',
>                           sizelimit => 1,
>                           timelimit => 15,
>                           attrs => ['uid','cn','mail','accountStatus'],
>                           filter => $filterobj );
>
> I ask for four attributes. The entry belong to the account object
> classes. accountStatus and mail is from qmail-ldap's object classes. The
> script and the OpenLDAP server sit on the same host, so I talk to
> localhost via TCP and OpenLDAP V3. TLS is not used. The bind works, the
> login works, the query is sent and the OpenLDAP server returns the
> resulting attributes. I double checked this with ldapsearch on the
> command line and with the tethereal sniffer by observing the TCP
> connection. However the resulting error code I get in the script is
> LDAP_DECODING_ERROR. I have no idea what I did wrong or what happenend
> here. Can anyone shed some light on this?
>
> The system the script is running on is a Debian Sarge 3.1r1 with the
> latest upgrades. The OpenLDAP server is compiled from source.

The code snippet above looks correct with only one omission:
you do not test if the Net::LDAP::Filter object was correctly created.

Unfortunately you do not tell what version of perl-ldap you use and what kind 
of data triggers the error.
I.e. what are the exact values for $base and $username, what is it that the 
server returns.

Please try inserting the call 
        $ldap->debug(15);
before the search call to find out what gets sent and received over the line.

Regards
Peter

-- 
Peter Marschall
eMail: [EMAIL PROTECTED]

Reply via email to