Okay,

I'm sure this error has come up repeatedly on this list, but I've
googled and googled, and can't find an answer, probably because "Use of
unitialized value" comes up for just about every perl error.

I'm an occasional Perl programmer that occasionally used Net::LDAP. I'm
trying to connect to an Active Directory domain controller over SSL
using this code:

#!/usr/local/bin/perl -w

use strict;
use Net::LDAPS;

my $ad = Net::LDAP->new('dc1.domain.tld',
                     onerror=> 'warn',
                     scheme => 'ldaps',
                     verify => 'require',
                     cafile => '/path/to/windows.pem',
                       ) || die 'Couldn\'t connect to Active Directory
server';
my $mesg = $ad->bind;
my $code = $mesg->code;
if ($code != 0) {
    my $error = $mesg->error;
    print "error\n";
} else {
    print "No error binding\n";
}
$ad->unbind;

Which produces this output:

Use of uninitialized value $cn in substitution (s///) at
/usr/local/perl-5.14.2/lib/site_perl/5.14.2/IO/Socket/SSL.pm line 1076,
<DATA> line 558.
Use of uninitialized value $commonName in concatenation (.) or string at
/usr/local/perl-5.14.2/lib/site_perl/5.14.2/IO/Socket/SSL.pm line 1177,
<DATA> line 558.
No error binding

I read somewhere online that this is a harmless error, and this seems to
be true, since my program doesn't die, and I can bind without an error.

If this is harmless, why am I seeing it? If I remove the '-w' from the
interpreter line this goes away, but is that the right way to handle
this? I'm pretty sure earlier versions of my code didn't produce this
error, even with the "-w". This error is a relatively recent development
- my code didn't always do this. This error appeared after I upgraded
from RHEL 5 to RHEL 6, as I recall.

Any ideas? I'm sorry if this question has come up repeatedly on here.

-- 
Prentice 

Reply via email to