On 4/5/06 10:41, Scott Hegel <[EMAIL PROTECTED]> wrote:

> Hi,
> 
> I am wondering if someone can help me out.  I am trying to use the
> Net::LDAP module on perl 5.8 on a HP-UX 11.i server.  I have installed
> the module and its dependent.
> 
> I have the following in my script:
> 
> #!/opt/perl/bin
> 
> use Net::LDAP;
> use warnings;
> 
> $ad = Net::LDAP->new("ldap://my.company.com";)
>   or die("Could not connect to LDAP server.");
> 
> $mesg = $ad->bind("jimbob");
> 
> $mesg->code && die $mesg->error;
> 
> $ad->unbind
> 
> When I run this I get:
> This server requires a TLS connection at perlad.pl line 11, <DATA> line
> 225.
> 
> I am not sure why it is needs TLS for the connection.  Anyone have any
> thoughts.  

It is likely that the administrator of the server doesn't permit plaintext
authentication over an insecure connection.

You should probably fix your bind call a bit. It isn't clear what a single
argument of "jimbob" actually means; the bind method expects a DN as the
first argument and it isn't a DN, so Net::LDAP might be trying to do a
simple (ie plaintext) bind with a bad DN and no password...

Try doing a SASL bind instead, something like this (untested):

    my $sasl = Authen::SASL->new(mechanism => 'DIGEST-MD5 CRAM-MD5',
                                 callback => {
                                     user => 'jimbob',
                                     pass => 'secret'
                                 });

    $mesg = $ad->bind('', sasl => $sasl, version => 3);

See the Authen::SASL docs for more details. You can also create a TLS
connection too, either using start_tls() or by using LDAPS.

Cheers,

Chris


Reply via email to