Hello,
I want to perform an LDAP bind using the Windows credentials I
already have (after logging on on my Windows machine).
The LDAP server is Microsoft AD LDS. (Could be also ADS - both LDAP
servers support this kind of login.)
I think the following code should work - but it does not (on Windows):
use strict;
use warnings;
use Net::LDAP;
require Authen::SASL;
my $host = 'ldap://localhost:389/';
my $ldap_base = 'c=de';
my $sasl = Authen::SASL->new( mechanism => 'GSSAPI' );
print "Mechanism: ".$sasl->mechanism."\n";
my $ldap;
$ldap = Net::LDAP->new($host);
my $bind_res = $ldap->bind(sasl => $sasl);
if ($bind_res->code) {
print "Bind problem: code ".$bind_res->code.", error
".$bind_res->error."\n";
} else {
print "Bind successful"."\n";
}
Output:
Mechanism: GSSAPI
Bind problem: code 82, error No SASL mechanism found
at C:/Perl64/site/lib/Authen/SASL.pm line 77.
at C:/Perl64/site/lib/Net/LDAP.pm line 460.
I'm using ActiveState Perl 5.20 .
C:\Perl64\site\lib\Authen\SASL\Perl\GSSAPI.pm is there.
But also "require Authen::SASL::Perl::GSSAPI;" fails:
Can't locate GSSAPI.pm in @INC (you may need to install the GSSAPI
module) (@INC
contains: C:/Perl64/site/lib C:/Perl64/lib .) at
C:/Perl64/site/lib/Authen/SASL
/Perl/GSSAPI.pm line 10, <DATA> line 751.
BEGIN failed--compilation aborted at
C:/Perl64/site/lib/Authen/SASL/Perl/GSSAPI.
pm line 10, <DATA> line 751.
The reason is probably that line 10 contains "use GSSAPI;".
According to
http://code.activestate.com/ppm/GSSAPI/ : GSSAPI couldn't
be compiled for Windows.
http://www.perlmonks.org/?node_id=851947 describes the same problem but
doesn't offer a solution.
Is there a solution? Is there another way (e.g. another module than
Authen::SASL) to get this working?
Regards, Jochen Keutel.