| Achim Grolms 2006-05-10, 7:11 pm |
| Hello,
=46rom 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=20
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 =3D 'theserver.bla.net';
my $ldap_base =3D 'dc=3Dbla,dc=3Dnet';
my $ldap_filter =3D '(&(sAMAccountName=3DBLAAGROL))';
my $sasl =3D Authen::SASL->new( mechanism =3D> 'GSSAPI' );
my $ldap;
eval {
$ldap =3D Net::LDAP->new( $adhost,
onerror =3D> 'die',
) or die "Cannot connect to LDAP host '$adhost':=
=20
'$@'";
$ldap->bind( sasl =3D> $sasl );
};
if ($@) {
chomp $@;
die "\nBind error : $@",
"\nDetailed SASL error: ", $sasl->error,
"\nTerminated";
}
print "\nLDAP bind() succeeded, working in authenticated state";
my $mesg =3D $ldap->search( base =3D> $ldap_base,
filter =3D> $ldap_filter );
# -------- evaluate $mesg=20
|