Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

Hi All,

I have created a user in OpenLDAP which has a password set.

I'd like to bind to the LDAP server as this user using Net::LDAP, but
I'm having some problems figuring out if my bind was sucessful or not.

use Net::LDAP;
$ldap = Net::LDAP->new( '' );

# bind to a directory with dn and password
$mesg = $ldap->bind( 'uid=sporter,ou=People,dc=livetechnology,dc=com',
                      password => 'xxxxx'

print $mesg."\n";



but I get this response no matter what password I use ....

How can I tell if this is working or not? All I really want to see is if
this username and password combination works.


Re: Net::LDAP

Quoted text here. Click to load it
Quoted text here. Click to load it
Quoted text here. Click to load it

You need to check $mesg->code. If this is non-zero then there is an
error and there should be a message in $mesg->error, e.g.

    die $mesg->error if $mesg->code;


Re: Net::LDAP

Warrick FitzGerald wrote:

Quoted text here. Click to load it

check out

perldoc Net::LDAP::Message

you want to do something like:

    my $errorMessage = $mesg->error();
# process failure

don't forget to run with

use strict;
use warnings;


Site Timeline