Reputation: 59
I just installed Net::LDAP, but I can't authenticate to the AD server.
#!/usr/bin/perl
use strict;
use Net::LDAP;
my $ldap = "";
$ldap = Net::LDAP->new("serv01.noboundaries.dyndns.org");
my $mesg = "";
$mesg = $ldap->bind("CN=sansken,OU=NB_Users,DC=noboundaries,DC=dyndns,DC=org", password => "XXXXXXX");
die $mesg->error() if $mesg->code();
$mesg = $ldap->unbind;
The error I'm getting is:
80090308: LdapErr: DSID-0C0903A9, comment: AcceptSecurityContext error, data 52e, v1db0 at ./ldap.pl line 11, line 751.
Upvotes: 1
Views: 1491
Reputation: 140
Try to use DOMAIN\USER, instead of full DN . You can use the upn too ( [email protected] )
This code it's working for me:
my $ad_Obj = Net::LDAP->new('my.domain.net', port => 389) or die $!;
$ad_Obj->bind('MY\FooUser', password =>'MyReallySecurePassword')or die $!;
$Mesg = $ad_Obj->search(
filter=>"(sAMAccountName=FooUser)",
attrs => "['*']",
base=>'DC=my,DC=domain,DC=net'
);
foreach $ad_Object ($Mesg->entries) {
print $ad_Object->dn() . "\n";
}
$ad_Obj->unbind;
$ad_Obj->disconnect;
Upvotes: 1