I'm running the standard test program, and appear to get a successful bind,
but any search says I don't have a successful bind.

I'm completely baffled.

----- the code
#!/usr/local/bin/perl

use Net::LDAP;
use Data::Dumper;

my $host       = "dctmb001.tacoma.lcl";
my $port       = 389;
my $binduser   = "CN=xxxxxx,DC=Tacoma,DC=lcl";
my $bindpass   = "xxxxxxx";
my $connstring = "$host" . ':' . "$port";
my $basedn     = "DC=TACOMA,DC=LCL";
my $login      = "csburris";
my $filter     = "(sAMAccountName=" . $login . ")";

my $ldap       = Net::LDAP->new($connstring);

if ( $ldap->bind( $binduser, password => "$bindpass" ) ) {
    print "successful bind to $host:$port\n"; }
else { 
    print "can't bind to ldap server $host:$port ($@)\n";
    exit;   
} 

print "filter: $filter\n";
print Dumper($ldap);

$mesg = $ldap->search( base   => "$basedn",
                       scope  => 'sub',
                       filter => "$filter"
                      );


if ( $mesg->code ) {
    print Dumper($mesg->code);
    print "FAILED: error is: " . $mesg->error . "\n";
    exit;   
}
else { 
    print "found " . $mesg->count . " entries\n";
    foreach $entry ( $mesg->entries ) {
        $entry->dump;
    } 
}

if ($ldap) { 
    $ldap->unbind; 
} 

------ results
./Net-LDAP.pl
successful bind to dctmb001.tacoma.lcl:389
filter: (sAMAccountName=csburris)
$VAR1 = bless( {
                 'net_ldap_version' => 3,
                 'net_ldap_debug' => 0,
                 'net_ldap_socket' => bless( \*Symbol::GEN0,
'IO::Socket::INET' ),
                 'net_ldap_host' => 'dctmb001.tacoma.lcl:389',
                 'net_ldap_uri' => 'dctmb001.tacoma.lcl:389',
                 'net_ldap_resp' => {},
                 'net_ldap_mesg' => {},
                 'net_ldap_async' => 0,
                 'net_ldap_refcnt' => 1
               }, 'Net::LDAP' );
FAILED: error is: 00000000: LdapErr: DSID-0C090627, comment: In order to
perform this operation a successful bind must be completed on the
connection., data 0, vece

Reply via email to