Hello,
From my pint of view the POD of Authen::SASL::Perl::GSSAPI
is missing a codeexample that demonstrates how to use the
Authen::SASL::Perl::GSSAPI module.
I promised to send Code, here is an example that's used
with Net::LDAP and makes use of the new error() Method.
So the user has a chance to see from ducumentation how to
get helpful errormessages (from the underlying Kerberossystem).
What do you think of adding that codesnippet to the POD
of Authen::SASL::Perl::GSSAPI?
Thank you,
Achim
#! /usr/bin/perl -w
use strict;
use Net::LDAP 0.33;
use Authen::SASL 2.10;
# -------- Adjust to your environment --------
my $adhost = 'theserver.bla.net';
my $ldap_base = 'dc=bla,dc=net';
my $ldap_filter = '(&(sAMAccountName=BLAAGROL))';
my $sasl = Authen::SASL->new( mechanism => 'GSSAPI' );
my $ldap;
eval {
$ldap = Net::LDAP->new( $adhost,
onerror => 'die',
) or die "Cannot connect to LDAP host '$adhost':
'$@'";
$ldap->bind( sasl => $sasl );
};
if ($@) {
chomp $@;
die "\nBind error : $@",
"\nDetailed SASL error: ", $sasl->error,
"\nTerminated";
}
print "\nLDAP bind() succeeded, working in authenticated state";
my $mesg = $ldap->search( base => $ldap_base,
filter => $ldap_filter );
# -------- evaluate $mesg